Skip to content

Commit 2c34bc4

Browse files
committed
Use broadcasting to set epsilon
1 parent f40c141 commit 2c34bc4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/implementations/svd.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ function svd_trunc!(A, USVᴴϵ::Tuple{TU, TS, TVᴴ, Tϵ}, alg::TruncatedAlgori
212212
U, S, Vᴴ = svd_compact!(A, (U, S, Vᴴ), alg.alg)
213213
USVᴴtrunc, ind = truncate(svd_trunc!, (U, S, Vᴴ), alg.trunc)
214214
if !isempty(ϵ)
215-
ϵ[1] = truncation_error!(diagview(S), ind)
215+
ϵ .= truncation_error!(diagview(S), ind)
216216
end
217217
return USVᴴtrunc..., ϵ
218218
end
@@ -221,7 +221,7 @@ function svd_trunc!(A, USVᴴϵ::Tuple{Nothing, Tϵ}, alg::TruncatedAlgorithm) w
221221
U, S, Vᴴ = svd_compact!(A, USVᴴ, alg.alg)
222222
USVᴴtrunc, ind = truncate(svd_trunc!, (U, S, Vᴴ), alg.trunc)
223223
if !isempty(ϵ)
224-
ϵ[1] = truncation_error!(diagview(S), ind)
224+
ϵ .= truncation_error!(diagview(S), ind)
225225
end
226226
return USVᴴtrunc..., ϵ
227227
end

0 commit comments

Comments
 (0)