You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both eigenvalue and singular value decompositions have residual gauge degrees of freedom even when the eigenvalues or singular values are unique.
393
+
These arise from the fact that even after normalization, the eigenvectors and singular vectors are only determined up to a phase factor.
394
+
395
+
### Phase Ambiguity in Decompositions
396
+
397
+
For the eigenvalue decomposition `A * V = V * D`, if `v` is an eigenvector with eigenvalue `λ` and `|v| = 1`, then so is `e^(iθ) * v` for any real phase `θ`.
398
+
When `λ` is non-degenerate (i.e., has multiplicity 1), the eigenvector is unique up to this phase.
399
+
400
+
Similarly, for the singular value decomposition `A = U * Σ * Vᴴ`, the singular vectors `u` and `v` corresponding to a non-degenerate singular value `σ` are unique only up to a common phase.
401
+
We can replace `u → e^(iθ) * u` and `vᴴ → e^(-iθ) * vᴴ` simultaneously.
402
+
403
+
### Gauge Fixing Convention
404
+
405
+
To remove this phase ambiguity and ensure reproducible results, MatrixAlgebraKit implements a gauge fixing convention by default.
406
+
The convention ensures that **the entry with the largest magnitude in each eigenvector or left singular vector is real and positive**.
407
+
408
+
For eigenvectors, this means that for each column `v` of `V`, we multiply by `conj(sign(v[i]))` where `i` is the index of the entry with largest absolute value.
409
+
410
+
For singular vectors, we apply the phase factor to both `u` and `v` based on the entry with largest magnitude in `u`.
411
+
This preserves the decomposition `A = U * Σ * Vᴴ` while fixing the gauge.
412
+
413
+
### Disabling Gauge Fixing
414
+
415
+
Gauge fixing is enabled by default for all eigenvalue and singular value decompositions.
416
+
If you prefer to obtain the raw results from the underlying computational routines without gauge fixing, you can disable it using the `gaugefix` keyword argument:
417
+
418
+
```julia
419
+
# With gauge fixing (default)
420
+
D, V =eigh_full(A)
421
+
422
+
# Without gauge fixing
423
+
D, V =eigh_full(A; gaugefix =false)
424
+
```
425
+
426
+
The same keyword is available for `eig_full`, `eig_trunc`, `svd_full`, `svd_compact`, and `svd_trunc` functions.
427
+
Additionally, the default value can also be controlled with a global toggle using [`MatrixAlgebraKit.default_gaugefix`](@ref).
0 commit comments