From 769c62dfa5dc1c7d09cbb836f2f6842d57effcc6 Mon Sep 17 00:00:00 2001 From: Sheehan Olver Date: Fri, 10 Oct 2025 20:20:21 +0100 Subject: [PATCH 1/4] Update jacobi.jl --- src/classical/jacobi.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/classical/jacobi.jl b/src/classical/jacobi.jl index 022e3a2..bb26390 100644 --- a/src/classical/jacobi.jl +++ b/src/classical/jacobi.jl @@ -635,6 +635,6 @@ end # sum ### -_sum(P::AbstractJacobi{T}, dims) where T = 2 * (Legendre{T}() \ P)[1:1,:] +_sum(P::AbstractJacobi{T}, dims::Int) where T = 2 * (Legendre{T}() \ P)[1:1,:] From cdc923b43881ab102321db6c4d828cb60494b63c Mon Sep 17 00:00:00 2001 From: Sheehan Olver Date: Fri, 10 Oct 2025 22:26:22 +0100 Subject: [PATCH 2/4] more overloads --- src/classical/chebyshev.jl | 8 ++++---- src/classical/legendre.jl | 2 +- src/interlace.jl | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/classical/chebyshev.jl b/src/classical/chebyshev.jl index 90a82d3..68806b2 100644 --- a/src/classical/chebyshev.jl +++ b/src/classical/chebyshev.jl @@ -296,24 +296,24 @@ end # sum #### -function _sum(::Weighted{T,<:ChebyshevU}, dims) where T +function _sum(::Weighted{T,<:ChebyshevU}, dims::Int) where T @assert dims == 1 Hcat(convert(T, π)/2, Zeros{T}(1,∞)) end # Same normalization for T,V,W -function _sum(::Weighted{T,<:Chebyshev}, dims) where T +function _sum(::Weighted{T,<:Chebyshev}, dims::Int) where T @assert dims == 1 Hcat(convert(T, π), Zeros{T}(1,∞)) end -function _cumsum(T::ChebyshevT{V}, dims) where V +function _cumsum(T::ChebyshevT{V}, dims::Int) where V @assert dims == 1 Σ = _BandedMatrix(Vcat(-one(V) ./ (-2:2:∞)', Zeros{V}(1,∞), Hcat(one(V), one(V) ./ (4:2:∞)')), ℵ₀, 0, 2) ApplyQuasiArray(*, T, Vcat((-1).^(0:∞)'* Σ, Σ)) end -function _cumsum(W::Weighted{V, ChebyshevT{V}}, dims) where V +function _cumsum(W::Weighted{V, ChebyshevT{V}}, dims::Int) where V @assert dims == 1 [cumsum(ChebyshevTWeight{V}()) Weighted(ChebyshevU{V}())] * Diagonal(Vcat(one(V), -inv.(one(V):∞))) end diff --git a/src/classical/legendre.jl b/src/classical/legendre.jl index ec4154f..2d56d30 100644 --- a/src/classical/legendre.jl +++ b/src/classical/legendre.jl @@ -254,7 +254,7 @@ end # sum ### -function _sum(P::Legendre{T}, dims) where T +function _sum(P::Legendre{T}, dims::Int) where T @assert dims == 1 Hcat(convert(T, 2), Zeros{T}(1,∞)) end diff --git a/src/interlace.jl b/src/interlace.jl index e72d254..b85f7b6 100644 --- a/src/interlace.jl +++ b/src/interlace.jl @@ -272,7 +272,7 @@ end # sum ### -_sum(P::PiecewiseInterlace, dims) = BlockBroadcastArray(hcat, unitblocks.(_sum.(P.args, dims))...) +_sum(P::PiecewiseInterlace, dims::Int) = BlockBroadcastArray(hcat, unitblocks.(_sum.(P.args, dims))...) # blockvector2vectortuple From 8246067c7321a73d56a2f125ddd7c7a64af470f6 Mon Sep 17 00:00:00 2001 From: Sheehan Olver Date: Sun, 12 Oct 2025 20:42:02 +0100 Subject: [PATCH 3/4] _sum for ChebyshevT --- src/classical/chebyshev.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/classical/chebyshev.jl b/src/classical/chebyshev.jl index 68806b2..5d4b479 100644 --- a/src/classical/chebyshev.jl +++ b/src/classical/chebyshev.jl @@ -302,7 +302,7 @@ function _sum(::Weighted{T,<:ChebyshevU}, dims::Int) where T end # Same normalization for T,V,W -function _sum(::Weighted{T,<:Chebyshev}, dims::Int) where T +function _sum(::Weighted{T,<:ChebyshevT}, dims::Int) where T @assert dims == 1 Hcat(convert(T, π), Zeros{T}(1,∞)) end @@ -318,6 +318,11 @@ function _cumsum(W::Weighted{V, ChebyshevT{V}}, dims::Int) where V [cumsum(ChebyshevTWeight{V}()) Weighted(ChebyshevU{V}())] * Diagonal(Vcat(one(V), -inv.(one(V):∞))) end +function _sum(::ChebyshevT{T}, dims::Int) where T + @assert dims == 1 + permutedims(vec(Hcat(Vcat(2one(T), -(2one(T)) ./ ((3:2:∞) .* (1:2:∞))), Zeros{T}(∞))')) +end + #### # algebra #### From 5bbcb240a7dddd70b40426f840aed65fc2a7bf06 Mon Sep 17 00:00:00 2001 From: Sheehan Olver Date: Mon, 13 Oct 2025 11:26:37 +0100 Subject: [PATCH 4/4] add test --- Project.toml | 2 +- test/test_interlace.jl | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index faafbac..7468c32 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ClassicalOrthogonalPolynomials" uuid = "b30e2e7b-c4ee-47da-9d5f-2c5c27239acd" authors = ["Sheehan Olver "] -version = "0.15.6" +version = "0.15.7" [deps] diff --git a/test/test_interlace.jl b/test/test_interlace.jl index 0658721..99c3966 100644 --- a/test/test_interlace.jl +++ b/test/test_interlace.jl @@ -16,6 +16,7 @@ import ClassicalOrthogonalPolynomials: PiecewiseInterlace, SetindexInterlace, pl @test u[-0.1] ≈ exp(-0.1) @test u[0.1] ≈ exp(0.1) @test u[0.] ≈ 2 + @test sum(u) ≈ ℯ - ℯ^(-1) end @testset "two-interval ODE" begin