ComparatorRzDecomposer¶
- class guppyft.decompose.ComparatorRzDecomposer(*, epsilon, max_attempts)[source]¶
Decomposes Rz gates using \(2\lceil(\log_2(1/\epsilon))\rceil\) ancilla qubits via comparators and repeat-until-success. Introduces Toffoli gates. Can be used to decompose angles at runtime. See https://arxiv.org/pdf/2404.05618.
Warning
Using this decomposition together with encoding can produce runtimes that are too long to run on Helios, leading to timeout errors.
In a noiseless setting, the probability of success per attempt is greater than 0.5. The shot will be discarded if all max_attempts fail. Hence, the probability of a shot with \(g\) Rz gates completing is greater than \((1 - 0.5^L)^g\), where \(L\) is max_attempts.
- epsilon¶
Error tolerance in the approximation of the angle.
- max_attempts¶
Maximum number of attempts for repeat-until-success for each Rz gate that is decomposed.
- __init__(*, epsilon, max_attempts)¶
- n_ancillas()[source]¶
Number of ancilla qubits required for the target precision (\(\epsilon\)).
- Return type:
- run(hugr, *, inplace=True)[source]¶
Run the pass to transform a HUGR, returning a PassResult.
See
implement_pass_run()for a helper function to implement this method.- Return type: