qoqo.operations.RotateZ
- class qoqo.operations.RotateZ
The ZPower gate \(e^{-i \frac{\theta}{2} \sigma^z}\).
\[\begin{split}U = \begin{pmatrix} \cos(\frac{\theta}{2}) & 0 \\\\ 0 & \cos(\frac{\theta}{2}) \end{pmatrix} + \begin{pmatrix} - i \sin(\frac{\theta}{2}) & 0 \\\\ 0 & i \sin(\frac{\theta}{2}) \end{pmatrix}\end{split}\]- Parameters:
qubit (int) – The qubit the unitary gate is applied to.
theta (CalculatorFloat) – The angle \(\theta\) of the rotation.
- __init__()
Methods
__init__
()alpha_i
()Return the property alpha_i \(\alpha_i\) of a unitary gate acting on one qubit
alpha_r
()Return the property alpha_r \(\alpha_r\) of a unitary gate acting on one qubit
beta_i
()Returns the property beta_i \(\beta_i\) of a unitary gate acting on one qubit
beta_r
()Return the property beta_r \(\beta_r\) of a unitary gate acting on one qubit
Return the global phase \(g\) of a unitary gate acting on one qubit
hqslang
()Returns hqslang name of Operation
List all involved Qubits
Returns true if operation contains symbolic parameters
mul
(other)Multiplies two compatible operations implementing OperateSingleQubitGate.
powercf
(power)Returns Rotated gate raised to power
qubit
()Return the qubit the operation acts on
remap_qubits
(mapping)Remap qubits
substitute_parameters
(substitution_parameters)Substitutes internal symbolic parameters with float values
tags
()Returns tags identifying the Operation
theta
()Returns angle of rotation
Return unitary matrix of gate.
- alpha_i()
Return the property alpha_i \(\alpha_i\) of a unitary gate acting on one qubit
\[\begin{split}U =e^{i \cdot g}\begin{pmatrix} \alpha_r+i \alpha_i & -\beta_r+i \beta_i \\\\ \beta_r+i \beta_i & \alpha_r-i\alpha_i \end{pmatrix}\end{split}\]- Returns:
CalculatorFloat
- alpha_r()
Return the property alpha_r \(\alpha_r\) of a unitary gate acting on one qubit
Here alpha_r is defined by
\[\begin{split}U =e^{i \cdot g}\begin{pmatrix} \alpha_r+i \alpha_i & -\beta_r+i \beta_i \\\\ \beta_r+i \beta_i & \alpha_r-i\alpha_i \end{pmatrix}\end{split}\]- Returns:
CalculatorFloat
- beta_i()
Returns the property beta_i \(\beta_i\) of a unitary gate acting on one qubit
Here beta_i is defined by
\[\begin{split}U =e^{i \cdot g}\begin{pmatrix} \alpha_r+i \alpha_i & -\beta_r+i \beta_i \\\\ \beta_r+i \beta_i & \alpha_r-i\alpha_i \end{pmatrix}\end{split}\]- Returns:
CalculatorFloat
- beta_r()
Return the property beta_r \(\beta_r\) of a unitary gate acting on one qubit
Here beta_r is defined by
\[\begin{split}U =e^{i \cdot g}\begin{pmatrix} \alpha_r+i \alpha_i & -\beta_r+i \beta_i \\\\ \beta_r+i \beta_i & \alpha_r-i\alpha_i \end{pmatrix}\end{split}\]- Returns:
CalculatorFloat
- global_phase()
Return the global phase \(g\) of a unitary gate acting on one qubit
Here global_phase is defined by
\[\begin{split}U =e^{i \cdot g}\begin{pmatrix} \alpha_r+i \alpha_i & -\beta_r+i \beta_i \\\\ \beta_r+i \beta_i & \alpha_r-i\alpha_i \end{pmatrix}\end{split}\]- Returns:
CalculatorFloat
- hqslang()
Returns hqslang name of Operation
- Returns:
The name
- Return type:
str
- involved_qubits()
List all involved Qubits
- Returns:
The involved qubits as a set or ‘ALL’ if all qubits are involved
- Return type:
Union[set[int], str]
- is_parametrized()
Returns true if operation contains symbolic parameters
- Returns:
bool
- mul(other)
Multiplies two compatible operations implementing OperateSingleQubitGate.
Does not consume the two operations being multiplied. Only Operations
- Parameters:
[OperateSingleQubitGate]. (other - An Operation implementing) –
- Returns:
Result of the multiplication, i.e. the multiplied single qubit gate.
- Return type:
PyResult
Example: ``` from qoqo.operations import RotateZ, RotateX
gate1 = RotateZ(qubit=0, theta=1) gate2 = RotateX(qubit=0, theta=1) multiplied = gate1.mul(gate2) print(“Multiplied gate: “, multiplied) ```
- powercf(power)
Returns Rotated gate raised to power
- Parameters:
power (CalculatorFloat) – exponent of the power operation.
- Returns:
gate raised to the power of power
- Return type:
Self
- qubit()
Return the qubit the operation acts on
- Returns:
int
- remap_qubits(mapping)
Remap qubits
- Parameters:
mapping (dict[int, int]) – The mapping
- Returns:
The operation with the remapped qubits
- Return type:
Operation
- Raises:
RuntimeError – Qubit remapping failed
- substitute_parameters(substitution_parameters)
Substitutes internal symbolic parameters with float values
Only available when all symbolic expressions can be evaluated to float with the provided parameters.
- Parameters:
substitution_parameters (dict[str, float]) – The substituted free parameters
- Returns:
The operation with the parameters substituted
- Return type:
Operation
- Raises:
RuntimeError – Parameter Substitution failed
- tags()
Returns tags identifying the Operation
- Returns:
The tags identifying the operation
- Return type:
list[str]
- theta()
Returns angle of rotation
- unitary_matrix()
Return unitary matrix of gate.
- Returns:
np.ndarray
- Raises:
ValueError – Error symbolic operation cannot return float unitary matrix