Skip to content

Commit a876e28

Browse files
committed
bring eig gaugefix in the same shape
1 parent 9a1ce27 commit a876e28

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/common/gauge.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ This is achieved by ensuring that the entry with the largest magnitude in `V` or
88
is real and positive.
99
""" gaugefix!
1010

11-
function gaugefix!(V::AbstractMatrix)
11+
12+
function gaugefix!(::Union{typeof(eig_full!), typeof(eigh_full!), typeof(gen_eig_full!)}, V::AbstractMatrix)
1213
for j in axes(V, 2)
1314
v = view(V, :, j)
1415
s = conj(sign(_argmaxabs(v)))

src/implementations/eig.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function eig_full!(A::AbstractMatrix, DV, alg::LAPACK_EigAlgorithm)
9393
YALAPACK.geevx!(A, D.diag, V; lapack_kwargs...)
9494
end
9595

96-
dogaugefix && (V = gaugefix!(V))
96+
dogaugefix && (V = gaugefix!(eig_full!, V))
9797

9898
return D, V
9999
end
@@ -153,7 +153,7 @@ function eig_full!(A::AbstractMatrix, DV, alg::GPU_EigAlgorithm)
153153
_gpu_geev!(A, D.diag, V)
154154
end
155155

156-
dogaugefix && (V = gaugefix!(V))
156+
dogaugefix && (V = gaugefix!(eig_full!, V))
157157

158158
return D, V
159159
end

src/implementations/eigh.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function eigh_full!(A::AbstractMatrix, DV, alg::LAPACK_EighAlgorithm)
105105
YALAPACK.heevx!(A, Dd, V; lapack_kwargs...)
106106
end
107107

108-
dogaugefix && (V = gaugefix!(V))
108+
dogaugefix && (V = gaugefix!(eigh_full!, V))
109109

110110
return D, V
111111
end
@@ -183,7 +183,7 @@ function eigh_full!(A::AbstractMatrix, DV, alg::GPU_EighAlgorithm)
183183
throw(ArgumentError("Unsupported eigh algorithm"))
184184
end
185185

186-
dogaugefix && (V = gaugefix!(V))
186+
dogaugefix && (V = gaugefix!(eigh_full!, V))
187187

188188
return D, V
189189
end

src/implementations/gen_eig.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function gen_eig_full!(A::AbstractMatrix, B::AbstractMatrix, WV, alg::LAPACK_Eig
6969
throw(ArgumentError("LAPACK_Expert is not supported for ggev"))
7070
end
7171

72-
dogaugefix && (V = gaugefix!(V))
72+
dogaugefix && (V = gaugefix!(gen_eig_full!, V))
7373

7474
return W, V
7575
end

0 commit comments

Comments
 (0)