\HeaderA{ddiMatrix-class}{Class "ddiMatrix" of Diagonal Numeric Matrices}{ddiMatrix.Rdash.class}
\keyword{classes}{ddiMatrix-class}
\begin{Description}\relax
The class \code{"ddiMatrix"} of numerical diagonal matrices.
Note that diagonal matrices now extend \emph{\code{sparseMatrix}}, whereas
they did extend dense matrices earlier.
\end{Description}
\begin{Section}{Objects from the Class}
Objects can be created by calls of the form \code{new("ddiMatrix", ...)}
but typically rather via \code{\LinkA{Diagonal}{Diagonal}}.
\end{Section}
\begin{Section}{Slots}
\describe{
\item[\code{x}:] numeric vector.  For an \eqn{n \times n}{}
matrix, the \code{x} slot is of length \eqn{n}{} or \code{0},
depending on the \code{diag} slot:
\item[\code{diag}:] \code{"character"} string, either \code{"U"} or
\code{"N"} where \code{"U"} denotes unit-diagonal, i.e., identity
matrices.
\item[\code{Dim},\code{Dimnames}:] matrix dimension and
\code{\LinkA{dimnames}{dimnames}}, see the \code{\LinkA{Matrix}{Matrix.Rdash.class}} class
description.
}
\end{Section}
\begin{Section}{Extends}
Class \code{"\LinkA{diagonalMatrix}{diagonalMatrix.Rdash.class}"}, directly.
Class \code{"\LinkA{dMatrix}{dMatrix.Rdash.class}"}, directly.
Class \code{"\LinkA{sparseMatrix}{sparseMatrix.Rdash.class}"}, indirectly, see
\code{\LinkA{showClass}{showClass}("ddiMatrix")}.
\end{Section}
\begin{Section}{Methods}
\describe{
\item[\%*\%] \code{signature(x = "ddiMatrix", y = "ddiMatrix")}: ... 
}
\end{Section}
\begin{SeeAlso}\relax
Class \code{\LinkA{diagonalMatrix}{diagonalMatrix.Rdash.class}} and function \code{\LinkA{Diagonal}{Diagonal}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
(d2 <- Diagonal(x = c(10,1)))
str(d2)
## slightly larger in internal size:
str(as(d2, "sparseMatrix"))

M <- Matrix(cbind(1,2:4))
M %*% d2 #> `fast' multiplication

chol(d2) # trivial
stopifnot(is(cd2 <- chol(d2), "ddiMatrix"),
          all.equal(cd2@x, c(sqrt(10),1)))
\end{ExampleCode}
\end{Examples}

