colour.utilities.dot_vector

colour.utilities.dot_vector(m, v)[source]

Convenient wrapper around np.einsum() with the following subscripts: ‘…ij,…j->…i’.

It performs the dot product of two arrays where m parameter is expected to be an array of 3x3 matrices and parameter v an array of vectors.

Parameters:
  • m (array_like) – Array of 3x3 matrices.
  • v (array_like) – Array of vectors.
Returns:

Return type:

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.07049534, 0.10080000, 0.09558313])
>>> v = np.tile(v, (6, 1))
>>> dot_vector(m, v)  
array([[ 0.0794399...,  0.1220905...,  0.0955788...],
       [ 0.0794399...,  0.1220905...,  0.0955788...],
       [ 0.0794399...,  0.1220905...,  0.0955788...],
       [ 0.0794399...,  0.1220905...,  0.0955788...],
       [ 0.0794399...,  0.1220905...,  0.0955788...],
       [ 0.0794399...,  0.1220905...,  0.0955788...]])