diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 786ac7e..bdc47ca 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -24,7 +24,7 @@ jobs: - uses: julia-actions/setup-julia@v2 with: version: '1.10' - - uses: julia-actions/cache@v1 + - uses: julia-actions/cache@v2 - name: Install dependencies run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' - name: Build and deploy diff --git a/Project.toml b/Project.toml index 7d1e482..7b134d9 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "BlockBandedMatrices" uuid = "ffab5731-97b5-5995-9138-79e8c1846df0" -version = "0.12.11" +version = "0.13" [deps] ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a" @@ -20,12 +20,12 @@ BlockBandedMatricesSparseArraysExt = "SparseArrays" [compat] Aqua = "0.8" ArrayLayouts = "1" -BandedMatrices = "0.17.2, 1" -BlockArrays = "0.16.34" +BandedMatrices = "1" +BlockArrays = "1" Documenter = "1" FillArrays = "1" LinearAlgebra = "1.6" -MatrixFactorizations = "1, 2" +MatrixFactorizations = "1, 2, 3" Random = "1.6" SparseArrays = "1.6" Test = "1.6" diff --git a/docs/Project.toml b/docs/Project.toml index 5e84b83..959c459 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -6,6 +6,6 @@ FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" [compat] -BlockArrays = "0.16" +BlockArrays = "1" Documenter = "1" FillArrays = "1" diff --git a/docs/src/index.md b/docs/src/index.md index 32883bc..0cd40c8 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -50,7 +50,7 @@ the strided matrix interface, but we can also use BLAS and LAPACK to, for exampl upper-triangularize a block column all at once. -A `BandedBlockBandedMatrix` stores the entries as a `PseudoBlockMatrix`, +A `BandedBlockBandedMatrix` stores the entries as a `BlockedMatrix`, with the number of row blocks equal to `A.l + A.u + 1`, and the row block sizes are all `A.μ + A.λ + 1`. The column block sizes of the storage is the same as the the column block sizes of the `BandedBlockBandedMatrix`. This @@ -69,7 +69,7 @@ of row and column blocks, then `A` has zero structure ⋅ ⋅ │ a_53 ⋅ ⋅ ⋅ │ a_63 a_64 ] ``` -and is stored in memory via `A.data` as a `PseudoBlockMatrix`, which has block sizes +and is stored in memory via `A.data` as a `BlockedMatrix`, which has block sizes 2 x 2, containing entries: ```julia [a_11 a_22 │ a_33 a_44 diff --git a/examples/blockarray_backend.jl b/examples/blockarray_backend.jl index c0c968d..d6e295e 100644 --- a/examples/blockarray_backend.jl +++ b/examples/blockarray_backend.jl @@ -4,7 +4,7 @@ using CuArrays using CuArrays.CUBLAS: libcublas_handle, cublasSetStream_v2, CuDefaultStream using CUDAnative.CUDAdrv: CuStream using GPUArrays -using BlockArrays: _BlockArray, PseudoBlockArray, BlockArray, BlockMatrix, BlockVector, +using BlockArrays: _BlockArray, BlockedArray, BlockArray, BlockMatrix, BlockVector, nblocks, Block, cumulsizes, AbstractBlockVector using BlockBandedMatrices: BandedBlockBandedMatrix, _BandedBlockBandedMatrix, blockbandwidths, subblockbandwidths, blockbandwidth, @@ -22,13 +22,13 @@ import LinearAlgebra # BlockArrays adapt(T::Type{<:AbstractArray}, b::BlockArray) = _BlockArray(T.(b.blocks), b.block_sizes) -adapt(T::Type{<:AbstractArray}, b::PseudoBlockArray) = - PseudoBlockArray(T(b.blocks), b.block_sizes) -adapt(T::Type{<:PseudoBlockArray}, b::BlockArray) = T(b.blocks, b.block_sizes) -adapt(T::Type{<:BlockArray}, b::PseudoBlockArray) = T(b.blocks, b.block_sizes) +adapt(T::Type{<:AbstractArray}, b::BlockedArray) = + BlockedArray(T(b.blocks), b.block_sizes) +adapt(T::Type{<:BlockedArray}, b::BlockArray) = T(b.blocks, b.block_sizes) +adapt(T::Type{<:BlockArray}, b::BlockedArray) = T(b.blocks, b.block_sizes) # CuArrays and BlockArrays if @isdefined CuArray - adapt(T::Type{<:CuArray}, b::PseudoBlockArray) = adapt(T, BlockArray(b)) + adapt(T::Type{<:CuArray}, b::BlockedArray) = adapt(T, BlockArray(b)) end ############### @@ -138,22 +138,22 @@ function testme() end end - @testset "PseudoBlockArray Adapters" begin - bmat = PseudoBlockArray{Float64}(undef, [1, 1], [2, 2]) + @testset "BlockedArray Adapters" begin + bmat = BlockedArray{Float64}(undef, [1, 1], [2, 2]) @test eltype(adapt(JLArray, bmat)) === Float64 - @test adapt(JLArray, bmat) isa PseudoBlockArray + @test adapt(JLArray, bmat) isa BlockedArray if @isdefined CuArray - @test !(adapt(CuArray, bmat) isa PseudoBlockArray) + @test !(adapt(CuArray, bmat) isa BlockedArray) @test adapt(CuArray, bmat) isa BlockArray{T, 2, CuArray{T, 2}} where T @test cu(bmat) isa BlockArray{T, 2, CuArray{T, 2}} where T @test eltype(cu(bmat)) === Float32 end end - @testset "PseudoBlockArray Adapters" begin + @testset "BlockedArray Adapters" begin bmat = BandedBlockBandedMatrix{Float64}(undef, ([1, 1], [2, 2]), (1, 2), (1, 1)) @test adapt(JLArray, bmat) isa BandedBlockBandedMatrix - @test adapt(JLArray, bmat).data isa PseudoBlockArray{T, 2, JLArray{T, 2}} where T + @test adapt(JLArray, bmat).data isa BlockedArray{T, 2, JLArray{T, 2}} where T @test eltype(adapt(JLArray, bmat)) === Float64 if @isdefined CuArray @test adapt(CuArray, bmat).data isa BlockArray{T, 2, CuArray{T, 2}} where T @@ -172,7 +172,7 @@ function testme() Ablock = adapt(BlockArray, A) cblock = BlockArray(Array{Float64, 1}(undef, size(A, 1)), n) cblock .= rand.() - x = PseudoBlockArray(Array{Float64, 1}(undef, size(A, 2)), m) + x = BlockedArray(Array{Float64, 1}(undef, size(A, 2)), m) x .= rand.() xblock = adapt(BlockArray, x) @@ -192,7 +192,7 @@ using Statistics function benchmarks() suite = BenchmarkGroup() # suite["viabm"] = BenchmarkGroup() - suite["pseudo"] = BenchmarkGroup() + suite["blocked"] = BenchmarkGroup() suite["block"] = BenchmarkGroup() if @isdefined CuArrays suite["gpu"] = BenchmarkGroup() @@ -205,12 +205,12 @@ function benchmarks() A = BandedBlockBandedMatrix{Float64}( undef, (repeat([n], N), repeat([m], M)), (l, u), (λ, μ)) A.data .= rand.() - c = PseudoBlockArray(Array{Float64, 1}(undef, size(A, 1)), repeat([n], N)) + c = BlockedArray(Array{Float64, 1}(undef, size(A, 1)), repeat([n], N)) c .= rand.() - x = PseudoBlockArray(Array{Float64, 1}(undef, size(A, 2)), repeat([m], M)) + x = BlockedArray(Array{Float64, 1}(undef, size(A, 2)), repeat([m], M)) x .= rand.() - suite["pseudo"]["N=$N n=$n"] = @benchmarkable begin + suite["blocked"]["N=$N n=$n"] = @benchmarkable begin $c .= Mul($A, $x) end suite["block"]["N=$N n=$n"] = @benchmarkable begin @@ -234,6 +234,6 @@ function benchmarks() end block_ratio(result, name; method=median) = - ratio(method(result["block"][name]), method(result["pseudo"][name])) + ratio(method(result["block"][name]), method(result["blocked"][name])) viabm_ratio(result, name; method=median) = ratio(method(result["viabm"][name]), method(result["block"][name])) diff --git a/examples/shared_array_backend.jl b/examples/shared_array_backend.jl index 24b4e62..26642f4 100644 --- a/examples/shared_array_backend.jl +++ b/examples/shared_array_backend.jl @@ -1,4 +1,4 @@ -using BlockArrays: _BlockArray, PseudoBlockArray, BlockArray, BlockMatrix, BlockVector, +using BlockArrays: _BlockArray, BlockedArray, BlockArray, BlockMatrix, BlockVector, nblocks, Block, cumulsizes, AbstractBlockVector using BlockBandedMatrices: BandedBlockBandedMatrix, _BandedBlockBandedMatrix, blockbandwidths, subblockbandwidths, blockbandwidth, @@ -15,12 +15,12 @@ import Adapt: adapt adapt(T::Type, b::BandedBlockBandedMatrix) = _BandedBlockBandedMatrix(adapt(T, b.data), b.block_sizes) -adapt(T::Type{<:AbstractArray}, b::PseudoBlockArray) = - PseudoBlockArray(T(b.blocks), b.block_sizes) +adapt(T::Type{<:AbstractArray}, b::BlockedArray) = + BlockedArray(T(b.blocks), b.block_sizes) const SharedBandedBlockBandedMatrix = - BandedBlockBandedMatrix{T, PseudoBlockArray{T, 2, SharedArray{T, 2}}} where T + BandedBlockBandedMatrix{T, BlockedArray{T, 2, SharedArray{T, 2}}} where T function SharedBandedBlockBandedMatrix{T}(::UndefInitializer, bs::BandedBlockBandedSizes; @@ -155,7 +155,7 @@ function testme() n, m = rand(max(l, u, λ, μ):20, N), rand(max(l, u, λ, μ):20, M) A = BandedBlockBandedMatrix{Float64}(undef, (n, m), (l, u), (λ, μ)) A.data .= rand.() - x = PseudoBlockArray(Array{Float64, 1}(undef, size(A, 2)), m) + x = BlockedArray(Array{Float64, 1}(undef, size(A, 2)), m) x .= rand.() Ashared = adapt(SharedArray, A) @@ -163,7 +163,7 @@ function testme() @test Ashared isa SharedBandedBlockBandedMatrix @test length(procs(Ashared)) == max(1, length(procs()) - 1) cshared = adapt(SharedArray, - PseudoBlockArray(Array{Float64, 1}(undef, size(A, 1)), n)) + BlockedArray(Array{Float64, 1}(undef, size(A, 1)), n)) @test cshared.blocks isa SharedArray cshared .= rand.() xshared = adapt(SharedArray, x) diff --git a/examples/sharedarrays.jl b/examples/sharedarrays.jl index b76b132..db80aee 100644 --- a/examples/sharedarrays.jl +++ b/examples/sharedarrays.jl @@ -7,7 +7,7 @@ pids = addprocs(4) function shared_BandedBlockBandedMatrix(::UndefInitializer, bs::BlockSizes, (l, u), (λ, μ); pids=Int[]) bs = BandedBlockBandedSizes(bs, l, u, λ, μ) data = SharedMatrix{Float64}((l+u+1)*(λ+μ+1), size(A,2); pids=pids) - _BandedBlockBandedMatrix(PseudoBlockArray(data, bs.data_block_sizes), bs) + _BandedBlockBandedMatrix(BlockedArray(data, bs.data_block_sizes), bs) end shared_BandedBlockBandedMatrix(::UndefInitializer, (N,M), (l, u), (λ, μ); pids=Int[]) = diff --git a/src/BandedBlockBandedMatrix.jl b/src/BandedBlockBandedMatrix.jl index d3d3b30..770efd1 100644 --- a/src/BandedBlockBandedMatrix.jl +++ b/src/BandedBlockBandedMatrix.jl @@ -39,15 +39,14 @@ struct BandedBlockBandedMatrix{T, BLOCKS, RAXIS<:AbstractUnitRange{Int}} <: Abst end end -const DefaultBandedBlockBandedMatrix{T} = BandedBlockBandedMatrix{T, PseudoBlockMatrix{T, Matrix{T}, NTuple{2,DefaultBlockAxis}}, DefaultBlockAxis} +const DefaultBandedBlockBandedMatrix{T} = BandedBlockBandedMatrix{T, BlockedMatrix{T, Matrix{T}, NTuple{2,DefaultBlockAxis}}, DefaultBlockAxis} @inline _BandedBlockBandedMatrix(data::AbstractMatrix, axes::NTuple{2,AbstractUnitRange{Int}}, lu::NTuple{2,Int}, λμ::NTuple{2,Int}) = - _BandedBlockBandedMatrix(PseudoBlockArray(data,(blockedrange(Fill(sum(λμ)+1,sum(lu)+1)),axes[2])), axes[1], lu, λμ) + _BandedBlockBandedMatrix(BlockedArray(data,(blockedrange(Fill(sum(λμ)+1,sum(lu)+1)),axes[2])), axes[1], lu, λμ) @inline _BandedBlockBandedMatrix(data::AbstractMatrix,rblocksizes::AbstractVector{Int}, cblocksizes::AbstractVector{Int}, lu::NTuple{2,Int}, λμ::NTuple{2,Int}) = _BandedBlockBandedMatrix(data, (blockedrange(rblocksizes),blockedrange(cblocksizes)), lu, λμ) -_blocklengths2blocklasts(b::Fill) = cumsum(b) _bbb_data_axes(caxes, lu, λμ) = (blockedrange(Fill(max(0,sum(λμ)+1),max(0,sum(lu)+1))),caxes) BandedBlockBandedMatrix{T,B,R}(::UndefInitializer, axes::NTuple{2,AbstractUnitRange{Int}}, lu::NTuple{2,Int}, λμ::NTuple{2,Int}) where {T,B,R<:AbstractUnitRange{Int}} = @@ -61,7 +60,7 @@ BandedBlockBandedMatrix{T,B}(::UndefInitializer, rblocksizes::AbstractVector{Int BandedBlockBandedMatrix{T,B}(undef, (blockedrange(rblocksizes),blockedrange(cblocksizes)), lu, λμ) BandedBlockBandedMatrix{T}(::UndefInitializer, axes::NTuple{2,AbstractUnitRange{Int}}, lu::NTuple{2,Int}, λμ::NTuple{2,Int}) where T = - _BandedBlockBandedMatrix(PseudoBlockMatrix{T}(undef, _bbb_data_axes(axes[2],lu,λμ)), axes[1], lu, λμ) + _BandedBlockBandedMatrix(BlockedMatrix{T}(undef, _bbb_data_axes(axes[2],lu,λμ)), axes[1], lu, λμ) """ BandedBlockBandedMatrix{T}(undef, rows, cols, (l, u), (λ, μ)) @@ -242,11 +241,11 @@ convert(::Type{AbstractMatrix{T}}, B::BandedBlockBandedMatrix{T}) where T = B similar(A::BandedBlockBandedMatrix, ::Type{T}, axes::NTuple{2,AbstractUnitRange{Int}}) where T = BandedBlockBandedMatrix{T}(undef, axes, blockbandwidths(A), subblockbandwidths(A)) -@inline similar(A::BandedBlockBandedMatrix, ::Type{T}, axes::Tuple{BlockedUnitRange,AbstractUnitRange{Int}}) where T = +@inline similar(A::BandedBlockBandedMatrix, ::Type{T}, axes::Tuple{AbstractBlockedUnitRange,AbstractUnitRange{Int}}) where T = BandedBlockBandedMatrix{T}(undef, axes, blockbandwidths(A), subblockbandwidths(A)) -@inline similar(A::BandedBlockBandedMatrix, ::Type{T}, axes::Tuple{AbstractUnitRange{Int},BlockedUnitRange}) where T = +@inline similar(A::BandedBlockBandedMatrix, ::Type{T}, axes::Tuple{AbstractUnitRange{Int},AbstractBlockedUnitRange}) where T = BandedBlockBandedMatrix{T}(undef, axes, blockbandwidths(A), subblockbandwidths(A)) -@inline similar(A::BandedBlockBandedMatrix, ::Type{T}, axes::Tuple{BlockedUnitRange,BlockedUnitRange}) where T = +@inline similar(A::BandedBlockBandedMatrix, ::Type{T}, axes::Tuple{AbstractBlockedUnitRange,AbstractBlockedUnitRange}) where T = BandedBlockBandedMatrix{T}(undef, axes, blockbandwidths(A), subblockbandwidths(A)) @@ -289,7 +288,7 @@ subblockbandwidths(A::BandedBlockBandedMatrix) = (A.λ, A.μ) # default is to use whole block _subblockbandwidths(A::AbstractMatrix, ::NTuple{2,OneTo{Int}}) = bandwidths(A) function _subblockbandwidths(A::AbstractMatrix, _) - M,N = map(maximum, blocksizes(A)) + M,N = map(maximum, blocklengths.(axes(A))) M-1,N-1 end @@ -401,7 +400,7 @@ const SubBandedBlockBandedMatrix{T,R1,R2} = SubArray{T,2,<:BandedBlockBandedMatrix{T},<:Tuple{BlockSlice{R1},BlockSlice{R2}}} const SingleBlockInd = Union{BlockSlice1, BlockSlice{<:BlockIndexRange1}} -const BlockRangeInd = Union{BlockSlices, BlockedUnitRange} +const BlockRangeInd = Union{BlockSlices, AbstractBlockedUnitRange} sublayout(::BandedBlockBandedColumns{ML}, ::Type{II}) where {ML,II<:Tuple{SingleBlockInd,SingleBlockInd}} = bandedcolumns(sublayout(ML(), II)) sublayout(::BandedBlockBandedColumns{ML}, ::Type{II}) where {ML,II<:Tuple{BlockRangeInd,BlockRangeInd}} = bandedblockbandedcolumns(sublayout(ML(), II)) @@ -410,7 +409,7 @@ sublayout(::BandedBlockBandedColumns{ML}, ::Type{II}) where {ML,II<:Tuple{BlockR _blockaxes1(A::BlockSlice) = A.block _blockaxes1(A::Slice) = _blockaxes1(A.indices) -_blockaxes1(A::BlockedUnitRange) = blockaxes(A,1) +_blockaxes1(A::AbstractBlockedUnitRange) = blockaxes(A,1) blockbandshift(A, B) = BandedMatrices.bandshift(Int.(_blockaxes1(A)), Int.(_blockaxes1(B))) blockbandshift(S) = blockbandshift(parentindices(S)...) @@ -427,13 +426,11 @@ sublayout(::AbstractBandedBlockBandedLayout, ::Type{<:Tuple{BlockRangeInd,Single sub_materialize(::AbstractBandedBlockBandedLayout, V, _) = BandedBlockBandedMatrix(V) -sub_materialize(::AbstractBandedBlockBandedLayout, V, ::Tuple{<:BlockedUnitRange,<:BlockedUnitRange}) = BandedBlockBandedMatrix(V) -sub_materialize(::AbstractBandedBlockBandedLayout, V, ::Tuple{<:AbstractUnitRange,<:BlockedUnitRange}) = PseudoBlockArray(V) -sub_materialize(::AbstractBandedBlockBandedLayout, V, ::Tuple{<:BlockedUnitRange,<:AbstractUnitRange}) = PseudoBlockArray(V) +sub_materialize(::AbstractBandedBlockBandedLayout, V, ::Tuple{AbstractBlockedUnitRange,AbstractBlockedUnitRange}) = BandedBlockBandedMatrix(V) +sub_materialize(::AbstractBandedBlockBandedLayout, V, ::Tuple{AbstractUnitRange,AbstractBlockedUnitRange}) = BlockedArray(V) +sub_materialize(::AbstractBandedBlockBandedLayout, V, ::Tuple{AbstractBlockedUnitRange,AbstractUnitRange}) = BlockedArray(V) -sub_materialize(::AbstractBandedLayout, V, ::Tuple{<:BlockedUnitRange,<:BlockedUnitRange}) = BandedMatrix(V) - isbanded(A::SubArray{<:Any,2,<:BandedBlockBandedMatrix}) = MemoryLayout(A) isa AbstractBandedLayout isbandedblockbanded(A::SubArray{<:Any,2,<:BandedBlockBandedMatrix}) = MemoryLayout(A) isa AbstractBandedBlockBandedLayout @@ -442,7 +439,7 @@ isbandedblockbanded(A::SubArray{<:Any,2,<:BandedBlockBandedMatrix}) = MemoryLayo subblockbandwidths(V::SubArray) = subblockbandwidths(parent(V)) -_firstblock(B::BlockedUnitRange) = Int(first(blockaxes(B,1))) +_firstblock(B::AbstractBlockedUnitRange) = Int(first(blockaxes(B,1))) _firstblock(B::Block{1}) = Int(B) _firstblock(B::BlockIndexRange) = _firstblock(B.block) _firstblock(B::BlockRange) = first(B.indices[1]) diff --git a/src/BlockBandedMatrices.jl b/src/BlockBandedMatrices.jl index d25a4a1..4dbb275 100644 --- a/src/BlockBandedMatrices.jl +++ b/src/BlockBandedMatrices.jl @@ -19,11 +19,12 @@ import Base: *, +, -, /, \, ==, @propagate_inbounds, OneTo, Slice, axes, checkbo import Base.Broadcast: AbstractArrayStyle, BroadcastStyle, Broadcasted, DefaultArrayStyle, broadcasted -import BlockArrays: AbstractBlockLayout, Block, BlockIndexRange, BlockLayout, BlockSlice, BlockSlice1, BlockSlices, - BlockStyle, BlockedUnitRange, DefaultBlockAxis, _blockkron, _blocklengths2blocklasts, block, +import BlockArrays: AbstractBlockLayout, AbstractBlockedUnitRange, Block, BlockIndexRange, BlockLayout, BlockBidiagonal, BlockDiagonal, + BlockSlice, BlockSlice1, BlockSlices, BlockStyle, BlockTridiagonal, BlockedUnitRange, DefaultBlockAxis, + _blockkron, _blocklengths2blocklasts, block, blockcheckbounds, blockcolstart, blockcolstop, blockcolsupport, blockindex, blockisequal, - blockrowstart, blockrowstop, blockrowsupport, blocks, blocksize, hasmatchingblocks, - sizes_from_blocks + blockrowstart, blockrowstop, blockrowsupport, blocks, blocksize, checksquareblocks, + hasmatchingblocks, sizes_from_blocks import FillArrays: Fill, Ones, Zeros @@ -34,7 +35,6 @@ import LinearAlgebra.BLAS: BlasComplex, BlasFloat, BlasReal import MatrixFactorizations: AdjQLPackedQLayout, QR, QRPackedQ, _ql, ql, ql! - export BandedBlockBandedMatrix, BlockBandedMatrix, BlockSkylineMatrix, blockbandwidth, blockbandwidths, subblockbandwidth, subblockbandwidths, Ones, Zeros, Fill, Block, BlockTridiagonal, BlockBidiagonal, isblockbanded diff --git a/src/BlockSkylineMatrix.jl b/src/BlockSkylineMatrix.jl index 53145c1..633ffa6 100644 --- a/src/BlockSkylineMatrix.jl +++ b/src/BlockSkylineMatrix.jl @@ -52,7 +52,7 @@ struct BlockSkylineSizes{BS<:NTuple{2,AbstractUnitRange{Int}}, LL<:AbstractVecto u::UU end -const BlockBandedSizes = BlockSkylineSizes{NTuple{2,BlockedUnitRange{Vector{Int}}}, Fill{Int,1,Tuple{OneTo{Int}}}, Fill{Int,1,Tuple{OneTo{Int}}}, +const BlockBandedSizes = BlockSkylineSizes{NTuple{2,BlockedOneTo{Int,Vector{Int}}}, Fill{Int,1,Tuple{OneTo{Int}}}, Fill{Int,1,Tuple{OneTo{Int}}}, BandedMatrix{Int,Matrix{Int},OneTo{Int}}, Vector{Int}} @@ -121,7 +121,7 @@ number of sub and super-block-bands in each column. julia> using LinearAlgebra, FillArrays julia> BlockSkylineMatrix(I, [2,2,2,4], [1,2,3], ([2,0,1],[0,1,1])) -4×3-blocked 10×6 BlockSkylineMatrix{Bool, Vector{Bool}, BlockBandedMatrices.BlockSkylineSizes{Tuple{BlockArrays.BlockedUnitRange{Vector{Int64}}, BlockArrays.BlockedUnitRange{Vector{Int64}}}, Vector{Int64}, Vector{Int64}, BandedMatrices.BandedMatrix{Int64, Matrix{Int64}, Base.OneTo{Int64}}, Vector{Int64}}}: +4×3-blocked 10×6 BlockSkylineMatrix{Bool, Vector{Bool}, BlockBandedMatrices.BlockSkylineSizes{Tuple{BlockArrays.BlockedOneTo{Int64, Vector{Int64}}, BlockArrays.BlockedOneTo{Int64, Vector{Int64}}}, Vector{Int64}, Vector{Int64}, BandedMatrices.BandedMatrix{Int64, Matrix{Int64}, Base.OneTo{Int64}}, Vector{Int64}}}: 1 │ 0 0 │ ⋅ ⋅ ⋅ 0 │ 1 0 │ ⋅ ⋅ ⋅ ───┼────────┼───────── @@ -137,7 +137,7 @@ julia> BlockSkylineMatrix(I, [2,2,2,4], [1,2,3], ([2,0,1],[0,1,1])) ⋅ │ ⋅ ⋅ │ 0 0 0 julia> BlockSkylineMatrix(Ones(9,6), [2,3,4], [1,2,3], ([2,0,0],[0,1,1])) -3×3-blocked 9×6 BlockSkylineMatrix{Float64, Vector{Float64}, BlockBandedMatrices.BlockSkylineSizes{Tuple{BlockArrays.BlockedUnitRange{Vector{Int64}}, BlockArrays.BlockedUnitRange{Vector{Int64}}}, Vector{Int64}, Vector{Int64}, BandedMatrices.BandedMatrix{Int64, Matrix{Int64}, Base.OneTo{Int64}}, Vector{Int64}}}: +3×3-blocked 9×6 BlockSkylineMatrix{Float64, Vector{Float64}, BlockBandedMatrices.BlockSkylineSizes{Tuple{BlockArrays.BlockedOneTo{Int64, Vector{Int64}}, BlockArrays.BlockedOneTo{Int64, Vector{Int64}}}, Vector{Int64}, Vector{Int64}, BandedMatrices.BandedMatrix{Int64, Matrix{Int64}, Base.OneTo{Int64}}, Vector{Int64}}}: 1.0 │ 1.0 1.0 │ ⋅ ⋅ ⋅ 1.0 │ 1.0 1.0 │ ⋅ ⋅ ⋅ ─────┼────────────┼─────────────── diff --git a/src/blockskylineqr.jl b/src/blockskylineqr.jl index b0a74bf..2435c1e 100644 --- a/src/blockskylineqr.jl +++ b/src/blockskylineqr.jl @@ -39,7 +39,7 @@ end function qr!(A::BlockBandedMatrix{T}) where T M,N = blocksize(A) ax1 = M < N ? axes(A,1) : axes(A,2) - _blockbanded_qr!(A, PseudoBlockVector(zeros(T,length(ax1)), (ax1,))) + _blockbanded_qr!(A, BlockedVector(zeros(T,length(ax1)), (ax1,))) end function ql!(A::BlockBandedMatrix{T}) where T @@ -51,7 +51,7 @@ function ql!(A::BlockBandedMatrix{T}) where T else axes(A,2) end - τ = PseudoBlockVector{T}(undef, (ax2,)) + τ = BlockedVector{T}(undef, (ax2,)) for K = N:-1:max(N - M + 1,1) μ = M+K-N @@ -79,8 +79,8 @@ function materialize!(Mul::MatLmulVec{<:AdjQRPackedQLayout{<:AbstractBlockBanded N,M = blocksize(A) # impose block structure ax1,ax2 = axes(A) - τ = PseudoBlockArray(Q.τ, (length(ax1) ≤ length(ax2) ? ax1 : ax2,)) - B = PseudoBlockArray(Bin, (ax1,)) + τ = BlockedArray(Q.τ, (length(ax1) ≤ length(ax2) ? ax1 : ax2,)) + B = BlockedArray(Bin, (ax1,)) for K = 1:min(N,M) KR = Block.(K:min(K+l,N)) V = view(A,KR,Block(K)) @@ -96,8 +96,8 @@ function materialize!(Mul::MatLmulVec{<:AdjQLPackedQLayout{<:AbstractBlockBanded N,M = blocksize(A) # impose block structure ax1,ax2 = axes(A) - τ = PseudoBlockArray(Q.τ, (length(ax1) ≤ length(ax2) ? ax1 : ax2,)) - B = PseudoBlockArray(Mul.B, (ax1,)) + τ = BlockedArray(Q.τ, (length(ax1) ≤ length(ax2) ? ax1 : ax2,)) + B = BlockedArray(Mul.B, (ax1,)) for K = N:-1:1 KR = Block.(max(1,K-u):K) V = view(A,KR,Block(K)) @@ -115,8 +115,8 @@ function materialize!(Mul::MatLmulMat{<:AdjQRPackedQLayout{<:AbstractBlockBanded N,M = blocksize(A) # impose block structure ax1,ax2 = axes(A) - τ = PseudoBlockArray(Q.τ, (length(ax1) ≤ length(ax2) ? ax1 : ax2,)) - B = PseudoBlockArray(Bin, (ax1,axes(Bin,2))) + τ = BlockedArray(Q.τ, (length(ax1) ≤ length(ax2) ? ax1 : ax2,)) + B = BlockedArray(Bin, (ax1,axes(Bin,2))) for K = 1:min(N,M), J = 1:blocksize(Bin,2) KR = Block.(K:min(K+l,N)) V = view(A,KR,Block(K)) diff --git a/src/broadcast.jl b/src/broadcast.jl index 4d8cd21..ec722b3 100644 --- a/src/broadcast.jl +++ b/src/broadcast.jl @@ -150,69 +150,14 @@ function blockbanded_copyto!(dest::AbstractMatrix, src::AbstractMatrix) if isblockbanded(dest) _blockbanded_copyto!(dest, src) else - _blockbanded_copyto!(PseudoBlockArray(dest, axes(src)), src) + _blockbanded_copyto!(BlockedArray(dest, axes(src)), src) end dest end _copyto!(_, ::AbstractBlockBandedLayout, dest::AbstractMatrix, src::AbstractMatrix) = blockbanded_copyto!(dest, src) -function _copyto!(_, ::BlockLayout{<:BandedColumns}, dest::AbstractMatrix, src::AbstractMatrix) - if !blockisequal(axes(dest), axes(src)) - copyto!(PseudoBlockArray(dest, axes(src)), src) - return dest - end - - srcB = blocks(src) - srcD = bandeddata(srcB) - - dl, du = colblockbandwidths(dest) - sl, su = bandwidths(srcB) - M,N = size(srcB) - # Source matrix must fit within bands of destination matrix - all(dl .≥ min(sl,M-1)) && all(du .≥ min(su,N-1)) || throw(BandError(dest)) - - for J = 1:N - for K = max(1,J-du[J]):min(J-su-1,M) - zero!(view(dest,Block(K),Block(J))) - end - for K = max(1,J-su):min(J+sl,M) - copyto!(view(dest,Block(K),Block(J)), srcD[K-J+su+1,J]) - end - for K = max(1,J+sl+1):min(J+dl[J],M) - zero!(view(dest,Block(K),Block(J))) - end - end - dest -end - -function _copyto!(_, ::BlockLayout{<:AbstractBandedLayout}, dest::AbstractMatrix, src::AbstractMatrix) - if !blockisequal(axes(dest), axes(src)) - copyto!(PseudoBlockArray(dest, axes(src)), src) - return dest - end - srcB = blocks(src) - - dl, du = colblockbandwidths(dest) - sl, su = bandwidths(srcB) - M,N = size(srcB) - # Source matrix must fit within bands of destination matrix - all(dl .≥ min(sl,M-1)) && all(du .≥ min(su,N-1)) || throw(BandError(dest)) - - for J = 1:N - for K = max(1,J-du[J]):min(J-su-1,M) - zero!(view(dest,Block(K),Block(J))) - end - for K = max(1,J-su):min(J+sl,M) - copyto!(view(dest,Block(K),Block(J)), inbands_getindex(srcB, K, J)) - end - for K = max(1,J+sl+1):min(J+dl[J],M) - zero!(view(dest,Block(K),Block(J))) - end - end - dest -end function _copyto!(::BandedBlockBandedColumns, ::BandedBlockBandedColumns, dest::AbstractMatrix, src::AbstractMatrix) if blockbandwidths(dest) == blockbandwidths(src) && subblockbandwidths(dest) == subblockbandwidths(src) @@ -352,7 +297,7 @@ for op in (:+, :-) <:Tuple{<:AbstractMatrix,<:AbstractMatrix}}) where T bc_axes = Base.Broadcast.combine_axes(bc.args...)# Use combine_axes as `bc` might get axes from `C` if !blockisequal(axes(C), bc_axes) - copyto!(PseudoBlockArray(C, bc_axes), bc) + copyto!(BlockedArray(C, bc_axes), bc) return C end @@ -443,8 +388,3 @@ function similar(bc::Broadcasted{BandedBlockBandedStyle, <:Any, typeof(+), BandedBlockBandedMatrix{T}(undef, axes(bc), (max(Al,Bl), max(Au,Bu)), (max(Aλ,Bλ), max(Aμ,Bμ))) end - -#### -# Special case for Diagonal multiplicartion -#### - diff --git a/src/interfaceimpl.jl b/src/interfaceimpl.jl index fd3d109..d0ce0b9 100644 --- a/src/interfaceimpl.jl +++ b/src/interfaceimpl.jl @@ -7,116 +7,22 @@ BroadcastStyle(::BandedBlockBandedStyle, ::StructuredMatrixStyle{<:Diagonal}) = BandedBlockBandedStyle() -function blockbandwidths(P::PseudoBlockMatrix{<:Any,<:Diagonal}) +function blockbandwidths(P::BlockedMatrix{<:Any,<:Diagonal}) blockisequal(axes(P,1),axes(P,2)) || throw(DimensionMismatch()) (0,0) end blockbandwidths(::Diagonal) = (0,0) -bandeddata(P::PseudoBlockMatrix) = bandeddata(P.blocks) -bandwidths(P::PseudoBlockMatrix) = bandwidths(P.blocks) -BroadcastStyle(::Type{<:SubArray{<:Any,2,<:PseudoBlockMatrix{<:Any,<:Diagonal}, - <:Tuple{<:BlockSlice1,<:BlockSlice1}}}) = BandedStyle() -const BlockDiagonal{T,VT<:Matrix{T}} = BlockMatrix{T,<:Diagonal{VT}} - -BlockDiagonal(A) = mortar(Diagonal(A)) - -function sizes_from_blocks(A::Diagonal, _) - # for k = 1:length(A.du) - # size(A.du[k],1) == sz[1][k] || throw(ArgumentError("block sizes of upper diagonal inconsisent with diagonal")) - # size(A.du[k],2) == sz[2][k+1] || throw(ArgumentError("block sizes of upper diagonal inconsisent with diagonal")) - # size(A.dl[k],1) == sz[1][k+1] || throw(ArgumentError("block sizes of lower diagonal inconsisent with diagonal")) - # size(A.dl[k],2) == sz[2][k] || throw(ArgumentError("block sizes of lower diagonal inconsisent with diagonal")) - # end - (size.(A.diag, 1), size.(A.diag,2)) -end - - -# Block Bi/Tridiagonal -const BlockTridiagonal{T,VT<:Matrix{T}} = BlockMatrix{T,<:Tridiagonal{VT}} -const BlockBidiagonal{T,VT<:Matrix{T}} = BlockMatrix{T,<:Bidiagonal{VT}} - -BlockTridiagonal(A,B,C) = mortar(Tridiagonal(A,B,C)) -BlockBidiagonal(A, B, uplo) = mortar(Bidiagonal(A,B,uplo)) - -function sizes_from_blocks(A::Tridiagonal, _) - # for k = 1:length(A.du) - # size(A.du[k],1) == sz[1][k] || throw(ArgumentError("block sizes of upper diagonal inconsisent with diagonal")) - # size(A.du[k],2) == sz[2][k+1] || throw(ArgumentError("block sizes of upper diagonal inconsisent with diagonal")) - # size(A.dl[k],1) == sz[1][k+1] || throw(ArgumentError("block sizes of lower diagonal inconsisent with diagonal")) - # size(A.dl[k],2) == sz[2][k] || throw(ArgumentError("block sizes of lower diagonal inconsisent with diagonal")) - # end - (size.(A.d, 1), size.(A.d,2)) -end - -function sizes_from_blocks(A::Bidiagonal, _) - # for k = 1:length(A.du) - # size(A.du[k],1) == sz[1][k] || throw(ArgumentError("block sizes of upper diagonal inconsisent with diagonal")) - # size(A.du[k],2) == sz[2][k+1] || throw(ArgumentError("block sizes of upper diagonal inconsisent with diagonal")) - # size(A.dl[k],1) == sz[1][k+1] || throw(ArgumentError("block sizes of lower diagonal inconsisent with diagonal")) - # size(A.dl[k],2) == sz[2][k] || throw(ArgumentError("block sizes of lower diagonal inconsisent with diagonal")) - # end - (size.(A.dv, 1), size.(A.dv,2)) -end - blockbandwidths(A::BlockArray) = bandwidths(A.blocks) isblockbanded(A::BlockArray) = isbanded(A.blocks) -@inline function BlockArrays.viewblock(block_arr::BlockBidiagonal{T,VT}, KJ::Block{2}) where {T,VT<:AbstractMatrix} - K,J = KJ.n - @boundscheck blockcheckbounds(block_arr, K, J) - l,u = blockbandwidths(block_arr) - -l ≤ (J-K) ≤ u || return convert(VT, Zeros{T}(length.(getindex.(axes(block_arr),(Block(K),Block(J))))...)) - block_arr.blocks[K,J] -end -@inline function BlockArrays.viewblock(block_arr::BlockTridiagonal{T,VT}, KJ::Block{2}) where {T,VT<:AbstractMatrix} - K,J = KJ.n - @boundscheck blockcheckbounds(block_arr, K, J) - abs(J-K) ≥ 2 && return convert(VT, Zeros{T}(length.(getindex.(axes(block_arr),(Block(K),Block(J))))...)) - block_arr.blocks[K,J] -end -checksquareblocks(A) = blockisequal(axes(A)...) || throw(DimensionMismatch("blocks are not square: block dimensions are $(axes(A))")) - -for op in (:-, :+) - @eval begin - function $op(A::BlockDiagonal, λ::UniformScaling) - checksquareblocks(A) - mortar(Diagonal(broadcast($op, A.blocks.diag, Ref(λ)))) - end - function $op(λ::UniformScaling, A::BlockDiagonal) - checksquareblocks(A) - mortar(Diagonal(broadcast($op, Ref(λ), A.blocks.diag))) - end - - function $op(A::BlockTridiagonal, λ::UniformScaling) - checksquareblocks(A) - mortar(Tridiagonal(broadcast($op, A.blocks.dl, Ref(0λ)), - broadcast($op, A.blocks.d, Ref(λ)), - broadcast($op, A.blocks.du, Ref(0λ)))) - end - function $op(λ::UniformScaling, A::BlockTridiagonal) - checksquareblocks(A) - mortar(Tridiagonal(broadcast($op, Ref(0λ), A.blocks.dl), - broadcast($op, Ref(λ), A.blocks.d), - broadcast($op, Ref(0λ), A.blocks.du))) - end - function $op(A::BlockBidiagonal, λ::UniformScaling) - checksquareblocks(A) - mortar(Bidiagonal(broadcast($op, A.blocks.dv, Ref(λ)), A.blocks.ev, A.blocks.uplo)) - end - function $op(λ::UniformScaling, A::BlockBidiagonal) - checksquareblocks(A) - mortar(Bidiagonal(broadcast($op, Ref(λ), A.blocks.dv), broadcast($op,A.blocks.ev), A.blocks.uplo)) - end - end -end ### @@ -131,7 +37,6 @@ subblockbandwidths(::Zeros) = (-1,-1) # DiagonalBlockMatrix ### -sublayout(::DiagonalLayout{L}, inds::Type{<:NTuple{2,BS}}) where {L,BS<:BlockSlice{<:BlockRange1}} = bandedblockbandedcolumns(sublayout(L(),Tuple{BS})) subblockbandwidths(::Diagonal) = (0,0) bandedblockbandeddata(D::Diagonal) = permutedims(D.diag) @@ -139,20 +44,10 @@ bandedblockbandeddata(D::Diagonal) = permutedims(D.diag) # Block-BandedMatrix ### -function blockcolsupport(::AbstractBandedLayout, B, j) - m,n = axes(B) - cs = colsupport(B,n[j]) - findblock(m,first(cs)):findblock(m,last(cs)) -end -function blockrowsupport(::AbstractBandedLayout, B, k) - m,n = axes(B) - rs = rowsupport(B,m[k]) - findblock(n,first(rs)):findblock(n,last(rs)) -end # fixed block sizes, we can figure out how far we encroach other blocks by looking at last column -function blockbandwidths(::AbstractBandedLayout, (a,b)::Tuple{BlockedUnitRange{<:AbstractRange}, OneTo{Int}}, A) +function blockbandwidths(::AbstractBandedLayout, (a,b)::Tuple{AbstractBlockedUnitRange{<:Any,<:AbstractRange}, OneTo{Int}}, A) l,u = bandwidths(A) m = min(length(a), l + length(b)) if u ≥ 0 @@ -162,9 +57,7 @@ function blockbandwidths(::AbstractBandedLayout, (a,b)::Tuple{BlockedUnitRange{< end end -# ambiguity -sub_materialize(::AbstractBandedLayout, V, ::Tuple{BlockedUnitRange,Base.OneTo{Int}}) = BandedMatrix(V) -sub_materialize(::AbstractBandedLayout, V, ::Tuple{Base.OneTo{Int},BlockedUnitRange}) = BandedMatrix(V) + ##### @@ -177,3 +70,6 @@ blockbandwidths(K::BlockKron) = bandwidths(first(K.args)) subblockbandwidths(K::BlockKron) = bandwidths(last(K.args)) _blockkron(::Tuple{Vararg{AbstractBandedLayout}}, A) = BandedBlockBandedMatrix(BlockKron(A...)) + + +sublayout(::DiagonalLayout{L}, inds::Type{<:NTuple{2,BS}}) where {L,BS<:BlockSlice{<:BlockRange1}} = bandedblockbandedcolumns(sublayout(L(),Tuple{BS})) diff --git a/test/test_bandedblockbanded.jl b/test/test_bandedblockbanded.jl index 2d661de..8eb8e38 100644 --- a/test/test_bandedblockbanded.jl +++ b/test/test_bandedblockbanded.jl @@ -441,7 +441,7 @@ import ArrayLayouts: RangeCumsum @test eltype(A) === eltype(B) === Int64 @test typeof(A.data) <: BlockArray - @test typeof(B.data) <: PseudoBlockArray + @test typeof(B.data) <: BlockedArray @test size(A) == size(B) @test bandrange(A) == bandrange(B) @test blockbandwidths(A) == blockbandwidths(B) @@ -450,13 +450,13 @@ import ArrayLayouts: RangeCumsum A = WithBlockMatrix{Int64}(Zeros{Int64}(sum(args[1]),sum(args[2])), args...) B = BandedBlockBandedMatrix{Int64}(Zeros{Int64}(sum(args[1]),sum(args[2])), args...) @test typeof(A.data) <: BlockArray - @test typeof(B.data) <: PseudoBlockArray + @test typeof(B.data) <: BlockedArray @test A == B A = WithBlockMatrix{Int64}(Ones{Int64}(sum(args[1]),sum(args[2])), args...) B = BandedBlockBandedMatrix{Int64}(Ones{Int64}(sum(args[1]),sum(args[2])), args...) @test typeof(A.data) <: BlockArray - @test typeof(B.data) <: PseudoBlockArray + @test typeof(B.data) <: BlockedArray @test A == B @test (A .+ 1) .* 2 == B .* 2 .+ 2 end @@ -502,14 +502,14 @@ import ArrayLayouts: RangeCumsum end @testset "DualLayout blocks" begin - A = _BandedBlockBandedMatrix(PseudoBlockVector([1,2,3],[1,2])', blockedrange([1,2]), (-1,1), (-1,1)) + A = _BandedBlockBandedMatrix(BlockedVector([1,2,3],[1,2])', blockedrange([1,2]), (-1,1), (-1,1)) @test MemoryLayout(A) isa BandedBlockBandedColumns{RowMajor} end @testset "1:N blocks" begin N = 10 A = BandedBlockBandedMatrix{Float64}(undef, 1:N,1:N, (1,1), (1,1)) - @test axes(A) isa NTuple{2,BlockedUnitRange{<:RangeCumsum}} + @test axes(A) isa NTuple{2,BlockedOneTo{Int,<:RangeCumsum}} end @testset "change bandwidths" begin @@ -555,6 +555,16 @@ import ArrayLayouts: RangeCumsum @test Symmetric(A)[Block.(1:3),Block.(1:3)] isa BandedBlockBandedMatrix @test Hermitian(A)[Block.(1:3),Block.(1:3)] isa BandedBlockBandedMatrix end + + @testset "similar" begin + l, u = 2, 1 + λ, μ = 2, 1 + N = M = 4 + cols = rows = 1:N + data = reshape(collect(1:(λ+μ+1)*(l+u+1)*sum(cols)), ((λ + μ + 1) * (l + u + 1), sum(cols))) + A = _BandedBlockBandedMatrix(data, rows, cols, (l, u), (λ, μ)) + @test similar(A, Float64, (Base.OneTo(5), axes(A,2))) isa BandedBlockBandedMatrix + end end if false # turned off since tests have check-bounds=yes diff --git a/test/test_misc.jl b/test/test_misc.jl index 524ed32..ac0f3e8 100644 --- a/test/test_misc.jl +++ b/test/test_misc.jl @@ -71,10 +71,10 @@ Base.size(F::FiniteDifference) = (F.n,F.n) @test A[Block(3)[2:3],Block(3)] isa BandedMatrix @test A[Block(3),Block(3)[1:2]] isa BandedMatrix @test A[Block.(1:3),Block.(1:3)] isa BandedBlockBandedMatrix - @test A[Block(1),Block.(2:3)] isa PseudoBlockArray - @test A[Block.(2:3),Block(1)] isa PseudoBlockArray - @test A[Block.(2:3),Block(2)[1:2]] isa PseudoBlockArray - @test A[Block(2)[1:2],Block.(2:3)] isa PseudoBlockArray + @test A[Block(1),Block.(2:3)] isa BlockedArray + @test A[Block.(2:3),Block(1)] isa BlockedArray + @test A[Block.(2:3),Block(2)[1:2]] isa BlockedArray + @test A[Block(2)[1:2],Block.(2:3)] isa BlockedArray end @testset "MyBlockBandedMatrix" begin @@ -90,10 +90,10 @@ Base.size(F::FiniteDifference) = (F.n,F.n) @test A[Block(3)[2:3],Block(3)] isa Matrix @test A[Block(3),Block(3)[1:2]] isa Matrix @test A[Block.(1:3),Block.(1:3)] isa BlockBandedMatrix - @test A[Block(1),Block.(2:3)] isa PseudoBlockArray - @test A[Block.(2:3),Block(1)] isa PseudoBlockArray - @test A[Block.(2:3),Block(2)[1:2]] isa PseudoBlockArray - @test A[Block(2)[1:2],Block.(2:3)] isa PseudoBlockArray + @test A[Block(1),Block.(2:3)] isa BlockedArray + @test A[Block.(2:3),Block(1)] isa BlockedArray + @test A[Block.(2:3),Block(2)[1:2]] isa BlockedArray + @test A[Block(2)[1:2],Block.(2:3)] isa BlockedArray end @testset "Zeros" begin @@ -110,7 +110,7 @@ Base.size(F::FiniteDifference) = (F.n,F.n) D = Diagonal(randn(n^2)) @test blockbandwidths(D) == subblockbandwidths(D) == (0,0) - PD = PseudoBlockArray(D, Fill(n,n), Fill(n,n)) + PD = BlockedArray(D, Fill(n,n), Fill(n,n)) @test blockbandwidths(PD) == bandwidths(PD) == (0,0) @test MemoryLayout(typeof(PD)) isa DiagonalLayout{DenseColumnMajor} @test bandeddata(PD) == bandeddata(D) @@ -168,7 +168,7 @@ Base.size(F::FiniteDifference) = (F.n,F.n) end @testset "DiagonalBlock" begin - D = Diagonal(PseudoBlockVector(randn(6), 1:3)) + D = Diagonal(BlockedVector(randn(6), 1:3)) D̃ = BandedBlockBandedMatrix(D) @test D̃ == D @test blockbandwidths(D) == blockbandwidths(D̃) == subblockbandwidths(D) == subblockbandwidths(D̃) == (0,0) @@ -188,7 +188,7 @@ Base.size(F::FiniteDifference) = (F.n,F.n) @testset "Block-BandedMatrix" begin a = blockedrange(1:5) - B = _BandedMatrix(PseudoBlockArray(randn(5,length(a)),(Base.OneTo(5),a)), a, 3, 1) + B = _BandedMatrix(BlockedArray(randn(5,length(a)),(Base.OneTo(5),a)), a, 3, 1) @test blockcolsupport(B,Block(1)) == Block.(1:3) @test blockcolsupport(B,Block(3)) == Block.(2:4) @test blockrowsupport(B,Block(1)) == Block.(1:2) diff --git a/test/test_triblockbanded.jl b/test/test_triblockbanded.jl index 5c98cce..efda3a7 100644 --- a/test/test_triblockbanded.jl +++ b/test/test_triblockbanded.jl @@ -113,7 +113,7 @@ import BlockArrays: blockisequal @test Matrix(V) == Matrix(A) @test view(V, Block(2)[1:2], Block(3)) ≡ view(A, Block(2)[1:2], Block(3)) - @test similar(Ldiv(UpperTriangular(A), b)) isa PseudoBlockVector + @test similar(Ldiv(UpperTriangular(A), b)) isa BlockedVector @test UpperTriangular(A) \ b ≈ UpperTriangular(V) \ b ≈ UpperTriangular(Matrix(A)) \ b V = view(A, 1:11, 1:11)