I guess you could achieve the rq-decompostion like this:

## Transpose and permute
pt <- function(A){n <- nrow(A);t(A)[n:1,n:1]}

## pt(A)=QR  ==>  A=pt(R)pt(Q)
rq <- function(A){
  qr <- qr(pt(A))
  list(Q=pt(qr.Q(qr)),R=pt(qr.R(qr)))
}

## Test it
A <- matrix(rnorm(25),5)
Q <- rq(A)$Q
R <- rq(A)$R
range(R%*%Q-A)

Best regards
Kasper Kristensen

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to