|
1 | 1 | using ArrayLayouts, InfiniteArrays, BandedMatrices, FillArrays, LazyArrays, Test |
2 | 2 | import BandedMatrices: _BandedMatrix, bandeddata |
3 | | -import InfiniteArrays: TridiagonalToeplitzLayout, BidiagonalToeplitzLayout, TriPertToeplitz, SymTriPertToeplitz, TriToeplitz, ConstRows, SymTriPertToeplitz, AdjTriPertToeplitz, subdiagonalconstant, diagonalconstant, supdiagonalconstant |
| 3 | +import InfiniteArrays: TridiagonalToeplitzLayout, BidiagonalToeplitzLayout, TriPertToeplitz, SymTriPertToeplitz, |
| 4 | + TriToeplitz, ConstRows, SymTriPertToeplitz, AdjTriPertToeplitz, subdiagonalconstant, |
| 5 | + diagonalconstant, supdiagonalconstant, PertTridiagonalToeplitzLayout |
4 | 6 | using Base: oneto |
5 | 7 | using LazyArrays: simplifiable, ApplyLayout, BroadcastBandedLayout, islazy |
6 | 8 |
|
@@ -138,6 +140,7 @@ const InfBandCartesianIndices = InfiniteArraysBandedMatricesExt.InfBandCartesian |
138 | 140 | @testset "TriPert" begin |
139 | 141 | A = SymTridiagonal(Vcat([1,2.], Fill(2.,∞)), Vcat([3.,4.], Fill.(0.5,∞))) |
140 | 142 | @test A isa SymTriPertToeplitz |
| 143 | + @test MemoryLayout(A) isa PertTridiagonalToeplitzLayout |
141 | 144 | @test (A + 2I)[1:10,1:10] == (2I + A)[1:10,1:10] == A[1:10,1:10] + 2I |
142 | 145 | @test BandedMatrix(A, (2,3))[1:10,1:10] == A[1:10,1:10] |
143 | 146 |
|
@@ -350,4 +353,22 @@ const InfBandCartesianIndices = InfiniteArraysBandedMatricesExt.InfBandCartesian |
350 | 353 | U = UpperTriangular(Tridiagonal(Fill(1,∞), Fill(2,∞), Fill(3,∞))) |
351 | 354 | @test MemoryLayout(U) isa BidiagonalToeplitzLayout |
352 | 355 | end |
| 356 | + |
| 357 | + @testset "padded column" begin |
| 358 | + A = BandedMatrix(1 => Fill(2im,∞), 2 => Fill(-1,∞), 3 => Fill(2,∞), -2 => Fill(-4,∞), -3 => Fill(-2im,∞)) |
| 359 | + @test MemoryLayout(A[:,5]) isa LazyArrays.PaddedColumns |
| 360 | + @test MemoryLayout(A[5,:]) isa LazyArrays.PaddedColumns |
| 361 | + |
| 362 | + @test MemoryLayout((A*A)[:,5]) isa LazyArrays.PaddedColumns |
| 363 | + @test MemoryLayout((A*A)[5,:]) isa LazyArrays.PaddedColumns |
| 364 | + |
| 365 | + V = Vcat(Zeros(1,∞), A) |
| 366 | + @test MemoryLayout(V[:,5]) isa LazyArrays.PaddedColumns |
| 367 | + @test MemoryLayout(V[5,:]) isa LazyArrays.PaddedColumns |
| 368 | + end |
| 369 | + |
| 370 | + @testset "Default broadcasted" begin |
| 371 | + A = BandedMatrix(1 => Fill(2im,∞), 2 => Fill(-1,∞), 3 => Fill(2,∞), -2 => Fill(-4,∞), -3 => Fill(-2im,∞)) |
| 372 | + @test copy(Base.broadcasted(BandedMatrices.BandedStyle(), exp,A))[1:10,1:10] == exp.(A[1:10,1:10]) |
| 373 | + end |
353 | 374 | end |
0 commit comments