Function swapGate

Source
pub unsafe extern "C" fn swapGate(
    qureg: Qureg,
    qubit1: c_int,
    qubit2: c_int,
)
Expand description

Performs a SWAP gate between \p qubit1 and \p qubit2. This effects \f[ \begin{pmatrix} 1 \ & & 1 \
& 1 \ & & & 1 \end{pmatrix} \f] on the designated qubits, though is performed internally by three CNOT gates.

@htmlonly

@endhtmlonly

@see

  • sqrtSwapGate()

@ingroup unitary @param[in,out] qureg object representing the set of all qubits @param[in] qubit1 qubit to swap @param[in] qubit2 other qubit to swap @throws invalidQuESTInputError()

  • if either \p qubit1 or \p qubit2 are outside [0, \p qureg.numQubitsRepresented)
  • if \p qubit1 and \p qubit2 are equal @author Tyson Jones