Skip to content

Commit

Permalink
Simplify canonicalize
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Jul 27, 2018
1 parent ffdb8b7 commit 09f8294
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/utils/array_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,12 @@ is a real vector.
"""
function canonicalize(x::AbstractVector{<: Complex};
atol = eps(real(eltype(x))))
x = normalize(x)
num = x conj(x)
if abs(num) < atol
return x
end
r = num / conj(num)
return r^(1/4) .* x
return r^(1/4) .* x ./ norm(x)
end

# TODO: use \ instead of A_ldiv_B!
Expand Down

0 comments on commit 09f8294

Please sign in to comment.