pub unsafe extern "C" fn multiControlledUnitary(
qureg: Qureg,
controlQubits: *mut c_int,
numControlQubits: c_int,
targetQubit: c_int,
u: ComplexMatrix2,
)Expand description
Apply a general multiple-control single-target unitary, which can include
a global phase factor. Any number of control qubits can be specified,
and if all have value 1, the given unitary is applied to the target qubit.
This effects the many-qubit unitary
\f[
\begin{pmatrix}
1 \
& 1 \
& & \ddots \
& & & u_{00} & u_{01}\
& & & u_{10} & u_{11}
\end{pmatrix}
\f]
on the control and target qubits.
The given 2x2 ComplexMatrix must be unitary, otherwise an error is thrown.
@htmlonly
@see
- ::ComplexMatrix2
- unitary()
- controlledUnitary()
- multiStateControlledUnitary()
- twoQubitUnitary()
- multiQubitUnitary()
@ingroup unitary @param[in,out] qureg object representing the set of all qubits @param[in] controlQubits applies unitary if all qubits in this array equal 1 @param[in] numControlQubits number of control qubits @param[in] targetQubit qubit to operate on @param[in] u single-qubit unitary matrix to apply @throws invalidQuESTInputError()
- if \p numControlQubits is outside [1, \p qureg.numQubitsRepresented])
- if any qubit index (\p targetQubit or one in \p controlQubits) is outside [0, \p qureg.numQubitsRepresented])
- if any qubit in \p controlQubits is repeated
- if \p controlQubits contains \p targetQubit
- if \p u is not unitary @author Ania Brown (state-vector) @author Tyson Jones (density matrix, doc)