|
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 |
|
@@ -351,4 +353,22 @@ const InfBandCartesianIndices = InfiniteArraysBandedMatricesExt.InfBandCartesian |
351 | 353 | U = UpperTriangular(Tridiagonal(Fill(1,∞), Fill(2,∞), Fill(3,∞))) |
352 | 354 | @test MemoryLayout(U) isa BidiagonalToeplitzLayout |
353 | 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 |
354 | 374 | end |
0 commit comments