Function controlledPhaseFlip

Source
pub unsafe extern "C" fn controlledPhaseFlip(
    qureg: Qureg,
    idQubit1: c_int,
    idQubit2: c_int,
)
Expand description

Apply the (two-qubit) controlled phase flip gate, also known as the controlled pauliZ gate. For each state, if both input qubits have value one, multiply the amplitude of that state by -1. This applies the two-qubit unitary: \f[ \begin{pmatrix} 1 \ & 1 \
& & 1 \ & & & -1 \end{pmatrix} \f] with circuit diagram: @htmlonly

@endhtmlonly

@see

  • pauliZ()
  • phaseShift()
  • multiControlledPhaseFlip()

@ingroup unitary @param[in,out] qureg object representing the set of all qubits @param[in] idQubit1, idQubit2 qubits to operate upon @throws invalidQuESTInputError()

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