Learn R Programming

RegSDC (version 1.0.0)

GenQR: Generalized QR decomposition

Description

Matrix X decomposed as Q and R (X=QR) where columns of Q are orthonormal. Ordinary QR or SVD may be used.

Usage

GenQR(x, doSVD = FALSE, findR = TRUE, makeunique = findR, tol = 1e-07)

Value

List with Q and R or just Q

Arguments

x

Matrix to be decomposed

doSVD

When TRUE SVD instead of QR

findR

When FALSE only Q returned

makeunique

When TRUE force uniqueness by positive diagonal elements (QR) or by column sums (SVD)

tol

As input to qr or, in the case of svd(), similar as input to MASS::ginv().

Author

Øyvind Langsrud

Details

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.

Examples

Run this code
   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