Skip to content

Conversions from Polynomials.ChebyshevT #305

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 2 commits into from
Aug 31, 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
7 changes: 6 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@ HalfIntegers = "f0d1745a-41c9-11e9-1dd9-e5d34d218721"
IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
OddEvenIntegers = "8d37c425-f37a-4ca2-9b9d-a61bc06559d2"
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[weakdeps]
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"

[extensions]
ApproxFunOrthogonalPolynomialsPolynomialsExt = "Polynomials"
ApproxFunOrthogonalPolynomialsStaticExt = "Static"

[compat]
Expand All @@ -42,6 +45,7 @@ HalfIntegers = "1.5"
IntervalSets = "0.5, 0.6, 0.7"
LazyArrays = "0.22, 1"
OddEvenIntegers = "0.1.8"
Polynomials = "2, 3, 4"
Reexport = "0.2, 1"
SpecialFunctions = "0.10, 1.0, 2"
Static = "0.8"
Expand All @@ -53,9 +57,10 @@ ApproxFunBaseTest = "a931bfaf-0cfd-4a5c-b69c-bf2eed002b43"
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
DualNumbers = "fa6b7ba4-c1ee-5f82-b5fc-ecf0adba8f74"
LazyArrays = "5078a376-72f3-5289-bfd5-ec5146d43c02"
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["ApproxFunBaseTest", "Aqua", "DualNumbers", "Test", "Static", "StaticArrays", "LazyArrays"]
test = ["ApproxFunBaseTest", "Aqua", "DualNumbers", "Test", "Static", "StaticArrays", "LazyArrays", "Polynomials"]
13 changes: 13 additions & 0 deletions ext/ApproxFunOrthogonalPolynomialsPolynomialsExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module ApproxFunOrthogonalPolynomialsPolynomialsExt

using ApproxFunOrthogonalPolynomials
import Polynomials
import ApproxFunBase: Fun

Fun(C::Polynomials.ChebyshevT, s::Chebyshev{<:ChebyshevInterval}) =
Fun(s, float.(Polynomials.coeffs(C)))

Polynomials.ChebyshevT(f::Fun{<:Chebyshev{<:ChebyshevInterval}}) =
Polynomials.ChebyshevT(copy(coefficients(f)))

end
1 change: 1 addition & 0 deletions src/ApproxFunOrthogonalPolynomials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ include("show.jl")

if !isdefined(Base, :get_extension)
include("../ext/ApproxFunOrthogonalPolynomialsStaticExt.jl")
include("../ext/ApproxFunOrthogonalPolynomialsPolynomialsExt.jl")
end

end
10 changes: 10 additions & 0 deletions test/ChebyshevTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ using Test
using ApproxFunBase: transform!, itransform!
using ApproxFunBaseTest: testspace
using ApproxFunOrthogonalPolynomials: forwardrecurrence
import Polynomials

include("testutils.jl")

Expand Down Expand Up @@ -482,6 +483,15 @@ include("testutils.jl")

@test normalizedspace(NS) == NS
end

@testset "Polynomials" begin
C = Polynomials.ChebyshevT(Float64[1,2,3])
f = Fun(C, Chebyshev())
@test Polynomials.coeffs(C) == coefficients(f)
@test C(0.2) ≈ f(0.2)
C2 = Polynomials.ChebyshevT(f)
@test C == C2
end
end

end # module