colour.algebra.matrix_dot#

colour.algebra.matrix_dot(a: ArrayLike, b: ArrayLike) NDArrayFloat[source]#

Perform the dot product of the matrix array \(a\) with the matrix array \(b\).

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

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

  • b (ArrayLike) – Matrix array \(b\).

Return type:

numpy.ndarray

Examples

>>> a = np.array(
...     [
...         [0.7328, 0.4296, -0.1624],
...         [-0.7036, 1.6975, 0.0061],
...         [0.0030, 0.0136, 0.9834],
...     ]
... )
>>> a = np.reshape(np.tile(a, (6, 1)), (6, 3, 3))
>>> b = a
>>> matrix_dot(a, b)  
array([[[ 0.2342420...,  1.0418482..., -0.2760903...],
        [-1.7099407...,  2.5793226...,  0.1306181...],
        [-0.0044203...,  0.0377490...,  0.9666713...]],

       [[ 0.2342420...,  1.0418482..., -0.2760903...],
        [-1.7099407...,  2.5793226...,  0.1306181...],
        [-0.0044203...,  0.0377490...,  0.9666713...]],

       [[ 0.2342420...,  1.0418482..., -0.2760903...],
        [-1.7099407...,  2.5793226...,  0.1306181...],
        [-0.0044203...,  0.0377490...,  0.9666713...]],

       [[ 0.2342420...,  1.0418482..., -0.2760903...],
        [-1.7099407...,  2.5793226...,  0.1306181...],
        [-0.0044203...,  0.0377490...,  0.9666713...]],

       [[ 0.2342420...,  1.0418482..., -0.2760903...],
        [-1.7099407...,  2.5793226...,  0.1306181...],
        [-0.0044203...,  0.0377490...,  0.9666713...]],

       [[ 0.2342420...,  1.0418482..., -0.2760903...],
        [-1.7099407...,  2.5793226...,  0.1306181...],
        [-0.0044203...,  0.0377490...,  0.9666713...]]])