Skip to content

Commit 7dd572e

Browse files
committed
weighted interface
1 parent d0eb7cf commit 7dd572e

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ArrayLayouts = "0.6.2"
2828
BandedMatrices = "0.16.5"
2929
BlockArrays = "0.14.1, 0.15"
3030
BlockBandedMatrices = "0.10"
31-
ContinuumArrays = "0.6"
31+
ContinuumArrays = "0.6.2"
3232
DomainSets = "0.4, 0.5"
3333
FFTW = "1.1"
3434
FastGaussQuadrature = "0.4.3"

src/ClassicalOrthogonalPolynomials.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import InfiniteArrays: OneToInf, InfAxes, Infinity, AbstractInfUnitRange, Infini
3030
import ContinuumArrays: Basis, Weight, basis, @simplify, Identity, AbstractAffineQuasiVector, ProjectionFactorization,
3131
inbounds_getindex, grid, transform, transform_ldiv, TransformFactorization, QInfAxes, broadcastbasis, Expansion,
3232
AffineQuasiVector, AffineMap, WeightLayout, WeightedBasisLayout, WeightedBasisLayouts, demap, AbstractBasisLayout, BasisLayout,
33-
checkpoints
33+
checkpoints, weight, unweightedbasis
3434
import FastTransforms: Λ, forwardrecurrence, forwardrecurrence!, _forwardrecurrence!, clenshaw, clenshaw!,
3535
_forwardrecurrence_next, _clenshaw_next, check_clenshaw_recurrences, ChebyshevGrid, chebyshevpoints
3636

src/normalized.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ broadcasted(::LazyQuasiArrayStyle{2}, ::typeof(*), x::Inclusion, Q::OrthonormalW
177177
abstract type AbstractWeighted{T} <: Basis{T} end
178178

179179
MemoryLayout(::Type{<:AbstractWeighted}) = WeightedBasisLayout()
180+
ContinuumArrays.unweightedbasis(wP::AbstractWeighted) = wP.P
180181

181182
"""
182183
Weighted(P)
@@ -192,12 +193,11 @@ copy(Q::Weighted) = Q
192193

193194
==(A::Weighted, B::Weighted) = A.P == B.P
194195

195-
convert(::Type{WeightedOrthogonalPolynomial}, P::Weighted) = orthogonalityweight(P.P) .* P.P
196+
weight(wP::Weighted) = orthogonalityweight(wP.P)
196197

197-
function getindex(Q::Weighted, x::Union{Number,AbstractVector}, jr::Union{Number,AbstractVector})
198-
w = orthogonalityweight(Q.P)
199-
w[x] .* Q.P[x,jr]
200-
end
198+
convert(::Type{WeightedOrthogonalPolynomial}, P::Weighted) = weight(P) .* unweightedbasis(P)
199+
200+
getindex(Q::Weighted, x::Union{Number,AbstractVector}, jr::Union{Number,AbstractVector}) = weight(Q)[x] .* unweightedbasis(Q)[x,jr]
201201
broadcasted(::LazyQuasiArrayStyle{2}, ::typeof(*), x::Inclusion, Q::Weighted) = Q * (Q.P \ (x .* Q.P))
202202

203203
\(w_A::Weighted, w_B::Weighted) = convert(WeightedOrthogonalPolynomial, w_A) \ convert(WeightedOrthogonalPolynomial, w_B)

test/test_chebyshev.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ import ContinuumArrays: MappedWeightedBasisLayout, Map
132132
WT = Weighted(ChebyshevT())
133133
@test wT[0.1,1:10] WT[0.1,1:10]
134134
@test WT \ (exp.(x) ./ sqrt.(1 .- x.^2)) wT \ (exp.(x) ./ sqrt.(1 .- x.^2))
135+
@test WT[:,1:20] \ (exp.(x) ./ sqrt.(1 .- x.^2)) (WT \ (exp.(x) ./ sqrt.(1 .- x.^2)))[1:20]
135136
end
136137

137138
@testset "mapped" begin

0 commit comments

Comments
 (0)