quantax.operator.nflips_up_dn_filter#

quantax.operator.nflips_up_dn_filter(opstr: str, indices: Sequence[int]) → dict[str, int]#

A filter that assigns the numbers of flipped spin-up and spin-down modes (nflips_up and nflips_dn) as the update mode.

nflips_up counts the off-diagonal characters in opstr (everything not in DIAGONAL_OPS) acting on spin-up modes (index below Nsites), and nflips_dn the ones acting on spin-down modes. The two keys are the update modes requested via required_update_modes by models whose low-rank updates treat the two spin sectors separately (e.g. SingletPair). This filter is only meaningful for spinful fermion systems.

Parameters:
  • opstr – The operator string.

  • indices – The site indices the operator acts on.

Returns:

A dictionary {"nflips_up": <flipped spin-up modes>, "nflips_dn": <flipped spin-down modes>}.