guppyalgos.primitives.gate_decompositions.cnx.cnx_approx¶
Approximate multi-controlled X gate using random XOR method.
Functions
|
Generate a Guppy function to apply an approximate multi-controlled X gate. |
- guppyalgos.primitives.gate_decompositions.cnx.cnx_approx.cnx_approx(n_ctrl, epsilon, cnx_method=<function cnx>)¶
Generate a Guppy function to apply an approximate multi-controlled X gate.
Implements Algorithm 1 from arXiv:2510.07223 “Multi-qubit Toffoli with exponentially fewer T gates”. The algorithm uses random XOR sampling to reduce a large \(C^nX\) to a small \(C^kX\) where \(k = O(\log(1/\varepsilon))\), and is independent of \(n\). This achieves a \(C^nX\) implementation within error \(\varepsilon\) in the diamond distance using only \(O(\log(1/\varepsilon))\) T gates instead of \(O(n)\).
- Algorithm:
Choose \(k = \lceil \log_2(1/\varepsilon) \rceil + 2\) random subsets of the control qubits
Compute the XOR parity for each subset (all Clifford operations)
Apply an OR gate to the \(k\) parity results using an exact \(C^kX\) gate
- Parameters:
- Returns:
Function taking an array of control qubits, a target qubit, and a random number generator; applies approximate \(C^nX\) gate.
- Return type:
GuppyFunctionDefinition[[array[qubit, n_ctrl], qubit, RNG], None]