Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Printf = "1"
QuadGK = "2.11.1"
Random = "1"
Statistics = "1"
TensorKit = "0.14"
TensorKit = "0.14.6"
TensorOperations = "5"
VectorInterface = "0.4, 0.5"
Zygote = "0.6, 0.7"
Expand Down
13 changes: 3 additions & 10 deletions src/utility/svd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,6 @@

## Forward algorithms

# Compute condition number smax / smin for diagonal singular value TensorMap
function _condition_number(S::AbstractTensorMap)
smax = maximum(first ∘ last, blocks(S))
smin = maximum(last ∘ last, blocks(S))
return smax / smin
end

# Copy code from TensorKit but additionally return full U, S and V to make compatible with :fixed mode
function _tsvd!(
t::TensorMap{<:RealOrComplexFloat},
Expand All @@ -176,7 +169,7 @@
end

# construct info NamedTuple
condnum = _condition_number(S)
condnum = cond(S)
info = (;
truncation_error=truncerr, condition_number=condnum, U_full=U, S_full=S, V_full=V⁺
)
Expand Down Expand Up @@ -217,7 +210,7 @@
function _tsvd!(_, alg::FixedSVD, ::TruncationScheme, ::Real)
info = (;
truncation_error=0,
condition_number=_condition_number(alg.S),
condition_number=cond(alg.S),
U_full=alg.U_full,
S_full=alg.S_full,
V_full=alg.V_full,
Expand Down Expand Up @@ -272,7 +265,7 @@
trunc isa NoTruncation ? abs(zero(scalartype(f))) : norm(U * S * V - f, p)

# construct info NamedTuple
condition_number = _condition_number(S)
condition_number = cond(S)

Check warning on line 268 in src/utility/svd.jl

View check run for this annotation

Codecov / codecov/patch

src/utility/svd.jl#L268

Added line #L268 was not covered by tests
info = (;
truncation_error, condition_number, U_full=nothing, S_full=nothing, V_full=nothing
)
Expand Down
Loading