truncate

tenpy.algorithms.truncation.truncate(S, trunc_par)[source]

Given a Schmidt spectrum S, determine which values to keep.

Parameters
S1D array

Schmidt values (as returned by an SVD), not necessarily sorted. Should be normalized to np.sum(S*S) == 1..

trunc_par: dict

Parameters giving constraints for the truncation. If a constraint can not be fullfilled (without violating a previous one), it is ignored. A value None indicates that the constraint should be ignored.

key

type

constraint

chi_max

int

Keep at most chi_max Schmidt values.

chi_min

int

Keep at least chi_min Schmidt values.

symmetry_tol

float

Don’t cut between Schmidt values with |log(S[i]/S[j])| < log(symmetry_tol) (i.e. either keep either both i and j or none). This is useful to prevent discarding (nearly) degenerate pairs in case of symmetries.

svd_min

float

Discard all small Schmidt values S[i] < svd_min.

trunc_cut

float

Discard all small Schmidt values as long as sum_{i discarded} S[i]**2 <= trunc_cut**2.

Returns
mask1D bool array

Index mask, True for indices which should be kept.

norm_newfloat

The norm of the truncated Schmidt values, np.linalg.norm(S[mask]). Useful for re-normalization.

errTruncationError

The error of the represented state which is introduced due to the truncation.