Skip to content

Commit 4e13ae1

Browse files
committed
Support DynamicPolynomials.jl
1 parent 50a37b4 commit 4e13ae1

File tree

6 files changed

+35
-6
lines changed

6 files changed

+35
-6
lines changed

Project.toml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ClassicalOrthogonalPolynomials"
22
uuid = "b30e2e7b-c4ee-47da-9d5f-2c5c27239acd"
33
authors = ["Sheehan Olver <[email protected]>"]
4-
version = "0.13.7"
4+
version = "0.13.8"
55

66
[deps]
77
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
@@ -26,13 +26,20 @@ RecurrenceRelationships = "807425ed-42ea-44d6-a357-6771516d7b2c"
2626
RecurrenceRelationshipArrays = "b889d2dc-af3c-4820-88a8-238fa91d3518"
2727
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
2828

29+
[weakdeps]
30+
MutableArithmetics = "d8a4904e-b15c-11e9-3269-09a3773c0cb0"
31+
32+
[extensions]
33+
ClassicalOrthogonalPolynomialsMutableArithmeticsExt = "MutableArithmetics"
34+
2935
[compat]
3036
ArrayLayouts = "1.3.1"
3137
BandedMatrices = "1"
3238
BlockArrays = "1"
3339
BlockBandedMatrices = "0.13"
3440
ContinuumArrays = "0.18.3"
3541
DomainSets = "0.6, 0.7"
42+
DynamicPolynomials = "0.6"
3643
FFTW = "1.1"
3744
FastGaussQuadrature = "1"
3845
FastTransforms = "0.16.6"
@@ -43,6 +50,7 @@ InfiniteLinearAlgebra = "0.8"
4350
IntervalSets = "0.7"
4451
LazyArrays = "2.2"
4552
LazyBandedMatrices = "0.10"
53+
MutableArithmetics = "1"
4654
QuasiArrays = "0.11"
4755
RecurrenceRelationships = "0.1"
4856
RecurrenceRelationshipArrays = "0.1"
@@ -51,11 +59,12 @@ julia = "1.10"
5159

5260
[extras]
5361
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
62+
DynamicPolynomials = "7c1d4256-1411-5781-91ec-d7bc3513ac07"
5463
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
5564
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
5665
SemiseparableMatrices = "f8ebbe35-cbfb-4060-bf7f-b10e4670cf57"
5766
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
5867
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
5968

6069
[targets]
61-
test = ["Base64", "Test", "ForwardDiff", "SemiseparableMatrices", "StaticArrays", "Random"]
70+
test = ["Base64", "Test", "ForwardDiff", "SemiseparableMatrices", "StaticArrays", "Random", "DynamicPolynomials"]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module ClassicalOrthogonalPolynomialsMutableArithmeticsExt
2+
using ClassicalOrthogonalPolynomials, MutableArithmetics
3+
using ClassicalOrthogonalPolynomials: initiateforwardrecurrence, recurrencecoefficients, _p0
4+
5+
Base.unsafe_getindex(P::OrthogonalPolynomial, x::AbstractMutable, n::Number) = initiateforwardrecurrence(n-1, recurrencecoefficients(P)..., x, _p0(P))[end]
6+
7+
end

src/classical/chebyshev.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ chebyshevu(S::AbstractQuasiMatrix) = chebyshevu(axes(S,1))
6161
6262
computes the `n`-th Chebyshev polynomial of the first kind at `z`.
6363
"""
64-
chebyshevt(n::Integer, z::Number) = Base.unsafe_getindex(ChebyshevT{typeof(z)}(), z, n+1)
64+
chebyshevt(n::Integer, z) = Base.unsafe_getindex(ChebyshevT{typeof(z)}(), z, n+1)
6565
"""
6666
chebyshevt(n, z)
6767
6868
computes the `n`-th Chebyshev polynomial of the second kind at `z`.
6969
"""
70-
chebyshevu(n::Integer, z::Number) = Base.unsafe_getindex(ChebyshevU{typeof(z)}(), z, n+1)
70+
chebyshevu(n::Integer, z) = Base.unsafe_getindex(ChebyshevU{typeof(z)}(), z, n+1)
7171

7272
chebysevtweight(d::AbstractInterval{T}) where T = ChebyshevTWeight{float(T)}[affine(d,ChebyshevInterval{T}())]
7373
chebysevuweight(d::AbstractInterval{T}) where T = ChebyshevUWeight{float(T)}[affine(d,ChebyshevInterval{T}())]

src/classical/legendre.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ legendre(d::Inclusion) = legendre(d.domain)
6767
6868
computes the `n`-th Legendre polynomial at `z`.
6969
"""
70-
legendrep(n::Integer, z::Number) = Base.unsafe_getindex(Legendre{typeof(z)}(), z, n+1)
70+
legendrep(n::Integer, z) = Base.unsafe_getindex(Legendre{typeof(z)}(), z, n+1)
7171

7272

7373
show(io::IO, w::Legendre{Float64}) = summary(io, w)

test/runtests.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,6 @@ end
8585
@testset "Issue #179" begin
8686
@test startswith(sprint(show, MIME"text/plain"(), Chebyshev()[0.3, :]; context=(:compact=>true, :limit=>true)), "ℵ₀-element view(::ChebyshevT{Float64}, 0.3, :)")
8787
@test startswith(sprint(show, MIME"text/plain"(), Jacobi(0.2, 0.5)[-0.7, :]; context=(:compact=>true, :limit=>true)), "ℵ₀-element view(::Jacobi{Float64}, -0.7, :)")
88-
end
88+
end
89+
90+
include("test_dynamicpolynomials.jl")

test/test_dynamicpolynomials.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using DynamicPolynomials, ClassicalOrthogonalPolynomials, Test
2+
3+
@polyvar x
4+
5+
@testset "DynamicPolynomials" begin
6+
@test chebyshevt(0,x) == 1
7+
@test chebyshevt(1,x) == x
8+
@test chebyshevt(5,x) == 5x - 20x^3 + 16x^5
9+
@test chebyshevu(5,x) == 6x - 32x^3 + 32x^5
10+
legendrep(5,x)
11+
end

0 commit comments

Comments
 (0)