Skip to content

Commit

Permalink
Don't create temporaries in real eigfact. Fixes #16751
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasnoack committed Jun 5, 2016
1 parent 967ef80 commit c11854d
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions base/linalg/eigen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ function eigfact!{T<:BlasReal}(A::StridedMatrix{T}; permute::Bool=true, scale::B
evec = zeros(Complex{T}, n, n)
j = 1
while j <= n
if WI[j] == 0.0
evec[:,j] = VR[:,j]
if WI[j] == 0
evec[:,j] = slice(VR, :, j)
else
evec[:,j] = VR[:,j] + im*VR[:,j+1]
evec[:,j+1] = VR[:,j] - im*VR[:,j+1]
for i = 1:n
evec[i,j] = VR[i,j] + im*VR[i,j+1]
evec[i,j+1] = VR[i,j] - im*VR[i,j+1]
end
j += 1
end
j += 1
Expand Down Expand Up @@ -128,11 +130,13 @@ function eigfact!{T<:BlasReal}(A::StridedMatrix{T}, B::StridedMatrix{T})
vecs = zeros(Complex{T}, n, n)
j = 1
while j <= n
if alphai[j] == 0.0
vecs[:,j] = vr[:,j]
if alphai[j] == 0
vecs[:,j] = slice(vr, :, j)
else
vecs[:,j ] = vr[:,j] + im*vr[:,j+1]
vecs[:,j+1] = vr[:,j] - im*vr[:,j+1]
for i = 1:n
vecs[i,j ] = vr[i,j] + im*vr[i,j+1]
vecs[i,j+1] = vr[i,j] - im*vr[i,j+1]
end
j += 1
end
j += 1
Expand Down

0 comments on commit c11854d

Please sign in to comment.