@@ -138,14 +138,10 @@ function MatrixAlgebraKit.svd_compact!(
138138)
139139 check_input (svd_compact!, A, USVᴴ, alg)
140140
141- Ad, rowperm, colperm = blockdiagonalize (A)
141+ Ad, transform_rows, transform_cols = blockdiagonalize (A)
142142 Ud, S, Vᴴd = svd_compact! (Ad, BlockDiagonalAlgorithm (alg))
143-
144- inv_rowperm = Block .(invperm (Int .(rowperm)))
145- U = Ud[inv_rowperm, :]
146-
147- inv_colperm = Block .(invperm (Int .(colperm)))
148- Vᴴ = Vᴴd[:, inv_colperm]
143+ U = transform_rows (Ud)
144+ Vᴴ = transform_cols (Vᴴd)
149145
150146 return U, S, Vᴴ
151147end
@@ -177,14 +173,10 @@ function MatrixAlgebraKit.svd_full!(
177173)
178174 check_input (svd_full!, A, USVᴴ, alg)
179175
180- Ad, rowperm, colperm = blockdiagonalize (A)
176+ Ad, transform_rows, transform_cols = blockdiagonalize (A)
181177 Ud, S, Vᴴd = svd_full! (Ad, BlockDiagonalAlgorithm (alg))
182-
183- inv_rowperm = Block .(invperm (Int .(rowperm)))
184- U = Ud[inv_rowperm, :]
185-
186- inv_colperm = Block .(invperm (Int .(colperm)))
187- Vᴴ = Vᴴd[:, inv_colperm]
178+ U = transform_rows (Ud)
179+ Vᴴ = transform_cols (Vᴴd)
188180
189181 return U, S, Vᴴ
190182end
0 commit comments