qops.multiply()#

RotationalDiffusion.quaternions.multiply(q1, q2)[source]#

Compute the Hamilton product (of arrays) of quaternions \(q_1\) and \(q_2\).

Parameters:
q1, q2(…, 4) ndarray

Input arrays to be multiplied, must be broadcastable to a common shape.

Returns:
q_prod(…, 4) ndarray

The pairwise Hamilton products of quaternions in \(q_1\) and \(q_2\).

Notes

The Hamilton product[1] of two quaternions \(q_1 = w_1 + x_1 \cdot i + y_1 \cdot j + z_1 \cdot k\) and \(q_2 = w_2 + x_2 \cdot i + y_2 \cdot j + z_2 \cdot k\) is

\[\begin{split}q_1 \cdot q_2 \quad = \quad &(w_1 \cdot w_2 - x_1 \cdot x_2 - y_1 \cdot y_2 - z_1 \cdot z_2) \\ + &(w_1 \cdot x_2 + x_1 \cdot w_2 + y_1 \cdot z_2 - z_1 \cdot y_2) \cdot i \\ + &(w_1 \cdot y_2 - x_1 \cdot z_2 + y_1 \cdot w_2 + z_1 \cdot x_2) \cdot j \\ + &(w_1 \cdot z_2 + x_1 \cdot y_2 - y_1 \cdot x_2 + z_1 \cdot w_2) \cdot k .\end{split}\]

References