|
1 | 1 | using BlockArrays, BandedMatrices, BlockBandedMatrices, FillArrays, SparseArrays, Test, ArrayLayouts , LinearAlgebra |
2 | | -import BlockBandedMatrices: _BandedBlockBandedMatrix, blockcolsupport, blockrowsupport, colsupport, rowsupport, |
| 2 | +import BlockBandedMatrices: _BandedBlockBandedMatrix, blockcolsupport, blockrowsupport, colsupport, rowsupport, |
3 | 3 | isbandedblockbanded, bandeddata, BandedBlockBandedColumns |
4 | 4 | import ArrayLayouts: RangeCumsum |
5 | 5 |
|
@@ -300,7 +300,7 @@ import ArrayLayouts: RangeCumsum |
300 | 300 | @test B isa BandedBlockBandedMatrix |
301 | 301 | @test blockbandwidths(V) == blockbandwidths(B) == (2,0) |
302 | 302 | @test subblockbandwidths(V) == subblockbandwidths(B) == subblockbandwidths(A) == (λ,μ) |
303 | | - @test B == V == A[Block.(2:3), Block.(3:4)] |
| 303 | + @test B == V == A[Block.(2:3), Block.(3:4)] |
304 | 304 |
|
305 | 305 | @test A[Block.(2:3), Block.(3:4)] isa BandedBlockBandedMatrix |
306 | 306 |
|
@@ -504,6 +504,18 @@ import ArrayLayouts: RangeCumsum |
504 | 504 | A = _BandedBlockBandedMatrix(data, rows,cols, (l,u), (λ,μ)) |
505 | 505 | @test A == BandedBlockBandedMatrix(A, (2,1), (2,1)) == BandedBlockBandedMatrix{Float64}(A, (2,1), (2,1)) |
506 | 506 | end |
| 507 | + |
| 508 | + @testset "convert" begin |
| 509 | + l , u = 1,1 |
| 510 | + λ , μ = 1,1 |
| 511 | + N = M = 4 |
| 512 | + cols = rows = 1:N |
| 513 | + data = reshape(collect(1:(λ+μ+1)*(l+u+1)*sum(cols)), ((λ+μ+1)*(l+u+1), sum(cols))) |
| 514 | + A = _BandedBlockBandedMatrix(data, rows,cols, (l,u), (λ,μ)) |
| 515 | + @test AbstractArray{Float64}(A) == AbstractMatrix{Float64}(A) == AbstractArray{Int}(A) == AbstractMatrix{Int}(A) == copy(A) == A |
| 516 | + @test convert(AbstractArray{Float64}, A) == convert(AbstractMatrix{Float64}, A) == A |
| 517 | + @test convert(AbstractArray{Int}, A) ≡ convert(AbstractMatrix{Int}, A) ≡ A |
| 518 | + end |
507 | 519 | end |
508 | 520 |
|
509 | 521 | if false # turned off since tests have check-bounds=yes |
|
0 commit comments