src/math-helpers.js
function findFirstNonvanishing (M, TOL) {
  const te = M.elements;
  const n = M.dimension;
  let rowCol = {
    row: 0,
    column: 0,
    value: te[0]
  };
  if (Compare.isZero(te[0], TOL)) {
    for (let i = 0; i < n; ++i) {
      for (let j = 0; j < n; ++j) {
        const val = te[i * n + j];
        if (!Compare.isZero(val, TOL)) {
          rowCol.row = j;
          rowCol.column = i;
          rowCol.value = val;
          return rowCol;
        }
      }
    }
  }
  return rowCol;
}
function findFirstNonvanishing (M, TOL) {
  const te = M.elements;
  const n = M.dimension;
  let rowCol = {
    row: 0,
    column: 0,
    value: te[0]
  };
  if (Compare.isZero(te[0], TOL)) {
    for (let i = 0; i < n; ++i) {
      for (let j = 0; j < n; ++j) {
        const val = te[i * n + j];
        if (!Compare.isZero(val, TOL)) {
          rowCol.row = j;
          rowCol.column = i;
          rowCol.value = val;
          return rowCol;
        }
      }
    }
  }
  return rowCol;
}
function findFirstNonvanishing ( M , TOL ) { const te = M . elements ; const n = M . dimension ; let rowCol = { row : 0 , column : 0 , value : te [ 0 ] } ; if ( Compare . isZero ( te [ 0 ] , TOL ) ) { for ( let i = 0 ; i < n ; ++ i ) { for ( let j = 0 ; j < n ; ++ j ) { const val = te [ i * n + j ] ; if ( ! Compare . isZero ( val , TOL ) ) { rowCol . row = j ; rowCol . column = i ; rowCol . value = val ; return rowCol ; } } } } return rowCol ; }
Finds the first nonvanishing element.
@memberof Helpers
@param {Matrix2|Matrix3|Matrix4} M The matrix.
@param {number} TOL The numerical tolerance.
@returns {Object} The information for the nonvanishing element.
Finds the first nonvanishing element .