Skip to content

Commit

Permalink
Merge pull request #104 from invenia/mz/copy
Browse files Browse the repository at this point in the history
implement `Base.copy`
  • Loading branch information
mzgubic authored Jun 20, 2022
2 parents b2ee90a + 2723bb0 commit f920f23
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "BlockDiagonals"
uuid = "0a1fb500-61f7-11e9-3c65-f5ef3456f9f0"
authors = ["Invenia Technical Computing Corporation"]
version = "0.1.30"
version = "0.1.31"

[deps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Expand Down
4 changes: 4 additions & 0 deletions src/blockdiagonal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ function _block_indices(B::BlockDiagonal, i::Integer, j::Integer)
return p, i, j
end

function Base.copy(b::BlockDiagonal)
return BlockDiagonal(copy.(blocks(b)))
end

function Base.copy!(dest::BlockDiagonal, src::BlockDiagonal)
isequal_blocksizes(dest, src) || throw(DimensionMismatch("dest and src have different block sizes"))
for i in eachindex(blocks(dest))
Expand Down

2 comments on commit f920f23

@mzgubic
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/62716

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.31 -m "<description of version>" f920f23f74e79438c728c4f7d6f160c4712a68a6
git push origin v0.1.31

Please sign in to comment.