Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle empty coeff vectors in Multiplication for Ultraspherical spaces #70

Merged
merged 2 commits into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
7 changes: 5 additions & 2 deletions src/Spaces/Ultraspherical/UltrasphericalOperators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions test/OperatorTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down