pub unsafe extern "C" fn applyMultiControlledGateMatrixN(
qureg: Qureg,
ctrls: *mut c_int,
numCtrls: c_int,
targs: *mut c_int,
numTargs: c_int,
m: ComplexMatrixN,
)Expand description
Apply a general multi-controlled multi-qubit gate specified as an (possibly non-unitary) arbitrary complex matrix. This is equivalent to multiControlledMultiQubitUnitary() but does not check nor enforce unitary of the given matrix \p m. This differs from applyMultiControlledMatrixN(), because the latter only left-applies the matrix upon density matrices.
Any number of control and target qubits can be specified.
This effects the many-qubit unitary
\f[
\begin{pmatrix}
1 \
& 1 \
& & \ddots \
& & & m_{00} & m_{01} & \dots \
& & & m_{10} & m_{11} & \dots \
& & & \vdots & \vdots & \ddots
\end{pmatrix}
\f]
on the control and target qubits.
Besides unitarity, the inputs and their preconditions are the same as for multiControlledMultiQubitUnitary().
@see
- createComplexMatrixN()
- applyMultiControlledMatrixN()
- multiControlledMultiQubitUnitary()
@ingroup unitary @param[in,out] qureg object representing the set of all qubits @param[in] ctrls a list of the control qubits @param[in] numCtrls the number of control qubits @param[in] targs a list of the target qubits, ordered least to most significant @param[in] numTargs the number of target qubits @param[in] m arbitrary matrix to apply as if it were a unitary gate @throws invalidQuESTInputError()
- if any qubit in \p ctrls and \p targs is invalid, i.e. outside [0,
qureg.numQubitsRepresented) - if \p ctrls or \p targs contain any repetitions
- if any qubit in \p ctrls is also in \p targs (and vice versa)
- if \p numTargs < 1
- if \p numCtrls < 1 (use multiQubitUnitary() for no controls)
- if matrix \p m is not of a compatible size with \p numTargs
- if a node cannot fit the required number of target amplitudes in distributed mode @throws segmentation-fault
- if \p ctrls contains fewer elements than \p numCtrls
- if \p targs contains fewer elements than \p numTargs @author Tyson Jones