From dc62f3cc9c5a38f229a6a20a4cbf6112b4b921fb Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Mon, 25 Apr 2022 17:50:29 +0400 Subject: [PATCH 1/2] handle empty coeff vectors in Multiplication --- src/Spaces/Ultraspherical/UltrasphericalOperators.jl | 7 +++++-- test/OperatorTest.jl | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Spaces/Ultraspherical/UltrasphericalOperators.jl b/src/Spaces/Ultraspherical/UltrasphericalOperators.jl index 282d83d..a63117b 100644 --- a/src/Spaces/Ultraspherical/UltrasphericalOperators.jl +++ b/src/Spaces/Ultraspherical/UltrasphericalOperators.jl @@ -31,8 +31,11 @@ function Multiplication(f::Fun{C},sp::Ultraspherical{Int}) where C<:Chebyshev if order(sp) == 1 cfs = f.coefficients MultiplicationWrapper(f, - SpaceOperator(SymToeplitzOperator(cfs/2) + - HankelOperator(view(cfs,3:length(cfs))/(-2)), + SpaceOperator( + length(cfs) > 0 ? + SymToeplitzOperator(cfs/2) + + HankelOperator(view(cfs,3:length(cfs))/(-2)) : + HankelOperator(view(cfs,3:length(cfs))/(-2)), sp,sp)) else diff --git a/test/OperatorTest.jl b/test/OperatorTest.jl index 93d6ad1..a058aae 100644 --- a/test/OperatorTest.jl +++ b/test/OperatorTest.jl @@ -268,6 +268,13 @@ import ApproxFunOrthogonalPolynomials: JacobiZ @test exp(-M).f == Multiplication(exp(-x), Chebyshev()).f @test (M/3).f == (3\M).f == Multiplication(x/3, Chebyshev()).f @test (M*3).f == (3*M).f == Multiplication(x*3, Chebyshev()).f + + # test for Fun with an empty coefficients vector + v1 = Fun(Chebyshev(), Float64[]) + v2 = Fun(Chebyshev(), Float64[0.0]) + sp = Ultraspherical(1) + # the matrix representations should be identical + @test Multiplication(v1, sp)[1:4, 1:4] == Multiplication(v2, sp)[1:4, 1:4] end @testset "lastindex" begin From b93a8fdd8f9c7671d40da704d9b84f2fe06d65a7 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Tue, 26 Apr 2022 15:16:02 +0400 Subject: [PATCH 2/2] version bump to v0.4.8 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index aff6155..0810db5 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "ApproxFunOrthogonalPolynomials" uuid = "b70543e2-c0d9-56b8-a290-0d4d6d4de211" -version = "0.4.7" +version = "0.4.8" [deps] AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"