colour.algebra.is_identity

colour.algebra.is_identity(a, n=3)[source]

Returns if \(a\) array is an identity matrix.

Parameters:
  • a (array_like, (N)) – Variable \(a\) to test.
  • n (int, optional) – Matrix dimension.
Returns:

Is identity matrix.

Return type:

bool

Examples

>>> is_identity(np.array([1, 0, 0, 0, 1, 0, 0, 0, 1]).reshape(3, 3))
True
>>> is_identity(np.array([1, 2, 0, 0, 1, 0, 0, 0, 1]).reshape(3, 3))
False