mimiqcircuits.operations.gates.standard.rotations¶
Rotation gates (RX, RY, RZ, R).
Classes
|
Single qubit Rotation gate around the axis \(\cos(\phi)\hat{x} + \sin(\phi)\hat{y}\). |
|
Single qubit Rotation gate around the axis \(\hat{x}\) |
|
Single qubit Rotation gate around the axis \(\hat{y}\) |
|
Single qubit Rotation gate around the axis \(\hat{z}\) |
- class mimiqcircuits.operations.gates.standard.rotations.GateRX(theta)[source]¶
Bases:
GateSingle qubit Rotation gate around the axis \(\hat{x}\)
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.
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]
- inverse()[source]¶
Raise an error, as non-unitary operators cannot be inverted.
This method is not implemented for non-unitary operators and will raise a NotImplementedError if called.
- Raises:
NotImplementedError – If the method is called.
- class mimiqcircuits.operations.gates.standard.rotations.GateRY(theta)[source]¶
Bases:
GateSingle qubit Rotation gate around the axis \(\hat{y}\)
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 (float) – Rotation angle in radians.
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]
- inverse()[source]¶
Raise an error, as non-unitary operators cannot be inverted.
This method is not implemented for non-unitary operators and will raise a NotImplementedError if called.
- Raises:
NotImplementedError – If the method is called.
- class mimiqcircuits.operations.gates.standard.rotations.GateRZ(lmbda)[source]¶
Bases:
GateSingle qubit Rotation gate around the axis \(\hat{z}\)
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:
lambda – Rotation angle in radians.
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]
- inverse()[source]¶
Raise an error, as non-unitary operators cannot be inverted.
This method is not implemented for non-unitary operators and will raise a NotImplementedError if called.
- Raises:
NotImplementedError – If the method is called.
- class mimiqcircuits.operations.gates.standard.rotations.GateR(theta, phi)[source]¶
Bases:
GateSingle qubit Rotation gate 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:
Example
>>> 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) >>> 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]
- inverse()[source]¶
Raise an error, as non-unitary operators cannot be inverted.
This method is not implemented for non-unitary operators and will raise a NotImplementedError if called.
- Raises:
NotImplementedError – If the method is called.