unmajority_add_gate

forest.benchmarking.classical_logic.unmajority_add_gate(a: int, b: int, c: int, in_x_basis: bool = False) → pyquil.quil.Program

The UnMajority and Add gate, or UMA for short.

The default option is to compute this in the computational (aka Z) basis. If in_x_basis is true then the computation is instead in the X basis, i.e. CNOT is replaced by CNOT_X_basis and CCNOT is replaced by CCNOT_X_basis

See [CDKM96] reference in ripple_carry_adder.adder() docstring

Parameters:
  • a – qubit label
  • b – qubit label
  • c – qubit label
  • in_x_basis – if true, the returned program performs the equivalent logic in the X basis.
Returns:

program which when run on the output of majority_gate(a,b,c) returns the input to majority_gate on the c and a lines, and outputs the sum of a+b+c (mod 2) on the b line.