[R] GSVD and qr questions
Roy Mendelssohn - NOAA Federal
roy.mendelssohn at noaa.gov
Tue May 5 05:56:22 CEST 2015
Hi All:
I posted some of this earlier to the r-sig-mac because at that time I got a Mac specific error, but now I have a more general question. For a canonical variate analysis (CVA) used in some system identification routines, I need to calculate a generalized svd (GSVD). On the web there are several scripts that are suppose to work with the LAPACK implementation of GSVD, but when I try them with my matrices I get an index error. I can save the two arrays using R.matlab and read the matrices into Matlab, and the GSVD function in Matlab works fine for the same arrays. I get the same error trying to use the GSVD routine in the PEIP package in R.
I have found a Matlab routine that calculates the GSVD using only QR, CHOL and SVD calls, but some of this is outside of what I know and I am trying to translate the routine to R. I have two questions:
1. Does anyone know of a working routine for GSVD in R (and I looked in ‘sos’ that is how I found the one in PEIP)?
2. In the Matlab function I am trying to translate, they call for the QR decomposition of the matrix A as qr(A,0). The second argument (0) according to Matlab does the economy QR decomposition:
> qr(A,0) produces the economy-size decomposition. If m > n, only the first n columns of Q and the first n rows of R are computed. If m<=n, this is the same as [Q,R] = qr(A).
Reading over the help for the”qr” function in R it is unclear that there is a similar way to do an “economy” decomposition with one of the optional arguments. I am probably being brain-dead, but I don’t see how to do that in the R function.
Thanks for any help.
-Roy M.
**********************
"The contents of this message do not reflect any position of the U.S. Government or NOAA."
**********************
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
***Note new address and phone***
110 Shaffer Road
Santa Cruz, CA 95060
Phone: (831)-420-3666
Fax: (831) 420-3980
e-mail: Roy.Mendelssohn at noaa.gov www: http://www.pfeg.noaa.gov/
"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected"
"the arc of the moral universe is long, but it bends toward justice" -MLK Jr.
More information about the R-help
mailing list