mimiqcircuits.operations.gates.standard.cs¶
Controlled-S and Controlled-SDG gates.
Classes
|
Two qubit Controlled-S gate. |
|
Adjoint of two qubit Controlled-S gate. |
- class mimiqcircuits.operations.gates.standard.cs.GateCS(num_controls=None, operation=None, *args, **kwargs)[source]¶
Bases:
ControlTwo qubit Controlled-S gate.
By convention, the first qubit is the control and the second is the target
See Also
GateSMatrix representation::
\[\begin{split}\operatorname{CS} =\begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & i \end{pmatrix}\end{split}\]Examples
>>> from mimiqcircuits import * >>> GateCS(), GateCS().num_controls, GateCS().num_targets, GateCS().num_qubits (CS, 1, 1, 2) >>> GateCS().matrix() [1.0, 0, 0, 0] [0, 1.0, 0, 0] [0, 0, 1.0, 0] [0, 0, 0, 0.0 + 1.0*I] >>> c = Circuit().push(GateCS(), 0, 1) >>> c 2-qubit circuit with 1 instruction: └── CS @ q[0], q[1] >>> GateCS().power(2), GateCS().inverse() (CZ, C(S†)) >>> GateCS().decompose() 2-qubit circuit with 1 instruction: └── CU(0, 0, (1/2)*pi, 0.0) @ q[0], q[1]
- class mimiqcircuits.operations.gates.standard.cs.GateCSDG(num_controls=None, operation=None, *args, **kwargs)[source]¶
Bases:
ControlAdjoint of two qubit Controlled-S gate.
By convention, the first qubit is the control and the second is the target
Matrix representation:
\[\begin{split}\operatorname{CS}^{\dagger} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & -i \end{pmatrix}\end{split}\]Examples
>>> from mimiqcircuits import * >>> GateCSDG(), GateCSDG().num_controls, GateCSDG().num_targets, GateCSDG().num_qubits (C(S†), 1, 1, 2) >>> GateCSDG().matrix() [1.0, 0, 0, 0] [0, 1.0, 0, 0] [0, 0, 1.0, 0] [0, 0, 0, 6.12323399573677e-17 - 1.0*I] >>> c = Circuit().push(GateCSDG(), 0, 1) >>> c 2-qubit circuit with 1 instruction: └── C(S†) @ q[0], q[1] >>> GateCSDG().power(2), GateCSDG().inverse() (C((S†)**2), CS) >>> GateCSDG().decompose() 2-qubit circuit with 1 instruction: └── CU(0, 0, (-1/2)*pi, 0.0) @ q[0], q[1]