Skip to content

Commit

Permalink
Fix for copy #85 (#86)
Browse files Browse the repository at this point in the history
* Update lazyapplying.jl

* Update applytests.jl

* Update Project.toml
  • Loading branch information
tlienart authored and dlfivefifty committed Nov 29, 2019
1 parent 7948ff1 commit 7336bc5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "LazyArrays"
uuid = "5078a376-72f3-5289-bfd5-ec5146d43c02"
version = "0.14.9"
version = "0.14.10"


[deps]
Expand Down
4 changes: 2 additions & 2 deletions src/lazyapplying.jl
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ AbstractArray{T,N}(A::ApplyArray{<:Any,N}) where {T,N} = ApplyArray{T,N}(A.f, ma

@inline axes(A::ApplyArray) = axes(Applied(A))
@inline size(A::ApplyArray) = map(length, axes(A))
@inline copy(A::ApplyArray) = ApplyArray(A.f, map(copy,A.args)...)
@inline copy(A::ApplyArray{T,N}) where {T,N} = ApplyArray{T,N}(A.f, map(copy,A.args)...)


struct LazyArrayApplyStyle <: AbstractArrayApplyStyle end
Expand Down Expand Up @@ -305,4 +305,4 @@ getindex(A::ApplyMatrix{T,typeof(triu),<:Tuple{<:AbstractMatrix,<:Integer}}, k::
replace_in_print_matrix(A::ApplyMatrix{<:Any,typeof(triu),<:Tuple{<:AbstractMatrix}}, i::Integer, j::Integer, s::AbstractString) =
j  i ? replace_in_print_matrix(A.args[1], i, j, s) : replace_with_centered_mark(s)
replace_in_print_matrix(A::ApplyMatrix{<:Any,typeof(triu),<:Tuple{<:AbstractMatrix,<:Integer}}, i::Integer, j::Integer, s::AbstractString) =
j  i+A.args[2] ? replace_in_print_matrix(A.args[1], i, j, s) : replace_with_centered_mark(s)
j  i+A.args[2] ? replace_in_print_matrix(A.args[1], i, j, s) : replace_with_centered_mark(s)
9 changes: 9 additions & 0 deletions test/applytests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,12 @@ end
@test M isa ApplyArray
@test M == exp(A)
end

@testset "copy (#85)" begin
Base.size(A::Applied) = (length(A.args[1]),)
Base.eltype(A::Applied) = eltype(A.args[1])
v = ApplyVector(vec, ones(Int, 2, 2))
vc = copy(float.(v))
ve = convert(Vector, vc)
@test eltype(ve) == Float64
end

2 comments on commit 7336bc5

@dlfivefifty
Copy link
Member

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/6016

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 Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v0.14.10 -m "<description of version>" 7336bc5a95ce8118300f890479756331588a15ad
git push origin v0.14.10

Please sign in to comment.