11using ContinuumArrays, QuasiArrays, LazyArrays, IntervalSets, FillArrays, LinearAlgebra, BandedMatrices, FastTransforms, InfiniteArrays, Test, Base64
22import ContinuumArrays: ℵ₁, materialize, AffineQuasiVector, BasisLayout, AdjointBasisLayout, SubBasisLayout, ℵ₁,
33 MappedBasisLayout, AdjointMappedBasisLayout, MappedWeightedBasisLayout, TransformFactorization, Weight, WeightedBasisLayout, SubWeightedBasisLayout, WeightLayout,
4- Expansion, basis, invmap, Map
4+ Expansion, basis, invmap, Map, checkpoints
55import QuasiArrays: SubQuasiArray, MulQuasiMatrix, Vec, Inclusion, QuasiDiagonal, LazyQuasiArrayApplyStyle, LazyQuasiArrayStyle
66import LazyArrays: MemoryLayout, ApplyStyle, Applied, colsupport, arguments, ApplyLayout, LdivStyle, MulStyle
77
@@ -425,6 +425,7 @@ Base.axes(T::ChebyshevWeight) = (Inclusion(-1..1),)
425425
426426Base. getindex (:: Chebyshev , x:: Float64 , n:: Int ) = cos ((n- 1 )* acos (x))
427427Base. getindex (:: ChebyshevWeight , x:: Float64 ) = 1 / sqrt (1 - x^ 2 )
428+ Base. getindex (w:: ChebyshevWeight , :: Inclusion ) = w # TODO : make automatic
428429
429430LinearAlgebra. factorize (L:: Chebyshev ) =
430431 TransformFactorization (grid (L), plan_chebyshevtransform (Array {Float64} (undef, size (L,2 ))))
@@ -451,9 +452,13 @@ ContinuumArrays.invmap(::InvQuadraticMap{T}) where T = QuadraticMap{T}()
451452 w = ChebyshevWeight ()
452453 wT = w .* T
453454 x = axes (T,1 )
454- F = factorize (T)
455- g = grid (F)
456- @test T \ exp .(x) == F \ exp .(x) == F \ exp .(g) == chebyshevtransform (exp .(g), Val (1 ))
455+
456+ @testset " basics" begin
457+ F = factorize (T)
458+ g = grid (F)
459+ @test T \ exp .(x) == F \ exp .(x) == F \ exp .(g) == chebyshevtransform (exp .(g), Val (1 ))
460+ @test all (checkpoints (T) .∈ Ref (axes (T,1 )))
461+ end
457462
458463 @testset " Weighted" begin
459464 @test MemoryLayout (w) isa WeightLayout
@@ -469,6 +474,10 @@ ContinuumArrays.invmap(::InvQuadraticMap{T}) where T = QuadraticMap{T}()
469474 @test ContinuumArrays. unweightedbasis (wT) ≡ T
470475 @test ContinuumArrays. unweightedbasis (wT2) ≡ T[:,2 : 4 ]
471476 @test ContinuumArrays. unweightedbasis (wT3) ≡ T[:,2 : 4 ]
477+
478+ @test ContinuumArrays. weight (wT) ≡ ContinuumArrays. weight (wT2) ≡ ContinuumArrays. weight (wT3) ≡ w
479+
480+ @test wT \ @. (exp (x) / sqrt (1 - x^ 2 )) ≈ T \ exp .(x)
472481 end
473482 @testset " Mapped" begin
474483 y = affine (0 .. 1 , x)
@@ -508,6 +517,7 @@ ContinuumArrays.invmap(::InvQuadraticMap{T}) where T = QuadraticMap{T}()
508517
509518 @testset " Broadcasted" begin
510519 T = Chebyshev (5 )
520+ F = factorize (T)
511521 x = axes (T,1 )
512522 a = 1 .+ x .+ x.^ 2
513523 # The following are wrong, just testing dispatch
0 commit comments