pub fn quat_mul<const D: usize>(a: Tensor<D>, b: Tensor<D>) -> Tensor<D>Expand description
Hamilton product a ⊗ b of two quaternion tensors.
Both inputs have shape [..., 4] with the last axis ordered (w, x, y, z);
the product is computed component-wise and broadcasts over the leading dims.
Quaternion multiplication is non-commutative (a ⊗ b ≠ b ⊗ a in
general) but associative.
Identifying ℝ⁴ with the quaternions, left-multiplication v ↦ a ⊗ v is
exactly the action of the 4×4 rotation matrix quat_to_rot4(a), so
this is also how a rotation is applied to a state/B/C block (see
rotate_state_rank_blocks).