Skip to content

Commit

Permalink
copy(Ones(5)') should be non-allocating (#159)
Browse files Browse the repository at this point in the history
* copy(Ones(5)') should be non-allocating

* Update FillArrays.jl
  • Loading branch information
dlfivefifty authored Sep 21, 2021
1 parent 38898d4 commit 1f25ae1
Show file tree
Hide file tree
Showing 3 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,6 +1,6 @@
name = "FillArrays"
uuid = "1a297f60-69ca-5386-bcde-b61e274b549b"
version = "0.12.4"
version = "0.12.5"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
2 changes: 2 additions & 0 deletions src/FillArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,8 @@ getindex_value(a::LinearAlgebra.Adjoint) = adjoint(getindex_value(parent(a)))
getindex_value(a::LinearAlgebra.Transpose) = transpose(getindex_value(parent(a)))
getindex_value(a::SubArray) = getindex_value(parent(a))

copy(a::LinearAlgebra.Adjoint{<:Any,<:AbstractFill}) = copy(parent(a))'
copy(a::LinearAlgebra.Transpose{<:Any,<:AbstractFill}) = transpose(parent(a))

##
# view
Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,8 @@ end
@test Fill(1+im, 5, 6)' Fill(1-im, 6,5)
@test transpose(Fill(1+im, 5, 6)) Fill(1+im, 6,5)
@test Ones(5)' isa Adjoint # Vectors still need special dot product
@test copy(Ones(5)') Ones(5)'
@test copy(transpose(Ones(5))) transpose(Ones(5))
@test Fill([1+im 2; 3 4; 5 6], 2,3)' == Fill([1+im 2; 3 4; 5 6]', 3,2)
@test transpose(Fill([1+im 2; 3 4; 5 6], 2,3)) == Fill(transpose([1+im 2; 3 4; 5 6]), 3,2)

Expand Down

2 comments on commit 1f25ae1

@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/45325

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.12.5 -m "<description of version>" 1f25ae197a57f7c7f5182d7add636fcbf3f2558a
git push origin v0.12.5

Please sign in to comment.