Skip to content

Commit 6f1ce10

Browse files
authored
Support expansion of matrices and complex-valued functions (#151)
* Support expansion of matrices and complex-valued functions * Update Project.toml * Update test_legendre.jl
1 parent bff2680 commit 6f1ce10

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

Project.toml

Lines changed: 2 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.11.3"
4+
version = "0.11.4"
55

66
[deps]
77
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
@@ -29,7 +29,7 @@ ArrayLayouts = "1.0.1"
2929
BandedMatrices = "0.17.17"
3030
BlockArrays = "0.16.9"
3131
BlockBandedMatrices = "0.12"
32-
ContinuumArrays = "0.15"
32+
ContinuumArrays = "0.15.2"
3333
DomainSets = "0.6"
3434
FFTW = "1.1"
3535
FastGaussQuadrature = "0.5"

src/ClassicalOrthogonalPolynomials.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ gives the singularity structure of an expansion, e.g.,
161161
`JacobiWeight`.
162162
"""
163163
singularities(::AbstractWeightLayout, w) = w
164-
singularities(lay::BroadcastLayout, a::AbstractQuasiVector) = singularitiesbroadcast(call(a), map(singularities, arguments(lay, a))...)
164+
singularities(lay::BroadcastLayout, a) = singularitiesbroadcast(call(a), map(singularities, arguments(lay, a))...)
165165
singularities(::WeightedBasisLayouts, a) = singularities(BroadcastLayout{typeof(*)}(), a)
166166
singularities(::WeightedOPLayout, a) = singularities(weight(a))
167167
singularities(w) = singularities(MemoryLayout(w), w)
@@ -170,7 +170,7 @@ singularities(::ExpansionLayout, f) = singularities(basis(f))
170170
singularitiesview(w, ::Inclusion) = w # for now just assume it doesn't change
171171
singularities(S::SubQuasiArray) = singularitiesview(singularities(parent(S)), parentindices(S)[1])
172172

173-
basis_axes(::Inclusion{<:Any,<:AbstractInterval}, v) = basis_singularities(singularities(v))
173+
basis_axes(::Inclusion{<:Any,<:AbstractInterval}, v) = convert(AbstractQuasiMatrix{eltype(v)}, basis_singularities(singularities(v)))
174174

175175
struct NoSingularities end
176176

src/classical/legendre.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ jacobimatrix(::Legendre{T}) where T = Tridiagonal((one(T):∞)./(1:2:∞), Zero
143143

144144
# These return vectors A[k], B[k], C[k] are from DLMF. Cause of MikaelSlevinsky we need an extra entry in C ... for now.
145145
function recurrencecoefficients(::Legendre{T}) where T
146-
n = zero(T):
146+
n = zero(real(T)):
147147
((2n .+ 1) ./ (n .+ 1), Zeros{T}(∞), n ./ (n .+ 1))
148148
end
149149

test/test_legendre.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,14 @@ import QuasiArrays: MulQuasiArray
189189
= Normalized(Legendre())
190190
@test' grammatrix(P̃) Eye(∞)
191191
end
192+
193+
@testset "log sum/diff" begin
194+
P = Legendre()
195+
z = 2 + im
196+
f = expand(P, exp)
197+
x = axes(f,1)
198+
@test sum(log.(z .- x) .* f) sum(expand(Legendre{ComplexF64}(), x -> log(z - x)*exp(x)))
199+
@test diff(log.(z .- x) .* P)[0.1,1:5] log.(z .- 0.1) .* diff(P)[0.1,1:5] - P[0.1,1:5] ./ (z .- 0.1)
200+
@test diff(log.(z .- x) .* f)[0.1] log(z - 0.1) * exp(0.1) - exp(0.1) / (z - 0.1)
201+
end
192202
end

0 commit comments

Comments
 (0)