domain_wall

domain_wall(array: PolyArray[_Dim], label: str = '', *, ascending: bool = True) ConstraintList

Create domain wall constraints for a variable array.

For 1D arrays, return a single constraint. For higher-dimensional arrays, apply the same construction to each slice of the last axis and return a constraint list.

パラメータ:
  • array (PolyArray[_Dim]) -- Array of binary or Ising variables.

  • label (str) -- Base label for generated constraints. Defaults to ''.

  • ascending (bool) -- If True (default), the wall transitions from 0 to 1; if False, from 1 to 0. Defaults to True.

戻り値:

Single constraint for 1D input; otherwise one constraint per slice on the last axis.

戻り値の型:

ConstraintList

例外:

ValueError -- The last axis of the array is shorter than two elements, or the array holds a variable that is neither binary nor Ising.