code: function qr(A) {
      if (A.shape.length !== 2) {
          throw new Error('Input is not matrix');
      }
      var _a = A.shape, m = _a[0], n = _a[1];
      if (m === 0 || n === 0) {
          throw new Error('Empty matrix');
      }
      var copyA = A.clone();
      var minmn = Math.min(m, n);
      copyA.swapOrder();
      var tau = new common_1.NDArray({ shape: [minmn] });
      lapack.geqrf(copyA.data, m, n, tau.data);
      var r = copyA.clone();
      r.swapOrder();
      r = triu(r.get(':', ':' + minmn));
      var q = copyA.get(':' + n);
      lapack.orgqr(q.data, m, n, minmn, tau.data);
      q.swapOrder();
      return [q, r];
  }
docs: Compute QR decomposition of given Matrix