equal_to

equal_to(poly: Poly, right: float, label: str = '') Constraint
equal_to(array: PolyArray[_Dim], right: float, label: str = '', *, axis: None = None) Constraint
equal_to(
array: PolyArray[Dim],
right: float,
label: str = '',
*,
axis: int | tuple[int, ...],
) Constraint | ConstraintList

Create an equality constraint.

For a single polynomial poly, constrain poly == right. For an array with axis=None (default), constrain the sum of all elements of array to be equal to right, returning a single Constraint. For an array with axis specified, reduce along the given axis or axes. Return a Constraint if all axes are reduced, or a ConstraintList with one constraint per remaining slice otherwise.

Overload 1.

Args:
  • poly (amplify.Poly): Left-hand side polynomial.

  • right (float): Right-hand side value.

  • label (str): Constraint label. Defaults to ''.

Returns:

amplify.Constraint: Constraint object.

Overload 2.

Args:
  • array (amplify.PolyArray[_Dim]): Array of polynomials to reduce.

  • right (float): Right-hand side value.

  • label (str): Constraint label. Defaults to ''.

  • axis (None): Axis or axes to reduce. Defaults to None.

Returns:

amplify.Constraint: Single constraint when all axes are reduced; otherwise one constraint per remaining slice.

Overload 3.

Args:
  • array (amplify.PolyArray[Dim]): Array of polynomials to reduce.

  • right (float): Right-hand side value.

  • label (str): Constraint label. Defaults to ''.

  • axis (int | tuple[int, ...]): Axis or axes to reduce.

Returns:

amplify.Constraint | amplify.ConstraintList: Single constraint when all axes are reduced; otherwise one constraint per remaining slice.