mimiqcircuits.operations.gates.generalized.rpauli¶
Pauli rotation gate (RPauli).
Classes
|
Rotation generated by a Pauli string. |
- class RPauli(pauli, theta)[source]¶
Bases:
GateRotation generated by a Pauli string.
Implements
\[e^{-i \frac{\theta}{2} (P_1 \otimes P_2 \otimes \dots \otimes P_N)}\]where each \(P_i\) is
"I","X","Y"or"Z"and acts on the \(i\)-th target qubit. The gate acts on all \(N\) qubits of the string, including those with"I". It is used for time evolution under a Pauli term, such as Trotter steps and variational ansätze.The decomposition changes the basis of each
"X"qubit withGateHand of each"Y"qubit withGateHYZ, then applies oneGateRNZon the non-identity qubits. A string of only"I"decomposes into the global phase \(e^{-i\theta/2}\).- Parameters:
pauli (PauliString) – The Pauli string. A plain
stris not accepted.theta – Rotation angle in radians, numeric or symbolic.
Examples
>>> from mimiqcircuits import * >>> from symengine import pi >>> RPauli(PauliString("X"), pi/2) R("X", (1/2)*pi) >>> RPauli(PauliString("ZIZ"), 2.0) R("ZIZ", 2.0) >>> c = Circuit() >>> c.push(RPauli(PauliString("YXI"), 2.0), 1, 2, 3) 4-qubit circuit with 1 instruction: └── R("YXI", 2.0) @ q[1:3] >>> c.push(RPauli(PauliString("IXY"), pi), 1, 2, 3) 4-qubit circuit with 2 instructions: ├── R("YXI", 2.0) @ q[1:3] └── R("IXY", pi) @ q[1:3] >>> RPauli(PauliString("XZ"), 0.3).decompose() 2-qubit circuit with 3 instructions: ├── H @ q[0] ├── RNZ(0.3) @ q[0:1] └── H @ q[0]
See also
PauliString,GateRNZ