mimiqcircuits.operations.gates.standard.deprecated

Deprecated gates (U1, U2, U3).

Classes

GateU1(lmbda)

Single qubit phase gate \(U_1\), equivalent to GateP.

GateU2(phi, lmbda)

Single qubit gate \(U_2\), equal to \(U(\pi/2, \phi, \lambda)\).

GateU3(theta, phi, lmbda)

Single qubit gate \(U_3\), equal to GateU with no global phase.

class GateU1(lmbda)[source]

Bases: Gate

Single qubit phase gate \(U_1\), equivalent to GateP.

Kept for compatibility with OpenQASM 2; GateP is the same gate.

Matrix Representation

\[\begin{split}\operatorname{U1}(\lambda) = \begin{pmatrix} 1 & 0 \\ 0 & e^{i\lambda} \end{pmatrix}\end{split}\]
Parameters:

lmbda – Phase angle \(\lambda\) in radians.

Examples

>>> from mimiqcircuits import *
>>> from symengine import *
>>> lmbda = Symbol('lambda')
>>> GateU1(lmbda)
U1(lambda)
>>> GateU1(lmbda).matrix()
[1.0, 0]
[0, exp(I*lambda)]

>>> c = Circuit().push(GateU1(lmbda), 0)
>>> c
1-qubit circuit with 1 instruction:
└── U1(lambda) @ q[0]

>>> GateU1(lmbda).power(2), GateU1(lmbda).inverse()
(U1(2*lambda), U1(-lambda))
>>> GateU1(lmbda).decompose()
1-qubit circuit with 1 instruction:
└── U(0, 0, lambda, 0.0) @ q[0]
inverse()[source]

Return the inverse of the gate.

Gates with a known inverse return it directly (for example GateS().inverse() is GateSDG()); otherwise the gate is wrapped in Inverse.

class GateU2(phi, lmbda)[source]

Bases: Gate

Single qubit gate \(U_2\), equal to \(U(\pi/2, \phi, \lambda)\).

Kept for compatibility with OpenQASM 2; GateU covers the same gates.

Matrix Representation

\[\begin{split}\operatorname{U2}(\phi,\lambda) = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & -e^{i\lambda} \\ e^{i\phi} & e^{i(\phi+\lambda)} \end{pmatrix}\end{split}\]
Parameters:
  • phi – Euler angle \(\phi\) in radians.

  • lmbda – Euler angle \(\lambda\) in radians.

Examples

>>> from mimiqcircuits import *
>>> from symengine import *
>>> phi, lmbda = symbols('phi lambda')
>>> GateU2(phi, lmbda)
U2(phi, lambda)
>>> GateU2(phi, lmbda).matrix()
[0.707106781186548, (-1/2)*sqrt(2)*exp(I*lambda)]
[(1/2)*sqrt(2)*exp(I*phi), (1/2)*sqrt(2)*exp(I*(lambda + phi))]

>>> c = Circuit().push(GateU2(phi, lmbda), 0)
>>> c
1-qubit circuit with 1 instruction:
└── U2(phi, lambda) @ q[0]

>>> GateU2(phi, lmbda).power(2), GateU2(phi, lmbda).inverse()
(U2(phi, lambda)**2, U2(-lambda - pi, -phi + pi))
>>> GateU2(phi, lmbda).decompose()
1-qubit circuit with 1 instruction:
└── U((1/2)*pi, phi, lambda, 0.0) @ q[0]
inverse()[source]

Return the inverse of the gate.

Gates with a known inverse return it directly (for example GateS().inverse() is GateSDG()); otherwise the gate is wrapped in Inverse.

class GateU3(theta, phi, lmbda)[source]

Bases: Gate

Single qubit gate \(U_3\), equal to GateU with no global phase.

Kept for compatibility with OpenQASM 2; GateU covers the same gates.

Matrix Representation

\[\begin{split}\operatorname{U3}(\theta,\phi,\lambda) = \begin{pmatrix} \cos\left(\frac{\theta}{2}\right) & -\mathrm{e}^{i\lambda}\sin\left(\frac{\theta}{2}\right) \\ \mathrm{e}^{i\phi}\sin\left(\frac{\theta}{2}\right) & \mathrm{e}^{i(\phi+\lambda)}\cos\left(\frac{\theta}{2}\right) \end{pmatrix}\end{split}\]
Parameters:
  • theta – Euler angle \(\theta\) in radians.

  • phi – Euler angle \(\phi\) in radians.

  • lmbda – Euler angle \(\lambda\) in radians.

Examples

>>> from mimiqcircuits import *
>>> from symengine import *
>>> theta, phi, lmbda = symbols('theta phi lambda')
>>> GateU3(theta, phi, lmbda)
U3(theta, phi, lambda)
>>> GateU3(theta, phi, lmbda).matrix()
[cos((1/2)*theta), -exp(I*lambda)*sin((1/2)*theta)]
[exp(I*phi)*sin((1/2)*theta), exp(I*(lambda + phi))*cos((1/2)*theta)]

>>> c = Circuit().push(GateU3(theta, phi, lmbda), 0)
>>> c
1-qubit circuit with 1 instruction:
└── U3(theta, phi, lambda) @ q[0]

>>> GateU3(theta, phi, lmbda).power(2), GateU3(theta, phi, lmbda).inverse()
(U3(theta, phi, lambda)**2, U3(-theta, -lambda, -phi))
>>> GateU3(theta, phi, lmbda).decompose()
1-qubit circuit with 1 instruction:
└── U(theta, phi, lambda, 0.0) @ q[0]
inverse()[source]

Return the inverse of the gate.

Gates with a known inverse return it directly (for example GateS().inverse() is GateSDG()); otherwise the gate is wrapped in Inverse.