full name: tenpy.linalg.np_conserved.trace
parent module: tenpy.linalg.np_conserved
tenpy.linalg.np_conserved
type: function
tenpy.linalg.np_conserved.
trace
Trace of a, summing over leg1 and leg2.
Requires that the contracted legs are contractible (i.e. have opposite charges). Labels are inherited from a.
The leg label or index for the two legs which should be contracted (i.e. summed over).
Array
a.dtype
A scalar if a.rank == 2, else an Array of rank a.rank - 2. Equivalent to sum([a.take_slice([i, i], [leg1, leg2]) for i in range(a.shape[leg1])]).
a.rank == 2
a.rank - 2
sum([a.take_slice([i, i], [leg1, leg2]) for i in range(a.shape[leg1])])