Description
Related julia-dev discussion: https://groups.google.com/d/msg/julia-dev/GAdcYzmibyo/iOLpyVQc8YIJ
The function rank should allow the user to set both absolute and relative tolerances using keyword arguments:
rank(A,reltol=1e-6)
rank(A,abstol=1e-6)
where reltol is a relative tolerance with respect to the largest singular value of A.
As a bonus, it would also be nice to have a mlrank
(multilinear rank), which is one way to generalize rank to tensors (the only computationally tractable way). The multilinear rank of a tensor T
is defined as a vector/tuple of ranks R
, one for each mode of the tensor (in the matrix case, the column rank equals the row rank). R[n]
is defined as the dimension of the space spanned by mode-n vectors of T
. To get R[1]
, you take the svd of a matrix containing all column vectors of T and look at its dimensionality. I.e., R[1] = sum(svdvals(T[:,:]) .> abstol)
. For R[2]
, you do the same but for the row vectors of T
, and so on.