Function quest_sys::controlledRotateAroundAxis
source · pub unsafe extern "C" fn controlledRotateAroundAxis(
qureg: Qureg,
controlQubit: c_int,
targetQubit: c_int,
angle: f64,
axis: Vector
)Expand description
Applies a controlled rotation by a given angle around a given vector on the Bloch-sphere. The vector must not be zero (else an error is thrown), but needn’t be unit magnitude.
For angle \f$\theta\f$ and axis vector \f$\vec{n}\f$, applies \f$R_{\hat{n}} = \exp \left(- i \frac{\theta}{2} \hat{n} \cdot \vec{\sigma} \right) \f$ to states where the target qubit is 1 (\f$\vec{\sigma}\f$ is the vector of Pauli matrices).
\f[ \begin{tikzpicture}[scale=.5] \node[draw=none] at (-3.5, 2) {control}; \node[draw=none] at (-3.5, 0) {target};
\draw (-2, 2) – (2, 2); \draw[fill=black] (0, 2) circle (.2); \draw (0, 2) – (0, 1);
\draw (-2,0) – (-1, 0); \draw (1, 0) – (2, 0); \draw (-1,-1)–(-1,1)–(1,1)–(1,-1)–cycle; \node[draw=none] at (0, 0) {$R_{\hat{n}}(\theta)$}; \end{tikzpicture} \f]
@see
- rotateAroundAxis()
- multiRotatePauli()
@ingroup unitary @param[in,out] qureg object representing the set of all qubits @param[in] controlQubit qubit with value 1 in the rotated states @param[in] targetQubit qubit to rotate @param[in] angle angle by which to rotate in radians @param[in] axis vector around which to rotate (can be non-unit; will be normalised) @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 axis is the zero vector @author Tyson Jones