Source code for bqskit.ir.gates.constant.sqrtcnot

"""This module implements the SqrtCNOTGate."""
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 SqrtCNOTGate(ConstantGate, QubitGate): """ The Square root Controlled-X gate. The SqrtCNOT gate is given by the following unitary: .. math:: \\begin{pmatrix} 1 & 0 & 0 & 0 \\\\ 0 & 1 & 0 & 0 \\\\ 0 & 0 & \\frac{1}{2} + \\frac{1}{2}i & \\frac{1}{2} - \\frac{1}{2}i \\\\ 0 & 0 & \\frac{1}{2} - \\frac{1}{2}i & \\frac{1}{2} + \\frac{1}{2}i \\\\ \\end{pmatrix} """ _num_qudits = 2 _qasm_name = 'csx' _utry = UnitaryMatrix( [ [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0.5 + 0.5j, 0.5 - 0.5j], [0, 0, 0.5 - 0.5j, 0.5 + 0.5j], ], )