Skip to content

Commit 946e091

Browse files
authored
Handle empty coeff vectors in Multiplication for Ultraspherical spaces (#70)
* handle empty coeff vectors in Multiplication * version bump to v0.4.8
1 parent 17583d6 commit 946e091

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ApproxFunOrthogonalPolynomials"
22
uuid = "b70543e2-c0d9-56b8-a290-0d4d6d4de211"
3-
version = "0.4.7"
3+
version = "0.4.8"
44

55
[deps]
66
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"

src/Spaces/Ultraspherical/UltrasphericalOperators.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ function Multiplication(f::Fun{C},sp::Ultraspherical{Int}) where C<:Chebyshev
3131
if order(sp) == 1
3232
cfs = f.coefficients
3333
MultiplicationWrapper(f,
34-
SpaceOperator(SymToeplitzOperator(cfs/2) +
35-
HankelOperator(view(cfs,3:length(cfs))/(-2)),
34+
SpaceOperator(
35+
length(cfs) > 0 ?
36+
SymToeplitzOperator(cfs/2) +
37+
HankelOperator(view(cfs,3:length(cfs))/(-2)) :
38+
HankelOperator(view(cfs,3:length(cfs))/(-2)),
3639
sp,sp))
3740

3841
else

test/OperatorTest.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,13 @@ import ApproxFunOrthogonalPolynomials: JacobiZ
268268
@test exp(-M).f == Multiplication(exp(-x), Chebyshev()).f
269269
@test (M/3).f == (3\M).f == Multiplication(x/3, Chebyshev()).f
270270
@test (M*3).f == (3*M).f == Multiplication(x*3, Chebyshev()).f
271+
272+
# test for Fun with an empty coefficients vector
273+
v1 = Fun(Chebyshev(), Float64[])
274+
v2 = Fun(Chebyshev(), Float64[0.0])
275+
sp = Ultraspherical(1)
276+
# the matrix representations should be identical
277+
@test Multiplication(v1, sp)[1:4, 1:4] == Multiplication(v2, sp)[1:4, 1:4]
271278
end
272279

273280
@testset "lastindex" begin

0 commit comments

Comments
 (0)