src/math-helpers.js
function getRank (M, EPS) {
  const n = M.dimension;
  const { R } = qrDecomposition(M);
  // TODO: this is a bad way of doing this probably
  R.thresholdEntriesToZero(100 * EPS);
  let rank = 0;
  rrefInPlace(R);
  for (let i = 0; i < n; ++i) {
    if (isRowNonzero(R, i)) {
      rank++;
    }
  }
  return rank;
}
function getRank (M, EPS) {
  const n = M.dimension;
  const { R } = qrDecomposition(M);
  // TODO: this is a bad way of doing this probably
  R.thresholdEntriesToZero(100 * EPS);
  let rank = 0;
  rrefInPlace(R);
  for (let i = 0; i < n; ++i) {
    if (isRowNonzero(R, i)) {
      rank++;
    }
  }
  return rank;
}
function getRank ( M , EPS ) { const n = M . dimension ; const { R } = qrDecomposition ( M ) ; // TODO: this is a bad way of doing this probably R . thresholdEntriesToZero ( 100 * EPS ) ; let rank = 0 ; rrefInPlace ( R ) ; for ( let i = 0 ; i < n ; ++ i ) { if ( isRowNonzero ( R , i ) ) { rank ++ ; } } return rank ; }
Computes the rank of a matrix.
@memberof Helpers
@param {Matrix2|Matrix3|Matrix4} M The matrix to get the rank of.
@param {number} EPS The numerical tolerance for an element to be zero.
Computes the rank of a matrix .