mimiqcircuits.operations.gates.generalized.rpauli

Pauli rotation gate (RPauli).

Classes

RPauli(pauli, theta)

Rotation generated by a Pauli string.

class RPauli(pauli, theta)[source]

Bases: Gate

Rotation 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 with GateH and of each "Y" qubit with GateHYZ, then applies one GateRNZ on 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 str is 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

isidentity()[source]

Return True if the string is all "I" or theta is zero.

An all-"I" string with a non-zero angle is a global phase, which this check ignores.

isunitary()[source]

Return True: gates are unitary.

iswrapper()[source]

Return False: a plain gate does not wrap another operation.

evaluate(d)[source]

Substitute symbols in theta and return a new gate.

Parameters:

d (dict) – Map from symbols to the values to substitute.

Returns:

A new gate with the same Pauli string and the substituted angle.

Return type:

RPauli