guppyalgos.primitives.gate_decompositions.cnx.cnx¶
Multicontrolled x gate.
Functions
|
Apply efficient cnx in terms of number of 2q gates. |
|
Cnx requiring only a single ancilla. |
|
Cnx using n_controls - 2 zeroed ancillas. |
- guppyalgos.primitives.gate_decompositions.cnx.cnx.cnx(control, target)¶
Apply efficient cnx in terms of number of 2q gates.
Based on https://arxiv.org/pdf/1508.03273, given \(n - 1\) control qubits and the target, uses \(\lceil{(n-3)/2}\rceil\) ancillary qubits to apply the multicontrolled-x gate on the target using \(6n -12\) CNOT gates.
- Parameters:
control (array[qubit, n_controls]) – register of control qubits.
target (qubit) – target qubit.
- guppyalgos.primitives.gate_decompositions.cnx.cnx.cnx_single_ancilla(control, target)¶
Cnx requiring only a single ancilla.
Works by splitting the cnx into two cnx’s of half size using one ancilla and borrowing qubits from one half in perform the cnx for the other half. Uses ~12*n_control toffoli gates.
- Parameters:
control (array[qubit, n_controls]) – register of control qubits.
target (qubit) – target qubit.
- guppyalgos.primitives.gate_decompositions.cnx.cnx.cnx_toffoli_ladder(control, target)¶
Cnx using n_controls - 2 zeroed ancillas.
Applies the standard temporary-AND ladder construction with measurement-based uncompute for the temporary-ANDs (relative toffolis).
- Parameters:
control (array[qubit, n_controls]) – register of control qubits.
target (qubit) – target qubit.