Skip to content

Tests for polynomial-basis coefficient conversions #231

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

Merged
merged 3 commits into from
Mar 28, 2023
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
21 changes: 21 additions & 0 deletions test/JacobiTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,27 @@ using Static
end
end

@testset "Fun coefficients conversion" begin
for d in Any[(), (0..1,)]
sp1 = Any[Chebyshev(d...),
Ultraspherical(1,d...), Ultraspherical(2,d...), Ultraspherical(3.5,d...),
Jacobi(1,1,d...), Jacobi(1,2,d...)]
sp2 = Any[Jacobi(1,1,d...), Jacobi(1,2,d...),
Ultraspherical(1,d...), Ultraspherical(2,d...),
Chebyshev(d...)]
for _S1 in sp1, _S2 in sp2,
S1 in (_S1, NormalizedPolynomialSpace(_S1)),
S2 in (_S2, NormalizedPolynomialSpace(_S2))

f = Fun(x->x^4, S1)
g = Fun(f, S2)
h = Fun(g, S1)
@test f ≈ h
@test coefficients(f) ≈ coefficients(h)
end
end
end

@testset "Reverse orientation" begin
S = Jacobi(0.1,0.2)

Expand Down
17 changes: 17 additions & 0 deletions test/UltrasphericalTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,21 @@ using Static
@inferred Union{TA, TB} Integral(Ultraspherical(1), 3)
end
end

@testset "Fun coefficients conversion" begin
for d in Any[(), (0..1,)]
sp = Any[Chebyshev(d...), Ultraspherical(0.5,d...),
Ultraspherical(1,d...), Ultraspherical(2,d...), Ultraspherical(3.5,d...)]
for _S1 in sp, _S2 in sp,
S1 in (_S1, NormalizedPolynomialSpace(_S1)),
S2 in (_S2, NormalizedPolynomialSpace(_S2))

f = Fun(x->x^4, S1)
g = Fun(f, S2)
h = Fun(g, S1)
@test f ≈ h
@test coefficients(f) ≈ coefficients(h)
end
end
end
end