Skip to content

Commit

Permalink
fix #3728
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Aug 10, 2013
1 parent 3f9d88a commit eda127e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 2 additions & 0 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,9 @@ end
conj{T<:Real}(x::AbstractArray{T}) = x
conj!{T<:Real}(x::AbstractArray{T}) = x

real{T<:Real}(x::AbstractVector{T}) = x
real{T<:Real}(x::AbstractArray{T}) = x
imag{T<:Real}(x::AbstractVector{T}) = zero(x)
imag{T<:Real}(x::AbstractArray{T}) = zero(x)

+{T<:Number}(x::AbstractArray{T}) = x
Expand Down
10 changes: 2 additions & 8 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -891,14 +891,8 @@ end

for f in (:real, :imag)
@eval begin
function ($f){T}(A::AbstractArray{T})
S = typeof(($f)(zero(T)))
F = similar(A, S)
for i=1:length(A)
F[i] = ($f)(A[i])
end
return F
end
($f)(A::AbstractVector) = [ ($f)(x) for x in A ]
($f)(A::AbstractArray) = reshape([ ($f)(x) for x in A ], size(A))
end
end

Expand Down

0 comments on commit eda127e

Please sign in to comment.