Function quest_sys::multiControlledPhaseFlip
source · pub unsafe extern "C" fn multiControlledPhaseFlip(
qureg: Qureg,
controlQubits: *mut c_int,
numControlQubits: c_int
)Expand description
Apply the multiple-qubit controlled phase flip gate, also known as the multiple-qubit controlled pauliZ gate.
For each state, if all control qubits have value one, multiply the amplitude of that state by -1. This applies the many-qubit unitary:
\f[
\begin{pmatrix}
1 \
& 1 \
& & \ddots \
& & & 1 \
& & & & -1
\end{pmatrix}
\f]
on the control qubits.
\f[ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 2) {controls};
\node[draw=none] at (0, 6) {$\vdots$}; \draw (0, 5) – (0, 4);
\draw (-2, 4) – (2, 4); \draw[fill=black] (0, 4) circle (.2); \draw (0, 4) – (0, 2);
\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]
@ingroup unitary @param[in,out] qureg object representing the set of all qubits @param[in] controlQubits array of input qubits @param[in] numControlQubits number of input qubits @throws invalidQuESTInputError()
- if \p numControlQubits is outside [1, \p qureg.numQubitsRepresented)
- if any qubit in \p controlQubits is outside [0, \p qureg.numQubitsRepresented)
- if any qubit in \p qubits is repeated @author Tyson Jones