colour.algebra.vector_dot#

colour.algebra.vector_dot(m: ArrayLike, v: ArrayLike) NDArrayFloat[source]#

Perform the dot product of the matrix array \(m\) with the vector array \(v\).

This definition is a convenient wrapper around np.einsum() with the following subscripts: ‘…ij,…j->…i’.

Parameters:
  • m (ArrayLike) – Matrix array \(m\).

  • v (ArrayLike) – Vector array \(v\).

Returns:

Transformed vector array \(v\).

Return type:

numpy.ndarray

Examples

>>> m = np.array(
...     [
...         [0.7328, 0.4296, -0.1624],
...         [-0.7036, 1.6975, 0.0061],
...         [0.0030, 0.0136, 0.9834],
...     ]
... )
>>> m = np.reshape(np.tile(m, (6, 1)), (6, 3, 3))
>>> v = np.array([0.20654008, 0.12197225, 0.05136952])
>>> v = np.tile(v, (6, 1))
>>> vector_dot(m, v)  
array([[ 0.1954094...,  0.0620396...,  0.0527952...],
       [ 0.1954094...,  0.0620396...,  0.0527952...],
       [ 0.1954094...,  0.0620396...,  0.0527952...],
       [ 0.1954094...,  0.0620396...,  0.0527952...],
       [ 0.1954094...,  0.0620396...,  0.0527952...],
       [ 0.1954094...,  0.0620396...,  0.0527952...]])