code: @Override
      public DMatrixRMaj getR(DMatrixRMaj R, boolean compact) {
          if( R == null ) {
              if( compact ) {
                  R = new DMatrixRMaj(minLength,numCols);
              } else
                  R = new DMatrixRMaj(numRows,numCols);
          } else {
              if( compact ) {
                  R.reshape(minLength,numCols);
              } else {
                  R.reshape(numRows,numCols);
              }
  
              for( int i = 0; i < R.numRows; i++ ) {
                  int min = Math.min(i,R.numCols);
                  for( int j = 0; j < min; j++ ) {
                      R.unsafe_set(i,j,0);
                  }
              }
          }
  
          for( int i = 0; i < R.numRows; i++ ) {
              for( int j = i; j < R.numCols; j++ ) {
                  R.unsafe_set(i,j,QR.unsafe_get(j,i));
              }
          }
  
  
          return R;
      }
docs: Returns an upper triangular matrix which is the R in the QR decomposition.
  
  @param R An upper triangular matrix.
  @param compact