146146
147147# # Forward algorithms
148148
149- # Compute condition number smax / smin for diagonal singular value TensorMap
150- function _condition_number (S:: AbstractTensorMap )
151- smax = maximum (first ∘ last, blocks (S))
152- smin = maximum (last ∘ last, blocks (S))
153- return smax / smin
154- end
155-
156149# Copy code from TensorKit but additionally return full U, S and V to make compatible with :fixed mode
157150function _tsvd! (
158151 t:: TensorMap{<:RealOrComplexFloat} ,
@@ -176,7 +169,7 @@ function _tsvd!(
176169 end
177170
178171 # construct info NamedTuple
179- condnum = _condition_number (S)
172+ condnum = cond (S)
180173 info = (;
181174 truncation_error= truncerr, condition_number= condnum, U_full= U, S_full= S, V_full= V⁺
182175 )
217210function _tsvd! (_, alg:: FixedSVD , :: TruncationScheme , :: Real )
218211 info = (;
219212 truncation_error= 0 ,
220- condition_number= _condition_number (alg. S),
213+ condition_number= cond (alg. S),
221214 U_full= alg. U_full,
222215 S_full= alg. S_full,
223216 V_full= alg. V_full,
@@ -272,7 +265,7 @@ function _tsvd!(f, alg::IterSVD, trunc::TruncationScheme, p::Real)
272265 trunc isa NoTruncation ? abs (zero (scalartype (f))) : norm (U * S * V - f, p)
273266
274267 # construct info NamedTuple
275- condition_number = _condition_number (S)
268+ condition_number = cond (S)
276269 info = (;
277270 truncation_error, condition_number, U_full= nothing , S_full= nothing , V_full= nothing
278271 )
0 commit comments