\HeaderA{chol2inv}{Inverse from Choleski (or QR) Decomposition}{chol2inv}
\keyword{algebra}{chol2inv}
\keyword{array}{chol2inv}
\begin{Description}\relax
Invert a symmetric, positive definite square matrix from its Choleski
decomposition.  Equivalently, compute \eqn{(X'X)^{-1}}{(X'X)^(-1)}
from the (\eqn{R}{} part) of the QR decomposition of \eqn{X}{}.
\end{Description}
\begin{Usage}
\begin{verbatim}
chol2inv(x, size = NCOL(x), LINPACK = FALSE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] a matrix.  The first \code{size} columns of the upper triangle
contain the Choleski decomposition of the matrix to be inverted.
\item[\code{size}] the number of columns of \code{x} containing the
Choleski decomposition.
\item[\code{LINPACK}] logical.  Should LINPACK be used (for compatibility with
\R{} < 1.7.0)?
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This is an interface to the LAPACK routine DPOTRI and the LINPACK
routine DPODI.
\end{Details}
\begin{Value}
The inverse of the matrix whose Choleski decomposition was given.
\end{Value}
\begin{References}\relax
Dongarra, J. J., Bunch, J. R., Moler, C. B. and Stewart, G. W. (1978)
\emph{LINPACK Users Guide}.
Philadelphia: SIAM Publications.

Anderson. E. and ten others (1999)
\emph{LAPACK Users' Guide}. Third Edition.
SIAM.
Available on-line at
\url{http://www.netlib.org/lapack/lug/lapack_lug.html}.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{chol}{chol}}, \code{\LinkA{solve}{solve}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
cma <- chol(ma  <- cbind(1, 1:3, c(1,3,7)))
ma %*% chol2inv(cma)
\end{ExampleCode}
\end{Examples}

