Skip to content

Commit

Permalink
Merge pull request #7308 from catawbasam/master
Browse files Browse the repository at this point in the history
Performance: float(AbstractArray) and  complex(AbstractArray)
  • Loading branch information
JeffBezanson committed Jun 18, 2014
2 parents 654e533 + abf522e commit 25eddd3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,15 @@ end
float{T<:FloatingPoint}(x::AbstractArray{T}) = x
complex{T<:Complex}(x::AbstractArray{T}) = x

float(A::AbstractArray) = map_promote(x->convert(FloatingPoint,x), A)
complex(A::AbstractArray) = map_promote(x->convert(Complex,x), A)
function float(A::AbstractArray)
cnv(x) = convert(FloatingPoint,x)
map_promote(cnv, A)
end

function complex(A::AbstractArray)
cnv(x) = convert(Complex,x)
map_promote(cnv, A)
end

full(x::AbstractArray) = x

Expand Down

0 comments on commit 25eddd3

Please sign in to comment.