Skip to content

Commit 231c882

Browse files
authored
Support normalized Half Weighted lowering (#23)
* Support normalized Half Weighted lowering * Update jacobi.jl
1 parent 0bc5bb4 commit 231c882

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
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.3.1"
4+
version = "0.3.2"
55

66
[deps]
77
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"

src/jacobi.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,12 @@ broadcasted(::LazyQuasiArrayStyle{2}, ::typeof(*), x::Inclusion, Q::HalfWeighted
174174
\(w_A::HalfWeighted, B::AbstractQuasiArray) = convert(WeightedOrthogonalPolynomial, w_A) \ B
175175
\(A::AbstractQuasiArray, w_B::HalfWeighted) = A \ convert(WeightedOrthogonalPolynomial, w_B)
176176

177+
function \(A::AbstractQuasiArray, w_B::WeightedOrthogonalPolynomial{<:Any,<:Weight,<:Normalized})
178+
w,B = w_B.args
179+
B̃,D = arguments(ApplyLayout{typeof(*)}(), B)
180+
(A \ (w .* B̃)) * D
181+
end
182+
177183
axes(::AbstractJacobi{T}) where T = (Inclusion{T}(ChebyshevInterval{real(T)}()), oneto(∞))
178184
==(P::Jacobi, Q::Jacobi) = P.a == Q.a && P.b == Q.b
179185
==(P::Legendre, Q::Jacobi) = Jacobi(P) == Q

src/normalized.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ abstract type AbstractWeighted{T} <: Basis{T} end
178178

179179
MemoryLayout(::Type{<:AbstractWeighted}) = WeightedBasisLayout()
180180
ContinuumArrays.unweightedbasis(wP::AbstractWeighted) = wP.P
181+
\(w_A::AbstractWeighted, w_B::AbstractWeighted) = convert(WeightedOrthogonalPolynomial, w_A) \ convert(WeightedOrthogonalPolynomial, w_B)
182+
\(w_A::AbstractWeighted, B::AbstractQuasiArray) = convert(WeightedOrthogonalPolynomial, w_A) \ B
183+
\(A::AbstractQuasiArray, w_B::AbstractWeighted) = A \ convert(WeightedOrthogonalPolynomial, w_B)
181184

182185
"""
183186
Weighted(P)
@@ -200,9 +203,6 @@ convert(::Type{WeightedOrthogonalPolynomial}, P::Weighted) = weight(P) .* unweig
200203
getindex(Q::Weighted, x::Union{Number,AbstractVector}, jr::Union{Number,AbstractVector}) = weight(Q)[x] .* unweightedbasis(Q)[x,jr]
201204
broadcasted(::LazyQuasiArrayStyle{2}, ::typeof(*), x::Inclusion, Q::Weighted) = Q * (Q.P \ (x .* Q.P))
202205

203-
\(w_A::Weighted, w_B::Weighted) = convert(WeightedOrthogonalPolynomial, w_A) \ convert(WeightedOrthogonalPolynomial, w_B)
204-
\(w_A::Weighted, B::AbstractQuasiArray) = convert(WeightedOrthogonalPolynomial, w_A) \ B
205-
\(A::AbstractQuasiArray, w_B::Weighted) = A \ convert(WeightedOrthogonalPolynomial, w_B)
206206

207207
@simplify *(Ac::QuasiAdjoint{<:Any,<:Weighted}, wB::Weighted) =
208208
convert(WeightedOrthogonalPolynomial, parent(Ac))' * convert(WeightedOrthogonalPolynomial, wB)

test/test_jacobi.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,14 @@ import ClassicalOrthogonalPolynomials: recurrencecoefficients, basis, MulQuasiMa
386386
@test convert(WeightedOrthogonalPolynomial, HalfWeighted{:a}(Normalized(Jacobi(0.1,0.2))))[0.1,1:10]
387387
HalfWeighted{:a}(Normalized(Jacobi(0.1,0.2)))[0.1,1:10]
388388
@test convert(WeightedOrthogonalPolynomial, HalfWeighted{:b}(Normalized(Jacobi(0.1,0.2))))[0.1,1:10]
389-
HalfWeighted{:b}(Normalized(Jacobi(0.1,0.2)))[0.1,1:10]
389+
HalfWeighted{:b}(Normalized(Jacobi(0.1,0.2)))[0.1,1:10]
390+
391+
392+
L = Normalized(Jacobi(0, 0)) \ HalfWeighted{:a}(Normalized(Jacobi(1, 0)))
393+
@test Normalized(Jacobi(0, 0))[0.1,1:11]'*L[1:11,1:10] HalfWeighted{:a}(Normalized(Jacobi(1, 0)))[0.1,1:10]'
394+
L = Jacobi(0, 0) \ HalfWeighted{:a}(Normalized(Jacobi(1, 0)))
395+
@test Jacobi(0, 0)[0.1,1:11]'*L[1:11,1:10] HalfWeighted{:a}(Normalized(Jacobi(1, 0)))[0.1,1:10]'
396+
L = Normalized(Jacobi(0, 0)) \ HalfWeighted{:a}(Jacobi(1, 0))
397+
@test Normalized(Jacobi(0, 0))[0.1,1:11]'*L[1:11,1:10] HalfWeighted{:a}(Jacobi(1, 0))[0.1,1:10]'
390398
end
391399
end

0 commit comments

Comments
 (0)