code: function norm(n, X, incx, offx) {
      // Euclidean norm
      // LAPACK: DNRM2
  
      if (n === 0.0) {
        return Math.abs(n);
      }
  
      var scale = 0.0;
      var ssq = 1.0;
      for (var i = 0; i < n; ++i) {
        var xi = X[offx + incx*i];
        if (xi !== 0.0) {
          var absxi = Math.abs(xi);
          if (scale < absxi) {
            var z = scale / absxi;
            ssq = 1.0 + ssq * (z * z);
            scale = absxi;
          } else {
            var z = absxi / scale;
            ssq = ssq + z * z;
          }
        }
      }
      return scale * Math.sqrt(ssq);
    }
docs: Compute the QR factorization of A LAPACK: DGEQR2