\HeaderA{sparseQR-class}{Sparse QR decomposition of a sparse matrix}{sparseQR.Rdash.class}
\aliasA{qr.coef,sparseQR,dgeMatrix-method}{sparseQR-class}{qr.coef,sparseQR,dgeMatrix.Rdash.method}
\aliasA{qr.coef,sparseQR,matrix-method}{sparseQR-class}{qr.coef,sparseQR,matrix.Rdash.method}
\aliasA{qr.coef,sparseQR,numeric-method}{sparseQR-class}{qr.coef,sparseQR,numeric.Rdash.method}
\aliasA{qr.fitted,sparseQR,dgeMatrix-method}{sparseQR-class}{qr.fitted,sparseQR,dgeMatrix.Rdash.method}
\aliasA{qr.fitted,sparseQR,matrix-method}{sparseQR-class}{qr.fitted,sparseQR,matrix.Rdash.method}
\aliasA{qr.fitted,sparseQR,numeric-method}{sparseQR-class}{qr.fitted,sparseQR,numeric.Rdash.method}
\aliasA{qr.qty,sparseQR,dgeMatrix-method}{sparseQR-class}{qr.qty,sparseQR,dgeMatrix.Rdash.method}
\aliasA{qr.qty,sparseQR,matrix-method}{sparseQR-class}{qr.qty,sparseQR,matrix.Rdash.method}
\aliasA{qr.qty,sparseQR,numeric-method}{sparseQR-class}{qr.qty,sparseQR,numeric.Rdash.method}
\aliasA{qr.qy,sparseQR,dgeMatrix-method}{sparseQR-class}{qr.qy,sparseQR,dgeMatrix.Rdash.method}
\aliasA{qr.qy,sparseQR,matrix-method}{sparseQR-class}{qr.qy,sparseQR,matrix.Rdash.method}
\aliasA{qr.qy,sparseQR,numeric-method}{sparseQR-class}{qr.qy,sparseQR,numeric.Rdash.method}
\aliasA{qr.R,sparseQR-method}{sparseQR-class}{qr.R,sparseQR.Rdash.method}
\aliasA{qr.resid,sparseQR,dgeMatrix-method}{sparseQR-class}{qr.resid,sparseQR,dgeMatrix.Rdash.method}
\aliasA{qr.resid,sparseQR,matrix-method}{sparseQR-class}{qr.resid,sparseQR,matrix.Rdash.method}
\aliasA{qr.resid,sparseQR,numeric-method}{sparseQR-class}{qr.resid,sparseQR,numeric.Rdash.method}
\aliasA{solve,sparseQR,ANY-method}{sparseQR-class}{solve,sparseQR,ANY.Rdash.method}
\keyword{classes}{sparseQR-class}
\keyword{algebra}{sparseQR-class}
\keyword{array}{sparseQR-class}
\begin{Description}\relax
Objects of this class represent a QR decomposition of a
sparse rectangular matrix.
\end{Description}
\begin{Details}\relax
The decomposition is of the form \code{A[p+1,] == Q \%*\% R}, if
the \code{q} slot if of length 0 or \code{A[p+1,q+1] == Q \%*\% R}
where A is a sparse \eqn{m\times n}{} matrix (\eqn{m\ge n}{}),
\eqn{R}{} is an \eqn{m\times n}{} matrix that is zero below the
main diagonal.  The \code{p} slot is a 0-based permutation of
\code{1:m} applied to the rows of the original matrix.  If the \code{q}
slot has length \code{n} it is a 0-based permutation of \code{1:n}
applied to the columns of the original matrix to reduce the amount
of "fill-in" in the matrix \eqn{R}{}.

The matrix \eqn{Q}{} is a "virtual matrix".  It is the product of
\eqn{n}{} Householder transformations.  The information to generate
these Householder transformations is stored in the \code{V} and
\code{beta} slots.

