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.

Parameters:
  • 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.

Returns:

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

Return type:

ConstraintList

Raises:

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