code: function svdJs() {
                  var A = this;
                  var V = Matrix$b.I(A.rows());
                  var S = A.transpose();
                  var U = Matrix$b.I(A.cols());
                  var err = Number.MAX_VALUE;
                  var i = 0;
                  var maxLoop = 100;
  
                  while(err > 2.2737e-13 && i < maxLoop) {
                      var qr = S.transpose().qrJs();
                      S = qr.R;
                      V = V.x(qr.Q);
                      qr = S.transpose().qrJs();
                      U = U.x(qr.Q);
                      S = qr.R;
  
                      var e = S.triu(1).unroll().norm();
                      var f = S.diagonal().norm();
  
                      if(f == 0)
                          f = 1;
  
                      err = e / f;
  
                      i++;
                  }
  
                  var ss = S.diagonal();
                  var s = [];
  
                  for(var i = 1; i <= ss.cols(); i++) {
                      var ssn = ss.e(i);
                      s.push(Math.abs(ssn));
  
                      if(ssn < 0) {
                          for(var j = 0; j < U.rows(); j++) {
                              V.elements[j][i - 1] = -(V.elements[j][i - 1]);
                          }
                      }
                  }
  
                  return {U: U, S: $V(s).toDiagonalMatrix(), V: V};
              }
docs: singular value decomposition in pure javascript