1
1
using InfiniteLinearAlgebra, BlockBandedMatrices, BlockArrays, BandedMatrices, InfiniteArrays, FillArrays, LazyArrays, Test,
2
2
MatrixFactorizations, ArrayLayouts, LinearAlgebra, Random, LazyBandedMatrices
3
3
import InfiniteLinearAlgebra: qltail, toeptail, tailiterate , tailiterate!, tail_de, ql_X!,
4
- InfToeplitz, PertToeplitz, TriToeplitz, InfBandedMatrix,
4
+ InfToeplitz, PertToeplitz, TriToeplitz, InfBandedMatrix, InfBandCartesianIndices,
5
5
rightasymptotics, QLHessenberg, ConstRows, PertConstRows, BandedToeplitzLayout, PertToeplitzLayout
6
6
import Base: BroadcastStyle
7
7
import BlockArrays: _BlockArray
@@ -12,8 +12,11 @@ import LazyArrays: colsupport, ApplyStyle, MemoryLayout, ApplyLayout, LazyArrayS
12
12
import InfiniteArrays: OneToInf
13
13
import LazyBandedMatrices: BroadcastBandedBlockBandedLayout, BroadcastBandedLayout
14
14
15
+
16
+
15
17
@testset " ∞-banded" begin
16
18
D = Diagonal (Fill (2 ,∞))
19
+
17
20
B = D[1 : ∞,2 : ∞]
18
21
@test B isa BandedMatrix
19
22
@test B[1 : 10 ,1 : 10 ] == diagm (- 1 => Fill (2 ,9 ))
@@ -23,6 +26,14 @@ import LazyBandedMatrices: BroadcastBandedBlockBandedLayout, BroadcastBandedLayo
23
26
x = [1 ; 2 ; zeros (∞)]
24
27
@test A* x isa Vcat
25
28
@test (A* x)[1 : 10 ] == A[1 : 10 ,1 : 10 ]* x[1 : 10 ]
29
+
30
+ @test InfBandCartesianIndices (0 )[1 : 5 ] == CartesianIndex .(1 : 5 ,1 : 5 )
31
+ @test InfBandCartesianIndices (1 )[1 : 5 ] == CartesianIndex .(1 : 5 ,2 : 6 )
32
+ @test InfBandCartesianIndices (- 1 )[1 : 5 ] == CartesianIndex .(2 : 6 ,1 : 5 )
33
+
34
+ @test D[band (0 )] ≡ Fill (2 ,∞)
35
+ @test D[band (1 )] ≡ Fill (0 ,∞)
36
+ @test A[band (0 )][2 : 10 ] == 2 : 10
26
37
end
27
38
28
39
@testset " ∞-block arrays" begin
133
144
@test (A + I)[1 : 100 ,1 : 100 ] == A[1 : 100 ,1 : 100 ]+ I
134
145
@test (I + A)[1 : 100 ,1 : 100 ] == I+ A[1 : 100 ,1 : 100 ]
135
146
@test (I - A)[1 : 100 ,1 : 100 ] == I- A[1 : 100 ,1 : 100 ]
147
+
148
+ @test (A - im* I)[1 : 100 ,1 : 100 ] == A[1 : 100 ,1 : 100 ]- im* I
149
+ @test (A + im* I)[1 : 100 ,1 : 100 ] == A[1 : 100 ,1 : 100 ]+ im* I
150
+ @test (im* I + A)[1 : 100 ,1 : 100 ] == im* I+ A[1 : 100 ,1 : 100 ]
151
+ @test (im* I - A)[1 : 100 ,1 : 100 ] == im* I- A[1 : 100 ,1 : 100 ]
136
152
end
137
153
138
154
@testset " Fill" begin
0 commit comments