src/math-helpers.js
function modifiedGramSchmidt (m) {
  const n = m.dimension;

  const v0 = m.getColumn(0);
  const u0 = v0;
  const v1 = m.getColumn(1);
  const u1 = v1.clone().sub(proj(u0, v1));
  if (n === 2) {
    m.setColumns(v0, v1);
    return;
  }
  const v2 = m.getColumn(2);
  const u2t = v2.clone().sub(proj(u0, v2));
  const u2 = u2t.sub(proj(u1, u2t));
  if (n === 3) {
    m.setColumns(u0, u1, u2);
    // return;
  }
}
function modifiedGramSchmidt (m) {
  const n = m.dimension;

  const v0 = m.getColumn(0);
  const u0 = v0;
  const v1 = m.getColumn(1);
  const u1 = v1.clone().sub(proj(u0, v1));
  if (n === 2) {
    m.setColumns(v0, v1);
    return;
  }
  const v2 = m.getColumn(2);
  const u2t = v2.clone().sub(proj(u0, v2));
  const u2 = u2t.sub(proj(u1, u2t));
  if (n === 3) {
    m.setColumns(u0, u1, u2);
    // return;
  }
}
function modifiedGramSchmidt ( m ) { const n = m . dimension ; const v0 = m . getColumn ( 0 ) ; const u0 = v0 ; const v1 = m . getColumn ( 1 ) ; const u1 = v1 . clone ( ) . sub ( proj ( u0 , v1 ) ) ; if ( n === 2 ) { m . setColumns ( v0 , v1 ) ; return ; } const v2 = m . getColumn ( 2 ) ; const u2t = v2 . clone ( ) . sub ( proj ( u0 , v2 ) ) ; const u2 = u2t . sub ( proj ( u1 , u2t ) ) ; if ( n === 3 ) { m . setColumns ( u0 , u1 , u2 ) ; // return; } }
Orthogonalizes a matrix using the modified Gram-Schmidt algorithm.
@memberof Helpers
@param {Matrix2|Matrix3|Matrix4} m The matrix.
Orthogonalizes a matrix using the modified Gram - Schmidt algorithm .