1
- using InfiniteLinearAlgebra, InfiniteArrays, BandedMatrices, FillArrays, LazyBandedMatrices, Test
1
+ using InfiniteLinearAlgebra, InfiniteArrays, BandedMatrices, FillArrays, LazyBandedMatrices, LazyArrays, Test
2
2
import BandedMatrices: _BandedMatrix
3
3
4
4
@testset " ∞-banded" begin
@@ -45,6 +45,12 @@ import BandedMatrices: _BandedMatrix
45
45
@test (A * Fill (2 ,∞))[1 : 10 ] ≈ 2 A[1 : 10 ,1 : 16 ]* ones (16 )
46
46
@test (Fill (2 ,∞,∞)* A)[1 : 10 ,1 : 10 ] ≈ fill (2 ,10 ,13 )A[1 : 13 ,1 : 10 ]
47
47
48
+ @test Eye (∞) * A isa BandedMatrix
49
+ @test A * Eye (∞) isa BandedMatrix
50
+
51
+ @test A * [1 ; 2 ; Zeros (∞)] isa Vcat
52
+ @test A * [1 ; 2 ; Zeros (∞)] == [A[1 : 5 ,1 : 2 ] * [1 ,2 ]; Zeros (∞)]
53
+
48
54
@test MemoryLayout (Tridiagonal (Fill (1 ,∞), Fill (2 ,∞), Fill (3 ,∞))) isa TridiagonalToeplitzLayout
49
55
@test MemoryLayout (Bidiagonal (Fill (1 ,∞), Fill (2 ,∞), :U )) isa BidiagonalToeplitzLayout
50
56
@test MemoryLayout (SymTridiagonal (Fill (1 ,∞), Fill (2 ,∞))) isa TridiagonalToeplitzLayout
@@ -88,6 +94,9 @@ import BandedMatrices: _BandedMatrix
88
94
@test A[2 : ∞,2 : ∞] isa PertToeplitz
89
95
90
96
@test (A + 2 I)[1 : 10 ,1 : 10 ] == (2 I + A)[1 : 10 ,1 : 10 ] == A[1 : 10 ,1 : 10 ] + 2 I
97
+
98
+ @test Eye (∞) * A isa BandedMatrix
99
+ @test A * Eye (∞) isa BandedMatrix
91
100
end
92
101
93
102
@testset " TriPert" begin
@@ -140,4 +149,13 @@ import BandedMatrices: _BandedMatrix
140
149
A, B = Diagonal (Fill (2 ,∞)) , LazyBandedMatrices. Bidiagonal (exp .(1 : ∞), exp .(1 : ∞), :L )
141
150
@test (A* B)[1 : 10 ,1 : 10 ] ≈ (B* A)[1 : 10 ,1 : 10 ] ≈ 2 B[1 : 10 ,1 : 10 ]
142
151
end
152
+
153
+ @testset " concat" begin
154
+ H = ApplyArray (hvcat, 2 , 1 , [1 Zeros (1 ,∞)], [1 ; Zeros (∞)], Diagonal (1 : ∞))
155
+ @test bandwidths (H) == (1 ,1 )
156
+ H = ApplyArray (hvcat, 2 , 1 , [0 Zeros (1 ,∞)], [0 ; Zeros (∞)], Diagonal (1 : ∞))
157
+ @test bandwidths (H) == (0 ,0 )
158
+ H = ApplyArray (hvcat, (2 ,2 ), 1 , [1 Zeros (1 ,∞)], [1 ; Zeros (∞)], Diagonal (1 : ∞))
159
+ @test_broken bandwidths (H) == (1 ,1 )
160
+ end
143
161
end
0 commit comments