Skip to content

Commit f40c141

Browse files
committed
Fix undefined err
1 parent 9d2070b commit f40c141

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
@@ -227,15 +227,15 @@ function svd_trunc!(A, USVᴴϵ::Tuple{Nothing, Tϵ}, alg::TruncatedAlgorithm) w
227227
end
228228

229229
function svd_trunc!(A, USVᴴ::Tuple{TU, TS, TVᴴ}, alg::TruncatedAlgorithm; compute_error::Bool = true) where {TU, TS, TVᴴ}
230-
ϵ = similar(S, compute_error)
230+
ϵ = similar(USVᴴ[2], compute_error)
231231
(U, S, Vᴴ, ϵ) = svd_trunc!(A, (USVᴴ..., ϵ), alg)
232232
return compute_error ? (U, S, Vᴴ, ϵ[1]) : (U, S, Vᴴ, -one(eltype(ϵ)))
233233
end
234234
function svd_trunc!(A, USVᴴ::Nothing, alg::TruncatedAlgorithm; compute_error::Bool = true)
235235
Tr = real(eltype(A))
236236
ϵ = compute_error ? zeros(Tr, 1) : zeros(Tr, 0)
237237
U, S, Vᴴ, ϵ = svd_trunc!(A, (USVᴴ, ϵ), alg)
238-
return compute_error ? (U, S, Vᴴ, ϵ[1]::Tr) : (U, S, Vᴴ, -one(Tr))
238+
return compute_error ? (U, S, Vᴴ, ϵ[1]) : (U, S, Vᴴ, -one(Tr))
239239
end
240240

241241
# Diagonal logic

0 commit comments

Comments
 (0)