quantax.operator.nflips_filter#

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

A filter that assigns the number of flipped sites (nflips) as the update mode.

nflips is the number of off-diagonal characters in opstr (everything not in DIAGONAL_OPS), which equals the number of single-site flips the term applies to a configuration. Operator terms are then grouped by nflips so that a model supporting reference updates can size its low-rank update accordingly. The "nflips" key is the update mode requested by such models via required_update_modes.

Parameters:
  • opstr – The operator string.

  • indices – The site indices the operator acts on.

Returns:

A dictionary {"nflips": <number of flipped sites>}.