matrix_determinant

compas.geometry.matrix_determinant(M, check=True)[source]

Calculates the determinant of a square matrix M.

Parameters
  • M (list[list[float]]) – A square matrix of any dimension.

  • check (bool) – If True, checks if the matrix is square.

Raises

ValueError – If the matrix is not square.

Returns

float – The determinant.

Examples

>>> M = identity_matrix(4)
>>> matrix_determinant(M)
1.0