1
1
using ContinuumArrays, QuasiArrays, LazyArrays, IntervalSets, FillArrays, LinearAlgebra, BandedMatrices, FastTransforms, InfiniteArrays, Test, Base64
2
2
import ContinuumArrays: ℵ₁, materialize, AffineQuasiVector, BasisLayout, AdjointBasisLayout, SubBasisLayout, ℵ₁,
3
3
MappedBasisLayout, AdjointMappedBasisLayout, MappedWeightedBasisLayout, TransformFactorization, Weight, WeightedBasisLayout, SubWeightedBasisLayout, WeightLayout,
4
- Expansion, basis, invmap, Map
4
+ Expansion, basis, invmap, Map, checkpoints
5
5
import QuasiArrays: SubQuasiArray, MulQuasiMatrix, Vec, Inclusion, QuasiDiagonal, LazyQuasiArrayApplyStyle, LazyQuasiArrayStyle
6
6
import LazyArrays: MemoryLayout, ApplyStyle, Applied, colsupport, arguments, ApplyLayout, LdivStyle, MulStyle
7
7
@@ -425,6 +425,7 @@ Base.axes(T::ChebyshevWeight) = (Inclusion(-1..1),)
425
425
426
426
Base. getindex (:: Chebyshev , x:: Float64 , n:: Int ) = cos ((n- 1 )* acos (x))
427
427
Base. getindex (:: ChebyshevWeight , x:: Float64 ) = 1 / sqrt (1 - x^ 2 )
428
+ Base. getindex (w:: ChebyshevWeight , :: Inclusion ) = w # TODO : make automatic
428
429
429
430
LinearAlgebra. factorize (L:: Chebyshev ) =
430
431
TransformFactorization (grid (L), plan_chebyshevtransform (Array {Float64} (undef, size (L,2 ))))
@@ -451,9 +452,13 @@ ContinuumArrays.invmap(::InvQuadraticMap{T}) where T = QuadraticMap{T}()
451
452
w = ChebyshevWeight ()
452
453
wT = w .* T
453
454
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
457
462
458
463
@testset " Weighted" begin
459
464
@test MemoryLayout (w) isa WeightLayout
@@ -469,6 +474,10 @@ ContinuumArrays.invmap(::InvQuadraticMap{T}) where T = QuadraticMap{T}()
469
474
@test ContinuumArrays. unweightedbasis (wT) ≡ T
470
475
@test ContinuumArrays. unweightedbasis (wT2) ≡ T[:,2 : 4 ]
471
476
@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)
472
481
end
473
482
@testset " Mapped" begin
474
483
y = affine (0 .. 1 , x)
@@ -508,6 +517,7 @@ ContinuumArrays.invmap(::InvQuadraticMap{T}) where T = QuadraticMap{T}()
508
517
509
518
@testset " Broadcasted" begin
510
519
T = Chebyshev (5 )
520
+ F = factorize (T)
511
521
x = axes (T,1 )
512
522
a = 1 .+ x .+ x.^ 2
513
523
# The following are wrong, just testing dispatch
0 commit comments