mimiqcircuits.operations.gates.standard.chadamard¶
Controlled-Hadamard gate.
Classes
|
Two qubit Controlled-Hadamard gate. |
- class mimiqcircuits.operations.gates.standard.chadamard.GateCH(num_controls=None, operation=None, *args, **kwargs)[source]¶
Bases:
ControlTwo qubit Controlled-Hadamard gate.
By convention, the first qubit is the control and the second is the target
Matrix representation:
\[\begin{split}\operatorname{CH} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ 0 & 0 & \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \end{pmatrix}\end{split}\]Examples
>>> from mimiqcircuits import * >>> GateCH(), GateCH().num_controls, GateCH().num_targets, GateCH().num_qubits (CH, 1, 1, 2) >>> GateCH().matrix() [1.0, 0, 0, 0] [0, 1.0, 0, 0] [0, 0, 0.707106781186548, 0.707106781186548] [0, 0, 0.707106781186548, -0.707106781186548] >>> c = Circuit().push(GateCH(), 0, 1) >>> c 2-qubit circuit with 1 instruction: └── CH @ q[0], q[1] >>> GateCH().power(2), GateCH().inverse() (CID, CH) >>> GateCH().decompose() 2-qubit circuit with 7 instructions: ├── S @ q[1] ├── H @ q[1] ├── T @ q[1] ├── CX @ q[0], q[1] ├── T† @ q[1] ├── H @ q[1] └── S† @ q[1]