qml.gridsynth¶
- gridsynth(tape, *, epsilon=0.0001, ppr_basis=False)[source]¶
Decomposes RZ and PhaseShift gates into the Clifford+T basis or the PPR basis.
Warning
This transform must be applied within a workflow compiled with
pennylane.qjit(), as it is a frontend for Catalyst’sgridsynthcompilation pass. Consult the Catalyst documentation for more information.- Parameters:
tape (QNode) – A quantum circuit.
epsilon (float) – The maximum permissible operator norm error per rotation gate. Defaults to
1e-4.ppr_basis (bool) – If True, decompose into the PPR basis. If False, decompose into the Clifford+T basis. Defaults to
False.
Example
@qml.qnode(qml.device("lightning.qubit", wires=1)) def circuit(x): qml.Hadamard(0) qml.RZ(x, 0) qml.PhaseShift(x * 0.2, 0) return qml.state() gridsynth_circuit = qml.transforms.gridsynth(circuit, epsilon=1e-4) qjitted_circuit = qml.qjit(gridsynth_circuit)
>>> circuit(1.1) [0.60282587-0.36959568j 0.5076395 +0.49224195j] >>> qjitted_circuit(1.1) [0.6028324 -0.3695921j 0.50763281+0.49224355j]
Warning
Using an
epsilonvalue smaller than1e-7may lead to inaccurate results or errors, due to potential integer overflow in the solver.Warning
Note: Simulating with
ppr_basis=Trueis currently not supported.