11module MatrixAlgebraKitGenericLinearAlgebraExt
22
33using MatrixAlgebraKit
4- using MatrixAlgebraKit: sign_safe, check_input, diagview
4+ using MatrixAlgebraKit: sign_safe, check_input, diagview, gaugefix!
55using GenericLinearAlgebra: svd!, svdvals!, eigen!, eigvals!, Hermitian, qr!
66using LinearAlgebra: I, Diagonal, lmul!
77
@@ -13,18 +13,26 @@ for f! in (:svd_compact!, :svd_full!, :svd_vals!)
1313 @eval MatrixAlgebraKit. initialize_output (:: typeof ($ f!), A:: AbstractMatrix , :: GLA_QRIteration ) = nothing
1414end
1515
16- function MatrixAlgebraKit. svd_compact! (A:: AbstractMatrix , USVᴴ, :: GLA_QRIteration )
16+ function MatrixAlgebraKit. svd_compact! (A:: AbstractMatrix , USVᴴ, alg :: GLA_QRIteration )
1717 F = svd! (A)
1818 U, S, Vᴴ = F. U, Diagonal (F. S), F. Vt
19- return MatrixAlgebraKit. gaugefix! (svd_compact!, U, S, Vᴴ, size (A)... )
19+
20+ dogaugefix = get (alg. kwargs, :gaugefix , true ):: Bool
21+ dogaugefix && gaugefix! (svd_compact!, U, Vᴴ)
22+
23+ return U, S, Vᴴ
2024end
2125
22- function MatrixAlgebraKit. svd_full! (A:: AbstractMatrix , USVᴴ, :: GLA_QRIteration )
26+ function MatrixAlgebraKit. svd_full! (A:: AbstractMatrix , USVᴴ, alg :: GLA_QRIteration )
2327 F = svd! (A; full = true )
2428 U, Vᴴ = F. U, F. Vt
2529 S = MatrixAlgebraKit. zero! (similar (F. S, (size (U, 2 ), size (Vᴴ, 1 ))))
2630 diagview (S) .= F. S
27- return MatrixAlgebraKit. gaugefix! (svd_full!, U, S, Vᴴ, size (A)... )
31+
32+ dogaugefix = get (alg. kwargs, :gaugefix , true ):: Bool
33+ dogaugefix && gaugefix! (svd_full!, U, Vᴴ)
34+
35+ return U, S, Vᴴ
2836end
2937
3038function MatrixAlgebraKit. svd_vals! (A:: AbstractMatrix , S, :: GLA_QRIteration )
0 commit comments