Function applyGateMatrixN

Source
pub unsafe extern "C" fn applyGateMatrixN(
    qureg: Qureg,
    targs: *mut c_int,
    numTargs: c_int,
    u: ComplexMatrixN,
)
Expand description

Apply a gate specified by a general N-by-N matrix, which may be non-unitary, on any number of target qubits. This function applies the given matrix to both statevector and density matrices as if it were a valid unitary gate. Hence this function is equivalent to multiQubitUnitary(), albeit the unitarity of \p u is not checked nor enforced. This function differs from applyMatrixN() on density matrices.

This function may leave \p qureg is an unnormalised state.

@see

  • applyMultiControlledGateMatrixN()
  • applyMatrixN()
  • createComplexMatrixN()
  • getStaticComplexMatrixN()
  • multiQubitUnitary()

@ingroup operator @param[in,out] qureg object representing the set of all qubits @param[in] targs a list of the target qubits, ordered least significant to most in \p u @param[in] numTargs the number of target qubits @param[in] u matrix to apply, which need not be unitary @throws invalidQuESTInputError()

  • if any index in \p targs is outside of [0, \p qureg.numQubitsRepresented)
  • if \p targs are not unique
  • if \p u is not of a compatible size with \p numTargs
  • if a node cannot fit the required number of target amplitudes in distributed mode @author Tyson Jones