@@ -14,9 +14,12 @@ const BidiagonalToeplitzLayout = InfiniteArraysBandedMatricesExt.BidiagonalToepl
1414const PertToeplitz = InfiniteArraysBandedMatricesExt. PertToeplitz
1515const PertToeplitzLayout = InfiniteArraysBandedMatricesExt. PertToeplitzLayout
1616const InfBandCartesianIndices = InfiniteArraysBandedMatricesExt. InfBandCartesianIndices
17+ const subdiagonalconstant = InfiniteArraysBandedMatricesExt. subdiagonalconstant
18+ const diagonalconstant = InfiniteArraysBandedMatricesExt. diagonalconstant
19+ const supdiagonalconstant = InfiniteArraysBandedMatricesExt. supdiagonalconstant
1720
1821using Base: oneto
19- using LazyArrays: simplifiable, ApplyLayout, BroadcastBandedLayout
22+ using LazyArrays: simplifiable, ApplyLayout, BroadcastBandedLayout, islazy
2023
2124@testset " ∞-banded" begin
2225 @testset " Diagonal and BandedMatrix" begin
@@ -51,7 +54,7 @@ using LazyArrays: simplifiable, ApplyLayout, BroadcastBandedLayout
5154 @test A isa InfToeplitz
5255 @test MemoryLayout (A. data) == ConstRows ()
5356 @test MemoryLayout (A) == BandedToeplitzLayout ()
54- @test LazyArrays . islazy (A) == Val (true )
57+ @test islazy (A) == Val (true )
5558
5659 V = view (A,:,3 : ∞)
5760 @test MemoryLayout (typeof (bandeddata (V))) == ConstRows ()
@@ -82,9 +85,14 @@ using LazyArrays: simplifiable, ApplyLayout, BroadcastBandedLayout
8285 T = Tridiagonal (Fill (1 ,∞), Fill (2 ,∞), Fill (3 ,∞))
8386 @test T isa TriToeplitz
8487 @test (T + 2 I)[1 : 10 ,1 : 10 ] == (2 I + T)[1 : 10 ,1 : 10 ] == T[1 : 10 ,1 : 10 ] + 2 I
88+ @test BandedMatrix (T, (2 ,3 ))[1 : 10 ,1 : 10 ] == InfToeplitz (T,(3 ,2 ))[1 : 10 ,1 : 10 ] == InfToeplitz (T)[1 : 10 ,1 : 10 ] == T[1 : 10 ,1 : 10 ]
89+ @test subdiagonalconstant (T) == 1
90+ @test diagonalconstant (T) == 2
91+ @test supdiagonalconstant (T) == 3
8592
8693 S = SymTridiagonal (Fill (1 ,∞), Fill (2 ,∞))
8794 @test (S + 2 I)[1 : 10 ,1 : 10 ] == (2 I + S)[1 : 10 ,1 : 10 ] == S[1 : 10 ,1 : 10 ] + 2 I
95+ @test BandedMatrix (S, (2 ,3 ))[1 : 10 ,1 : 10 ] == S[1 : 10 ,1 : 10 ]
8896 end
8997
9098 @testset " constant data" begin
@@ -118,9 +126,11 @@ using LazyArrays: simplifiable, ApplyLayout, BroadcastBandedLayout
118126 A = BandedMatrix (- 2 => Vcat (Float64[], Fill (1 / 4 ,∞)), 0 => Vcat ([1.0 + im,2 ,3 ],Fill (0 ,∞)), 1 => Vcat (Float64[], Fill (1 ,∞)))
119127 @test A isa PertToeplitz
120128 @test MemoryLayout (A) isa PertToeplitzLayout
129+
121130 V = view (A,2 : ∞,2 : ∞)
122131 @test MemoryLayout (V) isa PertToeplitzLayout
123132 @test BandedMatrix (V) isa PertToeplitz
133+ @test islazy (V) == Val (true )
124134 @test A[2 : ∞,2 : ∞] isa PertToeplitz
125135
126136 @test (A + 2 I)[1 : 10 ,1 : 10 ] == (2 I + A)[1 : 10 ,1 : 10 ] == A[1 : 10 ,1 : 10 ] + 2 I
@@ -133,14 +143,18 @@ using LazyArrays: simplifiable, ApplyLayout, BroadcastBandedLayout
133143 A = SymTridiagonal (Vcat ([1 ,2. ], Fill (2. ,∞)), Vcat ([3. ,4. ], Fill .(0.5 ,∞)))
134144 @test A isa SymTriPertToeplitz
135145 @test (A + 2 I)[1 : 10 ,1 : 10 ] == (2 I + A)[1 : 10 ,1 : 10 ] == A[1 : 10 ,1 : 10 ] + 2 I
146+ @test BandedMatrix (A, (2 ,3 ))[1 : 10 ,1 : 10 ] == A[1 : 10 ,1 : 10 ]
136147
137148 A = Tridiagonal (Vcat ([3. ,4. ], Fill .(0.5 ,∞)), Vcat ([1 ,2. ], Fill (2. ,∞)), Vcat ([3. ,4. ], Fill .(0.5 ,∞)))
138149 @test A isa TriPertToeplitz
139150 @test Adjoint (A) isa AdjTriPertToeplitz
140151 @test (A + 2 I)[1 : 10 ,1 : 10 ] == (2 I + A)[1 : 10 ,1 : 10 ] == A[1 : 10 ,1 : 10 ] + 2 I
141152 @test (Adjoint (A) + 2 I)[1 : 10 ,1 : 10 ] == (2 I + Adjoint (A))[1 : 10 ,1 : 10 ] == Adjoint (A)[1 : 10 ,1 : 10 ] + 2 I
153+ @test BandedMatrix (A, (2 ,3 ))[1 : 10 ,1 : 10 ] == A[1 : 10 ,1 : 10 ]
142154 end
143155
156+
157+
144158 @testset " InfBanded" begin
145159 A = _BandedMatrix (Fill (2 ,4 ,∞),ℵ₀,2 ,1 )
146160 B = _BandedMatrix (Fill (3 ,2 ,∞),ℵ₀,- 1 ,2 )
@@ -213,7 +227,7 @@ using LazyArrays: simplifiable, ApplyLayout, BroadcastBandedLayout
213227 @test A[band (2 )][1 : 5 ] == [1 ; fill (2 ,4 )]
214228 @test A[band (4 )] ≡ Zeros {Int} (∞)
215229 end
216-
230+
217231 @testset " prepad with fill" begin
218232 A = BandedMatrix (2 => Zeros (∞))
219233 @test A[band (2 )][1 : 10 ] == Zeros (10 )
0 commit comments