Skip to content

Commit ea46eb2

Browse files
committed
Fix condition number computation
1 parent 534e6f9 commit ea46eb2

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/algorithms/ctmrg/projectors.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,11 @@ Projector algorithm implementing projectors from SVDing the full 4x4 CTMRG envir
5757
end
5858

5959
# TODO: add `LinearAlgebra.cond` to TensorKit
60-
# Compute condition number σ_max / σ_min for diagonal singular value TensorMap
60+
# Compute condition number smax / smin for diagonal singular value TensorMap
6161
function _condition_number(S::AbstractTensorMap)
62-
# Take maximal condition number over all blocks
63-
return maximum(blocks(S)) do (_, b)
64-
b_diag = diag(b)
65-
return maximum(b_diag) / minimum(b_diag)
66-
end
62+
smax = maximum(first, last.(values(blocks(S))))
63+
smin = minimum(last, last.(values(blocks(S))))
64+
return smax / smin
6765
end
6866
@non_differentiable _condition_number(S::AbstractTensorMap)
6967

0 commit comments

Comments
 (0)