146
146
147
147
# # Forward algorithms
148
148
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
-
156
149
# Copy code from TensorKit but additionally return full U, S and V to make compatible with :fixed mode
157
150
function _tsvd! (
158
151
t:: TensorMap{<:RealOrComplexFloat} ,
@@ -176,7 +169,7 @@ function _tsvd!(
176
169
end
177
170
178
171
# construct info NamedTuple
179
- condnum = _condition_number (S)
172
+ condnum = cond (S)
180
173
info = (;
181
174
truncation_error= truncerr, condition_number= condnum, U_full= U, S_full= S, V_full= V⁺
182
175
)
217
210
function _tsvd! (_, alg:: FixedSVD , :: TruncationScheme , :: Real )
218
211
info = (;
219
212
truncation_error= 0 ,
220
- condition_number= _condition_number (alg. S),
213
+ condition_number= cond (alg. S),
221
214
U_full= alg. U_full,
222
215
S_full= alg. S_full,
223
216
V_full= alg. V_full,
@@ -272,7 +265,7 @@ function _tsvd!(f, alg::IterSVD, trunc::TruncationScheme, p::Real)
272
265
trunc isa NoTruncation ? abs (zero (scalartype (f))) : norm (U * S * V - f, p)
273
266
274
267
# construct info NamedTuple
275
- condition_number = _condition_number (S)
268
+ condition_number = cond (S)
276
269
info = (;
277
270
truncation_error, condition_number, U_full= nothing , S_full= nothing , V_full= nothing
278
271
)
0 commit comments