skspatial.objects.Points.affine_rank

Points.affine_rank(**kwargs) numpy.int64[source]

Return the affine rank of the points.

The affine rank is the dimension of the smallest affine space that contains the points. A rank of 1 means the points are collinear, and a rank of 2 means they are coplanar.

Parameters
kwargsdict, optional

Additional keywords passed to numpy.linalg.matrix_rank()

Returns
np.int64

Affine rank of the points.

Examples

>>> from skspatial.objects import Points
>>> Points([[5, 5], [5, 5]]).affine_rank()
0
>>> Points([[5, 3], [-6, 20]]).affine_rank()
1
>>> Points([[0, 0], [1, 1], [2, 2]]).affine_rank()
1
>>> Points([[0, 0], [1, 0], [2, 2]]).affine_rank()
2
>>> Points([[0, 1, 0], [1, 1, 0], [2, 2, 2]]).affine_rank()
2
>>> Points([[0, 0], [0, 1], [1, 0], [1, 1]]).affine_rank()
2
>>> Points([[1, 3, 2], [3, 4, 5], [2, 1, 5], [5, 9, 8]]).affine_rank()
3