"""This module implements the CNOTGate/CXGate."""
from __future__ import annotations
from bqskit.ir.gates.constantgate import ConstantGate
from bqskit.ir.gates.qubitgate import QubitGate
from bqskit.qis.unitary.unitarymatrix import UnitaryMatrix
[docs]
class CNOTGate(ConstantGate, QubitGate):
"""
The Controlled-Not or Controlled-X gate.
The CNOT gate is given by the following unitary:
.. math::
\\begin{pmatrix}
1 & 0 & 0 & 0 \\\\
0 & 1 & 0 & 0 \\\\
0 & 0 & 0 & 1 \\\\
0 & 0 & 1 & 0 \\\\
\\end{pmatrix}
"""
_num_qudits = 2
_qasm_name = 'cx'
_utry = UnitaryMatrix(
[
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 0, 1],
[0, 0, 1, 0],
],
)
CXGate = CNOTGate