pub unsafe extern "C" fn controlledCompactUnitary(
qureg: Qureg,
controlQubit: c_int,
targetQubit: c_int,
alpha: Complex,
beta: Complex,
)Expand description
Apply a controlled unitary (single control, single target) parameterised by two given complex scalars. Given valid complex numbers \f$\alpha\f$ and \f$\beta\f$, applies the two-qubit unitary \f[ \begin{pmatrix} 1 \ & 1 \ & & \alpha & -\beta^* \ & & \beta & \alpha^* \end{pmatrix} \f] to the control and target qubits. Valid \f$\alpha\f$, \f$\beta\f$ satisfy \f$|\alpha|^2 + |\beta|^2 = 1\f$. The target unitary is general up to a global phase factor.
@htmlonly
@see
- compactUnitary()
- controlledUnitary()
- multiControlledUnitary()
- multiStateControlledUnitary()
@ingroup unitary @param[in,out] qureg object representing the set of all qubits @param[in] controlQubit apply the target unitary if this qubit has value 1 @param[in] targetQubit qubit on which to apply the target unitary @param[in] alpha complex unitary parameter (row 1, column 1) @param[in] beta complex unitary parameter (row 2, column 1) @throws invalidQuESTInputError()
- if either \p controlQubit or \p targetQubit are outside [0, \p qureg.numQubitsRepresented)
- if \p controlQubit and \p targetQubit are equal
- if \p alpha, \p beta don’t satisfy |
alpha|^2 + |beta|^2 = 1 @author Ania Brown (state-vector) @author Tyson Jones (density matrix, doc)