The \code{"sparseQR"} methods for the \code{qr.*} functions return
objects of class \code{"dgeMatrix"} (see
\code{\LinkA{dgeMatrix}{dgeMatrix.Rdash.class}}).  Results from \code{qr.coef},
\code{qr.resid} and \code{qr.fitted} (when \code{k == ncol(R)}) are
well-defined and should match those from the corresponding dense matrix
calculations.  However, because the matrix \code{Q} is not uniquely
defined, the results of \code{qr.qy} and \code{qr.qty} do not
necessarily match those from the corresponding dense matrix
calculations.

Also, the results of \code{qr.qy} and \code{qr.qty} apply to the
permuted column order when the \code{q}  slot has length \code{n}.
\end{Details}
\begin{Section}{Objects from the Class}
Objects can be created by calls of the form \code{new("sparseQR", ...)}
but are more commonly created by function \code{\LinkA{qr}{qr}} applied
to a sparse matrix such as a matrix of class
\code{\LinkA{dgCMatrix}{dgCMatrix.Rdash.class}}.
\end{Section}
\begin{Section}{Slots}
\describe{
\item[\code{V}:] Object of class \code{"dgCMatrix"}.  The columns of
\code{V} are the vectors that generate the Householder
transformations of which the matrix Q is composed.
\item[\code{beta}:] Object of class \code{"numeric"}, the normalizing
factors for the Householder transformations.
\item[\code{p}:] Object of class \code{"integer"}: Permutation
(of \code{0:(n-1)}) applied to the rows of the original matrix.
\item[\code{R}:] Object of class \code{"dgCMatrix"} An upper
triangular matrix of dimension \  
\item[\code{q}:] Object of class \code{"integer"}: Permutation
applied from the right. Can be of length 0 which implies no
permutation.
}
\end{Section}
\begin{Section}{Methods}
\describe{
\item[qr.R] \code{signature(qr = "sparseQR")}: ... 
\item[qr.coef] \code{signature(qr = "sparseQR", y = "dgeMatrix")}: ... 
\item[qr.coef] \code{signature(qr = "sparseQR", y = "matrix")}: ... 
\item[qr.coef] \code{signature(qr = "sparseQR", y = "numeric")}: ... 
\item[qr.fitted] \code{signature(qr = "sparseQR", y = "dgeMatrix")}: ... 
\item[qr.fitted] \code{signature(qr = "sparseQR", y = "matrix")}: ... 
\item[qr.fitted] \code{signature(qr = "sparseQR", y = "numeric")}: ... 
\item[qr.qty] \code{signature(qr = "sparseQR", y = "dgeMatrix")}: ... 
\item[qr.qty] \code{signature(qr = "sparseQR", y = "matrix")}: ... 
\item[qr.qty] \code{signature(qr = "sparseQR", y = "numeric")}: ... 
\item[qr.qy] \code{signature(qr = "sparseQR", y = "dgeMatrix")}: ... 
\item[qr.qy] \code{signature(qr = "sparseQR", y = "matrix")}: ... 
\item[qr.qy] \code{signature(qr = "sparseQR", y = "numeric")}: ... 
\item[qr.resid] \code{signature(qr = "sparseQR", y = "dgeMatrix")}: ... 
\item[qr.resid] \code{signature(qr = "sparseQR", y = "matrix")}: ... 
\item[qr.resid] \code{signature(qr = "sparseQR", y = "numeric")}: ... 

\item[solve] \code{signature(a = "sparseQR", b = "ANY")}: simply
uses \code{qr.coef(a,b)}.
}
\end{Section}
\begin{SeeAlso}\relax
\code{\LinkA{qr}{qr}}, \code{\LinkA{qr.Q}{qr.Q}},
\code{\LinkA{qr.R}{qr.R}}, \code{\LinkA{qr.fitted}{qr.fitted}},
\code{\LinkA{qr.resid}{qr.resid}}, \code{\LinkA{qr.coef}{qr.coef}},
\code{\LinkA{qr.qty}{qr.qty}}, \code{\LinkA{qr.qy}{qr.qy}},
\code{\LinkA{dgCMatrix}{dgCMatrix.Rdash.class}}, \code{\LinkA{dgeMatrix}{dgeMatrix.Rdash.class}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
data(KNex); mm <- KNex$mm
str(mmQR <- qr(mm))
\end{ExampleCode}
\end{Examples}

