\HeaderA{Cholesky-class}{Cholesky and Bunch-Kaufman Decompositions}{Cholesky.Rdash.class}
\aliasA{BunchKaufman-class}{Cholesky-class}{BunchKaufman.Rdash.class}
\aliasA{coerce,BunchKaufman,lMatrix-method}{Cholesky-class}{coerce,BunchKaufman,lMatrix.Rdash.method}
\aliasA{coerce,Cholesky,lMatrix-method}{Cholesky-class}{coerce,Cholesky,lMatrix.Rdash.method}
\aliasA{coerce,pBunchKaufman,lMatrix-method}{Cholesky-class}{coerce,pBunchKaufman,lMatrix.Rdash.method}
\aliasA{coerce,pCholesky,lMatrix-method}{Cholesky-class}{coerce,pCholesky,lMatrix.Rdash.method}
\aliasA{pBunchKaufman-class}{Cholesky-class}{pBunchKaufman.Rdash.class}
\aliasA{pCholesky-class}{Cholesky-class}{pCholesky.Rdash.class}
\aliasA{show,BunchKaufman-method}{Cholesky-class}{show,BunchKaufman.Rdash.method}
\aliasA{show,pBunchKaufman-method}{Cholesky-class}{show,pBunchKaufman.Rdash.method}
\keyword{classes}{Cholesky-class}
\keyword{algebra}{Cholesky-class}
\begin{Description}\relax
The \code{"Cholesky"} class is the class of Cholesky
decompositions of positive-semidefinite, real dense matrices.  The
\code{"BunchKaufman"} class is the class of Bunch-Kaufman
decompositions of symmetric, real matrices.  The \code{"pCholesky"}
and \code{"pBunchKaufman"} classes are their \emph{\bold{p}acked}
storage versions.
\end{Description}
\begin{Section}{Objects from the Class}
Objects can be created by calls of the form \code{new("Cholesky",
    ...)} or \code{new("BunchKaufman", ...)}, etc,
or rather by calls of the form \code{\LinkA{chol}{chol}(pm)} or
\code{\LinkA{BunchKaufman}{BunchKaufman}(pm)} where \code{pm} inherits from
the \code{"\LinkA{dpoMatrix}{dpoMatrix.Rdash.class}"} or \code{"\LinkA{dsyMatrix}{dsyMatrix.Rdash.class}"}
class or as a side-effect of other functions
applied to \code{"dpoMatrix"} objects (see \code{\LinkA{dpoMatrix}{dpoMatrix.Rdash.class}}).
\end{Section}
\begin{Section}{Slots}
A Cholesky decomposition extends class
\code{\LinkA{MatrixFactorization}{MatrixFactorization.Rdash.class}} but is basically a triangular
matrix extending the \code{"\LinkA{dtrMatrix}{dtrMatrix.Rdash.class}"} class.
\describe{
\item[\code{uplo}:] inherited from the \code{"dtrMatrix"} class.
\item[\code{diag}:] inherited from the \code{"dtrMatrix"} class.
\item[\code{x}:] inherited from the \code{"dtrMatrix"} class.
\item[\code{Dim}:] inherited from the \code{"dtrMatrix"} class.
\item[\code{Dimnames}:] inherited from the \code{"dtrMatrix"} class.
}
A Bunch-Kaufman decomposition also extends the \code{"dtrMatrix"}
class and has a \code{perm} slot representing a permutation matrix.
The packed versions extend the \code{"dtpMatrix"} class.
\end{Section}
\begin{Section}{Extends}
Class \code{"MatrixFactorization"} and \code{"dtrMatrix"}, directly.
Class \code{"dgeMatrix"}, by class \code{"dtrMatrix"}.
Class \code{"Matrix"}, by class \code{"dtrMatrix"}.
\end{Section}
\begin{Section}{Methods}
There are currently no methods defined with class "Cholesky" in the
signature.  Of course methods for \code{"dtrMatrix"} or
\code{"MatrixFactorization"} do apply.
\end{Section}
\begin{Note}\relax
\Enumerate{
\item Objects of class \code{"Cholesky"} typically stem from
\code{\LinkA{chol}{chol}(D)}, applied to a \emph{dense} matrix \code{D}.

On the other hand, the \emph{function} \code{\LinkA{Cholesky}{Cholesky}(S)}
applies to a \emph{sparse} matrix \code{S}, and results in objects
inheriting from class \code{\LinkA{CHMfactor}{CHMfactor.Rdash.class}}.

\item For traditional matrices \code{m}, \code{chol(m)} is a
traditional matrix as well, triangular, but simply an \eqn{n\times
n}{} numeric \code{\LinkA{matrix}{matrix}}.  Hence, for compatibility,
the \code{"Cholesky"} and \code{"BunchKaufman"} classes (and their
\code{"p*"} packed versions) also extend triangular Matrix classes
(such as "dtrMatrix").

Consequently, \code{\LinkA{determinant}{determinant}(R)} for \code{R <- chol(A)}
returns the determinant of \code{R}, not of \code{A}.  This is in
contrast to class \code{\LinkA{CHMfactor}{CHMfactor.Rdash.class}} objects \code{C}, where
\code{determinant(C)} gives the determinant of the \emph{original}
matrix \code{A}, for \code{C <- Cholesky(A)}, see also the
\code{determinant} method documentation on the class
\code{\LinkA{CHMfactor}{CHMfactor.Rdash.class}} page.
}
\end{Note}
\begin{SeeAlso}\relax
Classes \code{\LinkA{dtrMatrix}{dtrMatrix.Rdash.class}}, \code{\LinkA{dpoMatrix}{dpoMatrix.Rdash.class}};
function \code{\LinkA{chol}{chol}}.

Function \code{\LinkA{Cholesky}{Cholesky}} resulting in class
\code{\LinkA{CHMfactor}{CHMfactor.Rdash.class}} objects, \emph{not} class "Cholesky"
ones, see the section \sQuote{Note}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
(sm <- as(as(Matrix(diag(5) + 1), "dsyMatrix"), "dspMatrix"))
signif(csm <- chol(sm), 4)

(pm <- crossprod(Matrix(rnorm(18), nrow = 6, ncol = 3)))
(ch <- chol(pm))
if (toupper(ch@uplo) == "U") # which is TRUE
   crossprod(ch)
stopifnot(all.equal(as(crossprod(ch), "matrix"),
                    as(pm, "matrix"), tol=1e-14))
\end{ExampleCode}
\end{Examples}

