truncate
full name: tenpy.linalg.truncation.truncate
parent module:
tenpy.linalg.truncation
type: function
- tenpy.linalg.truncation.truncate(S, options)[source]
Given a Schmidt spectrum S, determine which values to keep.
Options
- config truncation
option summary Keep at most `chi_max` Schmidt values.
Keep at least `chi_min` Schmidt values.
Don't cut between neighboring Schmidt values with [...]
Discard all small Schmidt values ``S[i] < svd_min``.
Discard all small Schmidt values as long as [...]
- option chi_max: int
Keep at most chi_max Schmidt values.
- option chi_min: int
Keep at least chi_min Schmidt values.
- option degeneracy_tol: float
Don’t cut between neighboring Schmidt values with
|log(S[i]/S[j])| < degeneracy_tol
, or equivalently|S[i] - S[j]|/S[j] < exp(degeneracy_tol) - 1 ~= degeneracy_tol
for small degeneracy_tol. In other words, keep either both i and j or none, if the Schmidt values are degenerate with a relative error smaller than degeneracy_tol, which we expect to happen in the case of symmetries.
- option svd_min: float
Discard all small Schmidt values
S[i] < svd_min
.
- option trunc_cut: float
Discard all small Schmidt values as long as
sum_{i discarded} S[i]**2 <= trunc_cut**2
.
- Parameters:
S (1D array) – Schmidt values (as returned by an SVD), not necessarily sorted. Should be normalized to
np.sum(S*S) == 1.
.options (dict-like) – Config with constraints for the truncation, see
truncation
. If a constraint can not be fulfilled (without violating a previous one), it is ignored. A valueNone
indicates that the constraint should be ignored.
- Returns:
mask (1D bool array) – Index mask, True for indices which should be kept.
norm_new (float) – The norm of the truncated Schmidt values,
np.linalg.norm(S[mask])
. Useful for re-normalization.err (
TruncationError
) – The error of the represented state which is introduced due to the truncation.