gigablochs.utils.rodrigues_rotation#
- gigablochs.utils.rodrigues_rotation(v, k, theta, *, normalize=True, axis=-1)[source]#
Apply Rodrigues rotation formula to rotate a vector
varound an axiskby an angletheta.- Parameters:
- Returns:
The rotated vector.
- Return type:
array_like
Notes
The Rodrigues rotation formula is given by:
\[v_{\text{rot}} = v \cos\theta + (k \times v) \sin\theta + k (k \cdot v) (1 - \cos\theta)\]where \(v_{\text{rot}}\) is the rotated vector, \(v\) is the original vector, \(k\) is the rotation axis, and \(\theta\) is the rotation angle.
Examples
>>> import numpy as np >>> from gigablochs import bloch >>> v = np.array([1, 0, 0]) >>> k = np.array([0, 0, 1]) >>> theta = np.pi / 2 >>> bloch.rodrigues_rotation(v, k, theta) array([0., 1., 0.])