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 from0to1; ifFalse, from1to0. Defaults toTrue.
- Returns:
Single constraint for 1D input; otherwise one constraint per slice on the last axis.
- Return type:
- 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.