Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/BandedBlockBandedMatrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ convert(::Type{AbstractMatrix{T}}, B::BandedBlockBandedMatrix) where T = _Banded
convert(::Type{AbstractArray{T}}, B::BandedBlockBandedMatrix{T}) where T = B
convert(::Type{AbstractMatrix{T}}, B::BandedBlockBandedMatrix{T}) where T = B

copy(A::Adjoint{T,<:BandedBlockBandedMatrix}) where T = copy(parent(A))'
copy(A::Transpose{T,<:BandedBlockBandedMatrix}) where T = transpose(copy(parent(A)))



similar(A::BandedBlockBandedMatrix, ::Type{T}, axes::NTuple{2,AbstractUnitRange{Int}}) where T =
BandedBlockBandedMatrix{T}(undef, axes, blockbandwidths(A), subblockbandwidths(A))
Expand Down
4 changes: 4 additions & 0 deletions src/BlockSkylineMatrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ BlockSkylineMatrix(A::Union{AbstractMatrix,UniformScaling},
rdims::AbstractVector{Int}, cdims::AbstractVector{Int},
lu::NTuple{2,AbstractVector{Int}}) = BlockSkylineMatrix{eltype(A)}(A, rdims, cdims, lu)

copy(B::BlockSkylineMatrix) = _BlockSkylineMatrix(copy(B.data), B.block_sizes)
copy(A::Adjoint{T,<:BlockSkylineMatrix}) where T = copy(parent(A))'
copy(A::Transpose{T,<:BlockSkylineMatrix}) where T = transpose(copy(parent(A)))


"""
BlockBandedMatrix(A::Union{AbstractMatrix,UniformScaling},
Expand Down
26 changes: 26 additions & 0 deletions test/test_blockskyline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,32 @@ Random.seed!(0)
@test OO == Matrix(O)^2
end

@testset "copy wrappers" begin
rows = [2, 1, 3]
A = BlockSkylineMatrix{Float64}(undef, rows, rows, ([0,0,0],[0,0,0]))
A.data .= reshape(1.0:length(A.data), size(A.data))

AC = copy(A)
@test AC isa BlockSkylineMatrix
@test AC == A
@test AC !== A
@test AC.data !== A.data

BA = copy(adjoint(A))
@test BA isa Adjoint{Float64,<:BlockSkylineMatrix}
@test parent(BA) isa BlockSkylineMatrix
@test BA == adjoint(Matrix(A))
@test parent(BA) == A
@test parent(BA) !== A

TA = copy(transpose(A))
@test TA isa Transpose{Float64,<:BlockSkylineMatrix}
@test parent(TA) isa BlockSkylineMatrix
@test TA == transpose(Matrix(A))
@test parent(TA) == A
@test parent(TA) !== A
end

@testset "Broadcasting" begin
rows = [3, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3]
l,u = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1], [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1]
Expand Down
5 changes: 1 addition & 4 deletions test/test_docstrings.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using Documenter
@testset "docstrings" begin
# don't test docstrings on old versions to avoid failures due to changes in types
if VERSION >= v"1.9"
DocMeta.setdocmeta!(BlockBandedMatrices, :DocTestSetup, :(using BlockBandedMatrices); recursive=true)
DocMeta.setdocmeta!(BlockBandedMatrices, :DocTestSetup, :(using BlockBandedMatrices); recursive=true)
doctest(BlockBandedMatrices)
end
end
Loading