Calculate the rank of a 10*10 matrix to find whether it is rank deficient

Is it possible using FreeFem++ to calculate the rank of a 10*10 matrix? I’m dealing with a least-square fitting problem in 3D, and a piece of code is about:

check whether the rank of a 10*10 matrix is equal to 10. If so, then using the least-square fitting of polynomial of order 2; otherwise the matrix is rank deficient, then using the fitting of a polynomial of order 1.

Besides, the least-square fitting problem is solved by sparsesolver/UMFPACK:

matrix AtA = A' * A;

set(AtA, solver = UMFPACK);

real[int] rhs;

real[int] a = AtA^-1 * rhs;