mimiqcircuits.operations.gates.standard.hadamard¶
Hadamard (H) and related gates (HXY, HYZ, HXZ).
Classes
|
Single qubit Hadamard gate, \((X + Z)/\sqrt{2}\). |
|
Single qubit HXY gate, \((X + Y)/\sqrt{2}\). |
|
Single qubit HXZ gate, \((X + Z)/\sqrt{2}\), the same as |
|
Single qubit HYZ gate, \((Y + Z)/\sqrt{2}\). |
- class GateH[source]¶
Bases:
GateSingle qubit Hadamard gate, \((X + Z)/\sqrt{2}\).
Matrix Representation
\[\begin{split}\operatorname{H} = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}\end{split}\]Examples
>>> from mimiqcircuits import * >>> GateH() H >>> GateH().matrix() [0.707106781186548, 0.707106781186548] [0.707106781186548, -0.707106781186548] >>> c = Circuit().push(GateH(), 0) >>> c 1-qubit circuit with 1 instruction: └── H @ q[0] >>> GateH().power(2), GateH().inverse() (ID, H) >>> GateH().decompose() 1-qubit circuit with 1 instruction: └── U((1/2)*pi, 0, pi, 0.0) @ q[0]
- class GateHXY[source]¶
Bases:
GateSingle qubit HXY gate, \((X + Y)/\sqrt{2}\).
A Hadamard-like gate that exchanges the \(X\) and \(Y\) axes.
Matrix Representation
\[\begin{split}\operatorname{HXY} = \frac{1}{\sqrt{2}} \begin{pmatrix} 0 & 1 - i \\ 1 + i & 0 \end{pmatrix}\end{split}\]Examples
>>> from mimiqcircuits import * >>> GateHXY() HXY >>> GateHXY().matrix() [0, 0.707106781186548 - 0.707106781186548*I] [0.707106781186548 + 0.707106781186548*I, 0] >>> c = Circuit().push(GateHXY(), 0) >>> c 1-qubit circuit with 1 instruction: └── HXY @ q[0] >>> GateHXY().power(2), GateHXY().inverse() (HXY**2, HXY) >>> GateHXY().decompose() 1-qubit circuit with 5 instructions: ├── H @ q[0] ├── Z @ q[0] ├── H @ q[0] ├── S @ q[0] └── U(0, 0, 0, (-1/4)*pi) @ q[0]
- class GateHYZ[source]¶
Bases:
GateSingle qubit HYZ gate, \((Y + Z)/\sqrt{2}\).
A Hadamard-like gate that exchanges the \(Y\) and \(Z\) axes.
Matrix Representation
\[\begin{split}\operatorname{HYZ} = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & -i \\ i & -1 \end{pmatrix}\end{split}\]Examples
>>> from mimiqcircuits import * >>> GateHYZ() HYZ >>> GateHYZ().matrix() [0.707106781186548, 0.0 - 0.707106781186548*I] [0.0 + 0.707106781186548*I, -0.707106781186548] >>> c = Circuit().push(GateHYZ(), 0) >>> c 1-qubit circuit with 1 instruction: └── HYZ @ q[0] >>> GateHYZ().power(2), GateHYZ().inverse() (HYZ**2, HYZ) >>> GateHYZ().decompose() 1-qubit circuit with 5 instructions: ├── H @ q[0] ├── S @ q[0] ├── H @ q[0] ├── Z @ q[0] └── U(0, 0, 0, (-1/4)*pi) @ q[0]
- class GateHXZ[source]¶
Bases:
GateSingle qubit HXZ gate, \((X + Z)/\sqrt{2}\), the same as
GateH.GateHXZ()returns aGateHinstance.Matrix Representation
\[\begin{split}\operatorname{HXZ} = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}\end{split}\]Examples
>>> from mimiqcircuits import * >>> GateHXZ() H >>> GateHXZ().matrix() [0.707106781186548, 0.707106781186548] [0.707106781186548, -0.707106781186548] >>> c = Circuit().push(GateHXZ(), 0) >>> c 1-qubit circuit with 1 instruction: └── H @ q[0] >>> GateHXZ().power(2), GateHXZ().inverse() (ID, H) >>> GateHXZ().decompose() 1-qubit circuit with 1 instruction: └── U((1/2)*pi, 0, pi, 0.0) @ q[0]