colour.utilities.row_as_diagonal

colour.utilities.row_as_diagonal(a)[source]

Returns the per row diagonal matrices of the given array.

Parameters:a (array_like) – Array to perform the diagonal matrices computation.
Returns:
Return type:ndarray

References

Examples

>>> a = np.array(
...     [[0.25891593, 0.07299478, 0.36586996],
...       [0.30851087, 0.37131459, 0.16274825],
...       [0.71061831, 0.67718718, 0.09562581],
...       [0.71588836, 0.76772047, 0.15476079],
...       [0.92985142, 0.22263399, 0.88027331]]
... )
>>> row_as_diagonal(a)
array([[[ 0.25891593,  0.        ,  0.        ],
        [ 0.        ,  0.07299478,  0.        ],
        [ 0.        ,  0.        ,  0.36586996]],

       [[ 0.30851087,  0.        ,  0.        ],
        [ 0.        ,  0.37131459,  0.        ],
        [ 0.        ,  0.        ,  0.16274825]],

       [[ 0.71061831,  0.        ,  0.        ],
        [ 0.        ,  0.67718718,  0.        ],
        [ 0.        ,  0.        ,  0.09562581]],

       [[ 0.71588836,  0.        ,  0.        ],
        [ 0.        ,  0.76772047,  0.        ],
        [ 0.        ,  0.        ,  0.15476079]],

       [[ 0.92985142,  0.        ,  0.        ],
        [ 0.        ,  0.22263399,  0.        ],
        [ 0.        ,  0.        ,  0.88027331]]])