Multiplication by Factors from a QR Decomposition

DESCRIPTION:
Performs multiplication by any of the factors in a QR decomposition.

USAGE:
facmul.qr.Matrix(x, factor, y, transpose = F, left = T,
                   ncols, full = T, tune)

REQUIRED ARGUMENTS:
x:
an object of class "qr.Matrix".
factor:
either "Q", "R", or "P", where "Q" selects the orthonormal (unitary if complex) factor, "R" selects the triangular factor, and "P selects the column permutation applied to the original matrix in order to obtain the decomposition.

OPTIONAL ARGUMENTS:
y:
a numeric or complex vector or matrix. The default is the identity matrix of the order equal to the number of rows (left = T) or number of columns (left = F) in the matrix underlying x, so that either the factor itself (transpose = F) or its transpose (transpose = T) are returned when y is missing.
transpose:
a logical value telling whether or not to multiply by the (if complex, conjugate) transpose of the factor. The default is multiplication by the factor itself.
left:
a logical value telling whether the multiplication should occur on the left of y or on the right. The default is multiplication on the left.
ncols:
gives the number of leading columns of the matrix underlying x (after pivoting) that are to be included in the orthogonal factor. By default, the largest possible value is used for ncols, which is equal to the minimum dimension of the matrix underlying x.
full:
if the matrix underlying x has row dimension m and column dimension n, with m greater than n, then if full = T, Q is m x m and R is m x n, while if full = F, Q is m by n and R is n x n.
tune:
a integer vector or list of named tuning parameters that may affect computational efficiency when no pivoting is done. The relevant parameters are the blocksize parameters NB, NBMIN, and NX as described in .laenv. The default is to use the settings in .laenv, which in S-Plus is initialized to use an unblocked algorithm (NB = 1), but may be changed by the user.

VALUE:
An object of class "Matrix" corresponding to the desired matrix product.

DETAILS:
Based on the functions dormqr, dorgqr, zungqr, and zunmqr from LAPACK (Anderson et al. 1994).

The orthonormal/unitary factor in an "qr.Matrix" object is stored in a compact form representing elementary transformations whose product give the full factor. This function enables products involving this to be obtained efficiently without its explicit formation.


REFERENCES:
Anderson, E., et al. (1994). LAPACK User's Guide, 2nd edition, SIAM, Philadelphia.

SEE ALSO:
qr.Matrix , expand.qr.Matrix

EXAMPLES:
 x <- Matrix( rnorm(36), nrow = 9, ncol = 4)
 z <- qr(x, pivot = T)                                # QR factorization of x
 max(abs(facmul(z,"Q", facmul(z,"R")) - x[,z$pivot])) # test product of Q and R