@@ -134,7 +134,7 @@ function svd_full!(A::AbstractMatrix, USVᴴ, alg::LAPACK_SVDAlgorithm)
134134 elseif alg isa LAPACK_SafeDivideAndConquer
135135 isempty (alg_kwargs) ||
136136 throw (ArgumentError (" invalid keyword arguments for LAPACK_SafeDivideAndConquer" ))
137- YALAPACK. gesdvd! (A, view (S, 1 : minmn, 1 ), U, Vᴴ)
137+ YALAPACK. gesdvd! (A, copy_input (svd_full, A), view (S, 1 : minmn, 1 ), U, Vᴴ)
138138 elseif alg isa LAPACK_Bisection
139139 throw (ArgumentError (" LAPACK_Bisection is not supported for full SVD" ))
140140 elseif alg isa LAPACK_Jacobi
@@ -179,7 +179,7 @@ function svd_compact!(A::AbstractMatrix, USVᴴ, alg::LAPACK_SVDAlgorithm)
179179 elseif alg isa LAPACK_SafeDivideAndConquer
180180 isempty (alg_kwargs) ||
181181 throw (ArgumentError (" invalid keyword arguments for LAPACK_SafeDivideAndConquer" ))
182- YALAPACK. gesdvd! (A, diagview (S), U, Vᴴ)
182+ YALAPACK. gesdvd! (A, copy_input (svd_compact, A), diagview (S), U, Vᴴ)
183183 elseif alg isa LAPACK_Bisection
184184 YALAPACK. gesvdx! (A, diagview (S), U, Vᴴ; alg_kwargs... )
185185 elseif alg isa LAPACK_Jacobi
@@ -218,7 +218,7 @@ function svd_vals!(A::AbstractMatrix, S, alg::LAPACK_SVDAlgorithm)
218218 elseif alg isa LAPACK_SafeDivideAndConquer
219219 isempty (alg_kwargs) ||
220220 throw (ArgumentError (" invalid keyword arguments for LAPACK_SafeDivideAndConquer" ))
221- YALAPACK. gesdvd! (A, S, U, Vᴴ)
221+ YALAPACK. gesdvd! (A, copy_input (svd_vals, A), S, U, Vᴴ)
222222 elseif alg isa LAPACK_Bisection
223223 YALAPACK. gesvdx! (A, S, U, Vᴴ; alg_kwargs... )
224224 elseif alg isa LAPACK_Jacobi
0 commit comments