Function 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.

@htmlonly

@endhtmlonly

@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)