mimiqcircuits.operations.gates.standard.interactions¶
Interaction gates (RXX, RYY, RZZ, RZX, XX+YY, XX-YY).
Classes
|
Two qubit RXX gate (rotation about XX). |
|
Two qubit RYY gate (rotation about YY). |
|
Two qubit RZX gate. |
|
Two qubit RZZ gate (rotation about ZZ).. |
|
Two qubit parametric GateXXminusYY gate. |
|
Two qubit parametric XXplusYY gate. |
- class mimiqcircuits.operations.gates.standard.interactions.GateRXX(theta)[source]¶
Bases:
GateTwo qubit RXX gate (rotation about XX).
This gate is symmetric, and is maximally entangling at \((\theta = \frac{\pi}{2})\)
Matrix representation:
\[\begin{split}\operatorname{RXX}(\theta) =\begin{pmatrix} \cos(\frac{\theta}{2}) & 0 & 0 & -i\sin(\frac{\theta}{2}) \\ 0 & \cos(\frac{\theta}{2}) & -i\sin(\frac{\theta}{2}) & 0 \\ 0 & -i\sin(\frac{\theta}{2}) & \cos(\frac{\theta}{2}) & 0 \\ -i\sin(\frac{\theta}{2}) & 0 & 0 & \cos(\frac{\theta}{2}) \end{pmatrix}\end{split}\]- Parameters:
theta – The angle in radians.
Examples
>>> from mimiqcircuits import * >>> from symengine import * >>> theta = Symbol('theta') >>> GateRXX(theta) RXX(theta) >>> c = Circuit() >>> c.push(GateRXX(theta), 0, 1) 2-qubit circuit with 1 instruction: └── RXX(theta) @ q[0:1] >>> GateRXX(theta).power(2), GateRXX(theta).inverse() (RXX(theta)**2, RXX(-theta)) >>> GateRXX(theta).matrix() [cos((1/2)*theta), 0, 0, -I*sin((1/2)*theta)] [0, cos((1/2)*theta), -I*sin((1/2)*theta), 0] [0, -I*sin((1/2)*theta), cos((1/2)*theta), 0] [-I*sin((1/2)*theta), 0, 0, cos((1/2)*theta)] >>> GateRXX(theta).decompose() 2-qubit circuit with 7 instructions: ├── H @ q[0] ├── H @ q[1] ├── CX @ q[0], q[1] ├── RZ(theta) @ q[1] ├── CX @ q[0], q[1] ├── H @ q[1] └── H @ 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.interactions.GateRYY(theta)[source]¶
Bases:
GateTwo qubit RYY gate (rotation about YY).
This gate is symmetric, and is maximally entangling at \((\theta = \frac{\pi}{2})\)
Matrix representation:
\[\begin{split}\operatorname{RYY}(\theta) =\begin{pmatrix} \cos(\frac{\theta}{2}) & 0 & 0 & i\sin(\frac{\theta}{2}) \\ 0 & \cos(\frac{\theta}{2}) & -i\sin(\frac{\theta}{2}) & 0 \\ 0 & -i\sin(\frac{\theta}{2}) & \cos(\frac{\theta}{2}) & 0 \\ i\sin(\frac{\theta}{2}) & 0 & 0 & \cos(\frac{\theta}{2}) \end{pmatrix}\end{split}\]- Parameters:
theta (float) – The angle in radians.
Examples
>>> from mimiqcircuits import * >>> from symengine import * >>> theta = Symbol('theta') >>> GateRYY(theta) RYY(theta) >>> GateRYY(theta).matrix() [cos((1/2)*theta), 0, 0, I*sin((1/2)*theta)] [0, cos((1/2)*theta), -I*sin((1/2)*theta), 0] [0, -I*sin((1/2)*theta), cos((1/2)*theta), 0] [I*sin((1/2)*theta), 0, 0, cos((1/2)*theta)] >>> c = Circuit().push(GateRYY(theta), 0, 1) >>> c 2-qubit circuit with 1 instruction: └── RYY(theta) @ q[0:1] >>> GateRYY(theta).power(2), GateRYY(theta).inverse() (RYY(theta)**2, RYY(-theta)) >>> GateRYY(theta).decompose() 2-qubit circuit with 7 instructions: ├── RX((1/2)*pi) @ q[0] ├── RX((1/2)*pi) @ q[1] ├── CX @ q[0], q[1] ├── RZ(theta) @ q[1] ├── CX @ q[0], q[1] ├── RX((-1/2)*pi) @ q[0] └── RX((-1/2)*pi) @ q[1]
- 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.interactions.GateRZZ(theta)[source]¶
Bases:
GateTwo qubit RZZ gate (rotation about ZZ)..
This gate is symmetric, and is maximally entangling at \((\theta = \frac{\pi}{2})\)
Matrix representation:
\[\begin{split}\operatorname{RZZ}(\theta) = \begin{pmatrix} e^{-i\frac{\theta}{2}} & 0 & 0 & 0 \\ 0 & e^{i\frac{\theta}{2}} & 0 & 0 \\ 0 & 0 & e^{i\frac{\theta}{2}} & 0 \\ 0 & 0 & 0 & e^{-i\frac{\theta}{2}} \end{pmatrix}\end{split}\]- Parameters:
theta (float) – The angle in radians.
Examples
>>> from mimiqcircuits import * >>> from symengine import * >>> theta = Symbol('theta') >>> GateRZZ(theta) RZZ(theta) >>> GateRZZ(theta).matrix() [exp(-1/2*I*theta), 0, 0, 0] [0, exp(1/2*I*theta), 0, 0] [0, 0, exp(1/2*I*theta), 0] [0, 0, 0, exp(-1/2*I*theta)] >>> c = Circuit().push(GateRZZ(theta), 0, 1) >>> c 2-qubit circuit with 1 instruction: └── RZZ(theta) @ q[0:1] >>> GateRZZ(theta).power(2), GateRZZ(theta).inverse() (RZZ(theta)**2, RZZ(-theta)) >>> GateRZZ(theta).decompose() 2-qubit circuit with 3 instructions: ├── CX @ q[0], q[1] ├── RZ(theta) @ q[1] └── CX @ q[0], q[1]
- 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.interactions.GateRZX(theta)[source]¶
Bases:
GateTwo qubit RZX gate.
This gate is maximally entangling at \((\theta = \frac{\pi}{2})\)
Matrix representation:
\[\begin{split}\operatorname{RZX}(\theta) =\begin{pmatrix} \cos(\frac{\theta}{2}) & -i\sin(\frac{\theta}{2}) & 0 & 0 \\ -i\sin(\frac{\theta}{2}) & \cos(\frac{\theta}{2}) & 0 & 0 \\ 0 & 0 & \cos(\frac{\theta}{2}) & i\sin(\frac{\theta}{2}) \\ 0 & 0 & i\sin(\frac{\theta}{2}) & \cos(\frac{\theta}{2}) \end{pmatrix}\end{split}\]- Parameters:
theta (float) – The angle in radians.
Examples
>>> from mimiqcircuits import * >>> from symengine import * >>> theta = Symbol('theta') >>> GateRZX(theta) RZX(theta) >>> GateRZX(theta).matrix() [cos((1/2)*theta), -I*sin((1/2)*theta), 0, 0] [-I*sin((1/2)*theta), cos((1/2)*theta), 0, 0] [0, 0, cos((1/2)*theta), I*sin((1/2)*theta)] [0, 0, I*sin((1/2)*theta), cos((1/2)*theta)] >>> c = Circuit().push(GateRZX(theta), 0, 1) >>> c 2-qubit circuit with 1 instruction: └── RZX(theta) @ q[0:1] >>> GateRZX(theta).power(2), GateRZX(theta).inverse() (RZX(theta)**2, RZX(-theta)) >>> GateRZX(theta).decompose() 2-qubit circuit with 5 instructions: ├── H @ q[1] ├── CX @ q[0], q[1] ├── RZ(theta) @ q[1] ├── CX @ q[0], q[1] └── H @ q[1]
- 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.interactions.GateXXplusYY(theta, beta)[source]¶
Bases:
GateTwo qubit parametric XXplusYY gate.
Also known as an XY gate. Its action is to induce a coherent rotation by some angle between \(\ket{10}\) and \(\ket{01}\).
Matrix representation:
\[\begin{split}\operatorname{(XX+YY)}(\theta, \beta)= \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & \cos(\frac{\theta}{2}) & -i\sin(\frac{\theta}{2})e^{i\beta} & 0\\ 0 & -i\sin(\frac{\theta}{2})e^{-i\beta} & \cos(\frac{\theta}{2}) & 0\\ 0 & 0 & 0 & 1 \end{pmatrix}\end{split}\]- Parameters:
theta – The angle in radians.
beta – The phase angle in radians.
Examples
>>> from mimiqcircuits import * >>> from symengine import * >>> theta, beta = symbols('theta beta') >>> GateXXplusYY(theta, beta) XXplusYY(theta, beta) >>> GateXXplusYY(theta, beta).matrix() [1.0, 0, 0, 0] [0, cos((1/2)*theta), (sin(beta) - I*cos(beta))*sin((1/2)*theta), 0] [0, I*(I*sin(beta) - cos(beta))*sin((1/2)*theta), cos((1/2)*theta), 0] [0, 0, 0, 1.0] >>> c = Circuit().push(GateXXplusYY(theta, beta), 0, 1) >>> c 2-qubit circuit with 1 instruction: └── XXplusYY(theta, beta) @ q[0:1] >>> GateXXplusYY(theta, beta).power(2), GateXXplusYY(theta, beta).inverse() (XXplusYY(theta, beta)**2, XXplusYY(-theta, beta)) >>> GateXXplusYY(theta, beta).decompose() 2-qubit circuit with 14 instructions: ├── RZ(beta) @ q[0] ├── RZ((-1/2)*pi) @ q[1] ├── SX @ q[1] ├── RZ((1/2)*pi) @ q[1] ├── S @ q[0] ├── CX @ q[1], q[0] ├── RY((-1/2)*theta) @ q[1] ├── RY((-1/2)*theta) @ q[0] ├── CX @ q[1], q[0] ├── S† @ q[0] ├── RZ((-1/2)*pi) @ q[1] ├── SX† @ q[1] ├── RZ((1/2)*pi) @ q[1] └── RZ(-beta) @ 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.interactions.GateXXminusYY(theta, beta)[source]¶
Bases:
GateTwo qubit parametric GateXXminusYY gate.
Its action is to induce a coherent rotation by some angle between \(\ket{00}\) and \(\ket{11}\)
Matrix representation:
\[\begin{split}\operatorname{(XX-YY)}(\theta, \beta)=\begin{pmatrix} \cos(\frac{\theta}{2}) & 0 & 0 & -i\sin(\frac{\theta}{2})e^{-i\beta} \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ -i\sin(\frac{\theta}{2})e^{i\beta} & 0 & 0 & \cos(\frac{\theta}{2}) \end{pmatrix}\end{split}\]Examples
>>> from mimiqcircuits import * >>> from symengine import * >>> theta, beta = symbols('theta beta') >>> GateXXminusYY(theta, beta) XXminusYY(theta, beta) >>> GateXXminusYY(theta, beta).matrix() [cos((1/2)*theta), 0, 0, I*(I*sin(beta) - cos(beta))*sin((1/2)*theta)] [0, 1.0, 0, 0] [0, 0, 1.0, 0] [(sin(beta) - I*cos(beta))*sin((1/2)*theta), 0, 0, cos((1/2)*theta)] >>> c = Circuit().push(GateXXminusYY(theta, beta), 0, 1) >>> c 2-qubit circuit with 1 instruction: └── XXminusYY(theta, beta) @ q[0:1] >>> GateXXminusYY(theta, beta).power(2), GateXXminusYY(theta, beta).inverse() (XXminusYY(theta, beta)**2, XXminusYY(-theta, beta)) >>> GateXXminusYY(theta, beta).decompose() 2-qubit circuit with 14 instructions: ├── RZ(-beta) @ q[1] ├── RZ((-1/2)*pi) @ q[0] ├── SX @ q[0] ├── RZ((1/2)*pi) @ q[0] ├── S @ q[1] ├── CX @ q[0], q[1] ├── RY((1/2)*theta) @ q[0] ├── RY((-1/2)*theta) @ q[1] ├── CX @ q[0], q[1] ├── S† @ q[1] ├── RZ((-1/2)*pi) @ q[0] ├── SX† @ q[0] ├── RZ((1/2)*pi) @ q[0] └── RZ(beta) @ q[1]
- 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.