# numericRank -- approximate rank of a matrix, using SVD

## Synopsis

• Usage:
rk = numericRank A
rk = numericRank(eps, A)
• Inputs:
• A, , a matrix or a mutable matrix over RR_{53} or CC_{53}
• eps, , a relative threshold for consecutive singular values, if not present then the default value 1e-4 is taken
• Outputs:
• rk, an integer, an approximation to the rank of the matrix A

## Description

The singular value decomposition (over RR_{53}, or CC_{53}) of the matrix A is performed. If there is a large cutoff in the list of singular values, that value separates the zero singular values from the rest, and the number of singular values larger than this separating value is called the numeric rank.

 i1 : B = random(RR^30, RR^5); 30 5 o1 : Matrix RR <--- RR 53 53 i2 : C = random(RR^5, RR^30); 5 30 o2 : Matrix RR <--- RR 53 53 i3 : A = B*C; 30 30 o3 : Matrix RR <--- RR 53 53 i4 : numericRank A o4 = 5 i5 : first SVD A o5 = {37.3735 } {2.8333 } {2.49293 } {2.28935 } {1.7274 } {4.49126e-15} {1.23112e-15} {1.1679e-15 } {9.94271e-16} {9.19629e-16} {7.90573e-16} {7.76772e-16} {7.21772e-16} {6.33562e-16} {5.70814e-16} {5.02404e-16} {4.08911e-16} {3.94147e-16} {3.8654e-16 } {2.77794e-16} {2.58103e-16} {2.25432e-16} {1.92244e-16} {1.73339e-16} {1.36949e-16} {8.99534e-17} {5.45001e-17} {4.59081e-17} {1.53703e-17} {2.8176e-18 } o5 : VerticalList i6 : B = mutableMatrix random(RR^100, RR^50); i7 : C = mutableMatrix random(RR^50, RR^100); i8 : A = B*C; i9 : numericRank A o9 = 50 i10 : B = mutableMatrix random(CC^100, CC^50); i11 : C = mutableMatrix random(CC^50, CC^100); i12 : A = B*C; i13 : numericRank A o13 = 50

## Caveat

The heuristic for determining approximate rank is just that: a heuristic. Thus if you really need to make sure the answer is correct or meaningful, you should review the singular values yourself