mimiqcircuits.operations.gates.standard.rotations¶
Rotation gates (RX, RY, RZ, R).
Classes
|
Single qubit rotation around the axis \(\cos(\phi)\hat{x} + \sin(\phi)\hat{y}\). |
|
Single qubit rotation around the \(\hat{x}\) axis. |
|
Single qubit rotation around the \(\hat{y}\) axis. |
|
Single qubit rotation around the \(\hat{z}\) axis. |
- class GateRX(theta)[source]¶
Bases:
GateSingle qubit rotation around the \(\hat{x}\) axis.
Matrix Representation
\[\begin{split}\operatorname{RX}(\theta) = \begin{pmatrix} \cos\frac{\theta}{2} & -i\sin\frac{\theta}{2} \\ -i\sin\frac{\theta}{2} & \cos\frac{\theta}{2} \end{pmatrix}\end{split}\]- Parameters:
theta – Rotation angle in radians, numeric or symbolic.
Examples
>>> from mimiqcircuits import * >>> from symengine import * >>> theta = Symbol('theta') >>> GateRX(theta) RX(theta) >>> GateRX(theta).matrix() [cos((1/2)*theta), -I*sin((1/2)*theta)] [-I*sin((1/2)*theta), cos((1/2)*theta)] >>> c = Circuit().push(GateRX(theta), 0) >>> c 1-qubit circuit with 1 instruction: └── RX(theta) @ q[0] >>> GateRX(theta).power(2), GateRX(theta).inverse() (RX(2*theta), RX(-theta)) >>> GateRX(theta).decompose() 1-qubit circuit with 1 instruction: └── U(theta, (-1/2)*pi, (1/2)*pi, 0.0) @ q[0]
- class GateRY(theta)[source]¶
Bases:
GateSingle qubit rotation around the \(\hat{y}\) axis.
Matrix Representation
\[\begin{split}\operatorname{RY}(\theta) = \begin{pmatrix} \cos\frac{\theta}{2} & -\sin\frac{\theta}{2} \\ \sin\frac{\theta}{2} & \cos\frac{\theta}{2} \end{pmatrix}\end{split}\]- Parameters:
theta – Rotation angle in radians, numeric or symbolic.
Examples
>>> from mimiqcircuits import * >>> from symengine import * >>> theta = Symbol('theta') >>> GateRY(theta) RY(theta) >>> GateRY(theta).matrix() [cos((1/2)*theta), -sin((1/2)*theta)] [sin((1/2)*theta), cos((1/2)*theta)] >>> c = Circuit().push(GateRY(theta), 0) >>> c 1-qubit circuit with 1 instruction: └── RY(theta) @ q[0] >>> GateRY(theta).power(2), GateRY(theta).inverse() (RY(2*theta), RY(-theta)) >>> GateRY(theta).decompose() 1-qubit circuit with 1 instruction: └── U(theta, 0, 0, 0.0) @ q[0]
- class GateRZ(lmbda)[source]¶
Bases:
GateSingle qubit rotation around the \(\hat{z}\) axis.
Matrix Representation
\[\begin{split}\operatorname{RZ}(\lambda) = \begin{pmatrix} e^{-i\frac{\lambda}{2}} & 0 \\ 0 & e^{i\frac{\lambda}{2}} \end{pmatrix}\end{split}\]- Parameters:
lmbda – Rotation angle \(\lambda\) in radians, numeric or symbolic.
Examples
>>> from mimiqcircuits import * >>> from symengine import * >>> lmbda = Symbol('lambda') >>> GateRZ(lmbda) RZ(lambda) >>> GateRZ(lmbda).matrix() [exp(-1/2*I*lambda), 0] [0, exp(1/2*I*lambda)] >>> c = Circuit().push(GateRZ(lmbda), 0) >>> c 1-qubit circuit with 1 instruction: └── RZ(lambda) @ q[0] >>> GateRZ(lmbda).power(2), GateRZ(lmbda).inverse() (RZ(2*lambda), RZ(-lambda)) >>> GateRZ(lmbda).decompose() 1-qubit circuit with 1 instruction: └── U(0, 0, lambda, (-1/2)*lambda) @ q[0]
- class GateR(theta, phi)[source]¶
Bases:
GateSingle qubit rotation around the axis \(\cos(\phi)\hat{x} + \sin(\phi)\hat{y}\).
Matrix Representation
\[\begin{split}\operatorname R(\theta,\phi) = \begin{pmatrix} \cos \frac{\theta}{2} & -i e^{-i\phi} \sin \frac{\theta}{2} \\ -i e^{i \phi} \sin \frac{\theta}{2} & \cos \frac{\theta}{2} \end{pmatrix}\end{split}\]- Parameters:
theta – Rotation angle in radians, numeric or symbolic.
phi – Angle of the rotation axis from \(\hat{x}\) in the \(xy\) plane, in radians.
Examples
>>> from mimiqcircuits import * >>> from symengine import * >>> theta, phi = symbols('theta phi') >>> GateR(theta, phi) R(theta, phi) >>> GateR(theta, phi).matrix() [cos((1/2)*theta), -I*exp(-I*phi)*sin((1/2)*theta)] [-I*exp(I*phi)*sin((1/2)*theta), cos((1/2)*theta)] >>> c = Circuit().push(GateR(theta, phi), 0) >>> c 1-qubit circuit with 1 instruction: └── R(theta, phi) @ q[0] >>> GateR(theta, phi).power(2), GateR(theta, phi).inverse() (R(2*theta, phi), R(-theta, phi)) >>> GateR(theta, phi).decompose() 1-qubit circuit with 1 instruction: └── U3(theta, phi + (-1/2)*pi, -phi + (1/2)*pi) @ q[0]