code: function() {
      var M = this.dup(), els;
      var n = this.elements.length, k = n, i, np, kp = this.elements[0].length, p;
      do { i = k - n;
        if (M.elements[i][i] == 0) {
          for (j = i + 1; j < k; j++) {
            if (M.elements[j][i] != 0) {
              els = []; np = kp;
              do { p = kp - np;
                els.push(M.elements[i][p] + M.elements[j][p]);
              } while (--np);
              M.elements[i] = els;
              break;
            }
          }
        }
        if (M.elements[i][i] != 0) {
          for (j = i + 1; j < k; j++) {
            var multiplier = M.elements[j][i] / M.elements[i][i];
            els = []; np = kp;
            do { p = kp - np;
              // Elements with column numbers up to an including the number
              // of the row that we're subtracting can safely be set straight to
              // zero, since that's the point of this routine and it avoids having
              // to loop over and correct rounding errors later
              els.push(p <= i ? 0 : M.elements[j][p] - M.elements[i][p] * multiplier);
            } while (--np);
            M.elements[j] = els;
          }
        }
      } while (--n);
      return M;
    }
docs: Make the matrix upper (right) triangular by Gaussian elimination. This method only adds multiples of rows to other rows. No rows are scaled up or switched, and the determinant is preserved.