powered by
Matrix X decomposed as Q and R (X=QR) where columns of Q are orthonormal. Ordinary QR or SVD may be used.
GenQR(x, doSVD = FALSE, findR = TRUE, makeunique = findR, tol = 1e-07)
Matrix to be decomposed
When TRUE SVD instead of QR
When FALSE only Q returned
When TRUE force uniqueness by positive diagonal elements (QR) or by column sums (SVD)
As input to qr or, in the case of svd(), similar as input to MASS::ginv().
List with Q and R or just Q
To handle dependency a usual decomposition of X is PX=QR where P is a permutation matrix. This function returns RP^T as R. When SVD, Q=U and R=SV^T.
# NOT RUN { GenQR(matrix(rnorm(15),5,3)) GenQR(matrix(rnorm(15),5,3)[,c(1,2,1,3)]) GenQR(matrix(rnorm(15),5,3)[,c(1,2,1,3)],TRUE) # }
Run the code above in your browser using DataLab