# der_CquatT_by_v

Returns the derivative with respect to quaternion components of a projection matrix times a constant vector.

Being $$\mathbf{C}=\mathbf{R}(\boldsymbol{\chi})^\top$$ the projection matrix depending on the quaternion $$\boldsymbol{\chi}$$ and obtained through the function defined as C=quat2rotation(q).T, this function returns the derivative with respect to the quaternion components, of the vector $$(\mathbf{C\cdot v})$$, where $$\mathbf{v}$$ is a constant vector.

The derivative operation is defined as:

$\delta(\mathbf{C}\cdot \mathbf{v}) = \frac{\partial}{\partial\boldsymbol{\chi}}\left(\mathbf{C\cdot v}\right)\delta\boldsymbol{\chi}$

where, for simplicity, we define

$\mathbf{D} = \frac{\partial}{\partial\boldsymbol{\chi}}\left(\mathbf{C\cdot v}\right) \in \mathbb{R}^{3\times4}$

and $$\delta(\bullet)$$ is a delta operator.

The members of $$\mathbf{D}$$ are the following:

$\begin{split}\mathbf{D}_{11} &= 2 (q_0 v_x - q_2 v_z + q_3 v_y)\\ \mathbf{D}_{12} &= 2 (q_1 v_x - q_2 v_y + q_3 v_z)\\ \mathbf{D}_{13} &= 2 (-q_0 v_z + q_1 v_y - q_2 v_x)\\ \mathbf{D}_{14} &= 2 (q_0 v_y + q_1 v_z - q_3 v_x)\end{split}$
$\begin{split}\mathbf{D}_{21} &= 2 (q_0 v_y + q_1 v_z - q_3 v_x)\\ \mathbf{D}_{22} &= 2 (q_0 v_z - q_1 v_y + q_2 v_x)\\ \mathbf{D}_{23} &= 2 (q_1 v_x + q_2 v_y + q_3 v_z)\\ \mathbf{D}_{24} &= 2 (-q_0 v_x + q_2 v_z - q_3 v_y)\end{split}$
$\begin{split}\mathbf{D}_{31} &= 2 (q_0 v_z - q_1 v_y + q_2 v_x)\\ \mathbf{D}_{32} &= 2 (-q_0 v_y - q_1 v_z + q_3 v_x)\\ \mathbf{D}_{33} &= 2 (q_0 v_x - q_2 v_z + q_3 v_y)\\ \mathbf{D}_{34} &= 2 (q_1 v_x + q_2 v_y + q_3 v_z)\\\end{split}$
returns:

$$\mathbf{D}$$ matrix.

rtype:

np.array