detect_legcharge¶
full name: tenpy.linalg.np_conserved.detect_legcharge
parent module:
tenpy.linalg.np_conservedtype: function
-
tenpy.linalg.np_conserved.detect_legcharge(flat_array, chargeinfo, legcharges, qtotal=None, qconj=1, cutoff=None)[source]¶ Calculate a missing LegCharge by looking for nonzero entries of a flat array.
- Parameters
- flat_arrayndarray
A flat array, in which we look for non-zero entries.
- chargeinfo
ChargeInfo The nature of the charge.
- legchargeslist of
LegCharge One LegCharge for each dimension of flat_array, except for one entry which is
None. This missing entry is to be calculated.- qconj{+1, -1}
qconj for the new calculated LegCharge.
- qtotalcharges
Desired total charge of the array. Defaults to zeros.
- cutofffloat
Blocks with
np.max(np.abs(block)) > cutoffare considered as zero. Defaults toQCUTOFF.
- Returns
- new_legchargeslist of
LegCharge A copy of the given legcharges with the
Nonereplaced by a compatible LegCharge. The new legcharge is ‘bunched’, but not sorted!
- new_legchargeslist of
See also
detect_grid_outer_legchargesimilar functionality if the flat array is given by a ‘grid’.
detect_qtotaldetects the total charge, if all legs are known.