Function quest_sys::controlledPhaseFlip
source · 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:
\f[
\begin{tikzpicture}[scale=.5]
\node[draw=none] at (-3.5, 2) {idQubit1};
\node[draw=none] at (-3.5, 0) {idQubit2};
\draw (-2, 2) – (2, 2); \draw[fill=black] (0, 2) circle (.2); \draw (0, 2) – (0, 0);
\draw (-2,0) – (2, 0); \draw[fill=black] (0, 0) circle (.2); \end{tikzpicture} \f]
@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