I specifically need rq matrix decomposition (and not qr). Looking at netlib site for LAPACK it does provide rq whereas LINPACK not. Looking at companion qr in R I see how in base it wraps with a .Call but I do not have success in doing that for a similar .Call for rq. Anyone done this or can provide matrix rewrites that allow me to do the rq decomposition with existing R funcs? Regards MJ
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
Mads Jeppe Tarp-Johansen
2007-Nov-20 11:48 UTC
[R] match.call idiom to call other function with same arguments
The R language definition (version 2.5.1, 2007-06-27, p37) outlines an idiom (here perhaps abusively abbreviated) m <- match.call() m[[1]] <- as.name('plot') eval(m, parent.frame() ) A posting (Subject: "Re: [Rd] problems with plot.formula", Date: Wed 26 May 2004 - 05:44:34 EST, From: Prof Brian Ripley (ripley at stats.ox.ac.uk)) related to plot.formula reads not a standard idiom for a generic with a formula method Could someone kindly direct my attention to a tutorial/howto/intro or other written material that provides insight on how this idiom (and preferably other R-idioms) should be used and not used? If the answer is that there is no such other material, so the solution is "go read the language definition again, go think again and go (hopefully) figure" that would be appreciated too. Thanks, MJ