guppyalgos.primitives.gate_decompositions.cnx.cnu

Compose a multi-controlled operation with a selectable CNX kernel.

Classes

MultiCntrlFunction()

Apply a singly controlled operation using an AND of the controls.

class guppyalgos.primitives.gate_decompositions.cnx.cnu.MultiCntrlFunction

Apply a singly controlled operation using an AND of the controls.

operation must preserve its control qubit. cnx_kernel must preserve the controls and be self-inverse on its input registers, leaving its internal ancillas unentangled with them. A randomized approximate kernel must replay the same randomness on both calls to uncompute the work qubit. Use at least one control.

TargetRegs can be a qubit, an array, or a Guppy struct of registers. One control is passed directly to the operation without allocating work. Multiple controls use one clean work qubit in addition to kernel ancillas.

cnx_kernel
compose(controls, targets)

Compute the control predicate, apply the operation, and uncompute.

operation