Function quest_sys::controlledNot

source ·
pub unsafe extern "C" fn controlledNot(
    qureg: Qureg,
    controlQubit: c_int,
    targetQubit: c_int
)
Expand description

Apply the controlled not (single control, single target) gate, also known as the c-X, c-sigma-X, c-Pauli-X and c-bit-flip gate. This applies pauliX to the target qubit if the control qubit has value 1. This effects the two-qubit unitary \f[ \begin{pmatrix} 1 \ & 1 \
& & & 1 \ & & 1 \end{pmatrix} \f] on the control and target qubits.

\f[ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 2) {control}; \node[draw=none] at (-3.5, 0) {target};

\draw (-2, 2) – (2, 2); \draw[fill=black] (0, 2) circle (.2); \draw (0, 2) – (0, -.5);

\draw (-2,0) – (2, 0); \draw (0, 0) circle (.5); \end{tikzpicture} \f]

@see

  • multiControlledMultiQubitNot()
  • pauliX()

@ingroup unitary @param[in,out] qureg the state-vector or density matrix to modify @param[in] controlQubit nots the target if this qubit is 1 @param[in] targetQubit qubit to not @throws invalidQuESTInputError()

  • if either \p controlQubit or \p targetQubit are outside [0, qureg.numQubitsRepresented)
  • if \p controlQubit and \p targetQubit are equal @author Ania Brown (state-vector) @author Tyson Jones (density matrix, doc)