dof

compas.numerical.dof(A, tol=0.001, condition=False)[source]

Returns the degrees-of-freedom of the input matrix A.

Parameters:
Aarray-like

Matrix A represented as an array or list.

tolfloat (0.001)

Tolerance.

conditionbool (False)

Return the condition number of the matrix.

Returns:
int

Column degrees-of-freedom.

int

Row degrees-of-freedom.

float

Condition number, if condition is True.

Notes

The degrees-of-freedom are the number of columns and rows minus the rank.

Examples

>>> from numpy import allclose
>>> d = dof([[2, -1, 3], [1, 0, 1], [0, 2, -1], [1, 1, 4]], condition=True)
>>> allclose(d, (0, 1, 5.073596551))
True