diff --git a/src/classical/chebyshev.jl b/src/classical/chebyshev.jl index 90a82d3..5d4b479 100644 --- a/src/classical/chebyshev.jl +++ b/src/classical/chebyshev.jl @@ -296,28 +296,33 @@ 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,<:ChebyshevT}, 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 +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 #### 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,:] 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