# rank

compas.numerical.rank(A, tol=0.001)[source]

Calculates the rank of the input matrix A.

Parameters
• A (array-like) – Matrix A represented as an array or list.

• tol (float) – Tolerance.

Returns

int – rank(A)

Notes

The rank of a matrix is the maximum number of linearly independent rows in a matrix. Note that the row rank is equal to the column rank of the matrix.

Examples

>>> rank([[1, 2, 1], [-2, -3, 1], [3, 5, 0]])
2