quantum_launcher.hampy.equations

quantum_launcher.hampy.equations#

equations module provides additional binary operations for Hampy objects.

It’s goal is too simplify the creation of more complex problem implementations, by creating them with use of smaller ones.

Summary#

Functions:

one_in_n

Generates Equation for One in N problem.

Reference#

quantum_launcher.hampy.equations.one_in_n(variables: list[int | Variable], size: int | None = None, quadratic: bool = False) Equation[source]#

Generates Equation for One in N problem.

One in N returns True if and only if exactly one of targeted indexes in 1, and all others are 0.

Parameters:
  • variables (list[int | Variable]) – Triggered variables or variable indexes

  • size (Optional[int], optional) – Size of problem, if not given it takes the first found Variable.size value. Defaults to None.

Returns:

Equation returning True if exactly one of passed indexes is 1, False otherwise

Return type:

Equation