rank method

int rank()

Effective numerical matrix rank return Number of nonnegligible singular values.

Implementation

int rank() {
  var eps = math.pow(2.0, -52.0).toDouble();
  var tol = math.max(_m, _n) * _s[0] * eps;
  var r = 0;
  for (var i = 0; i < _s.length; i++) {
    if (_s[i] > tol) {
      r++;
    }
  }
  return r;
}