Skip to content

Commit

Permalink
Add copy for Eye and Diagonal(::AbstractFill) (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlfivefifty authored Mar 18, 2021
1 parent ee9bafd commit a7ce2f8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "FillArrays"
uuid = "1a297f60-69ca-5386-bcde-b61e274b549b"
version = "0.11.6"
version = "0.11.7"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
2 changes: 1 addition & 1 deletion src/FillArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ const Eye{T,Axes} = RectOrDiagonal{T,Ones{T,1,Tuple{Axes}}}
isone(::SquareEye) = true

# These should actually be in StdLib, LinearAlgebra.jl, for all Diagonal
for f in (:permutedims, :triu, :triu!, :tril, :tril!)
for f in (:permutedims, :triu, :triu!, :tril, :tril!, :copy)
@eval ($f)(IM::Diagonal{<:Any,<:AbstractFill}) = IM
end

Expand Down
6 changes: 6 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,7 @@ end
@testset "Eye identity ops" begin
m = Eye(10)
D = Diagonal(Fill(2,10))

for op in (permutedims, inv)
@test op(m) === m
end
Expand All @@ -938,6 +939,11 @@ end
@test op(m) === m
end
end

@test copy(m) m
@test copy(D) D
@test LinearAlgebra.copy_oftype(m, Int) Eye{Int}(10)
@test LinearAlgebra.copy_oftype(D, Float64) Diagonal(Fill(2.0,10))
end

@testset "Issue #31" begin
Expand Down

2 comments on commit a7ce2f8

@dlfivefifty
Copy link
Member 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/32283

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.11.7 -m "<description of version>" a7ce2f8d85bba139b4690baea569bac4a27faae0
git push origin v0.11.7

Please sign in to comment.