matrix_determinant

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

Calculates the determinant of a square matrix M.

Parameters:
Mlist[list[float]]

A square matrix of any dimension.

checkbool

If True, checks if the matrix is square.

Returns:
float

The determinant.

Raises:
ValueError

If the matrix is not square.

Examples

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