\HeaderA{dgTMatrix-class}{Sparse matrices in triplet form}{dgTMatrix.Rdash.class}
\aliasA{+,dgTMatrix,dgTMatrix-method}{dgTMatrix-class}{+,dgTMatrix,dgTMatrix.Rdash.method}
\aliasA{coerce,dgeMatrix,dgTMatrix-method}{dgTMatrix-class}{coerce,dgeMatrix,dgTMatrix.Rdash.method}
\aliasA{coerce,dgTMatrix,dgCMatrix-method}{dgTMatrix-class}{coerce,dgTMatrix,dgCMatrix.Rdash.method}
\aliasA{coerce,dgTMatrix,dgeMatrix-method}{dgTMatrix-class}{coerce,dgTMatrix,dgeMatrix.Rdash.method}
\aliasA{coerce,dgTMatrix,dsTMatrix-method}{dgTMatrix-class}{coerce,dgTMatrix,dsTMatrix.Rdash.method}
\aliasA{coerce,dgTMatrix,dtCMatrix-method}{dgTMatrix-class}{coerce,dgTMatrix,dtCMatrix.Rdash.method}
\aliasA{coerce,dgTMatrix,dtTMatrix-method}{dgTMatrix-class}{coerce,dgTMatrix,dtTMatrix.Rdash.method}
\aliasA{coerce,dgTMatrix,matrix-method}{dgTMatrix-class}{coerce,dgTMatrix,matrix.Rdash.method}
\aliasA{coerce,dgTMatrix,triangularMatrix-method}{dgTMatrix-class}{coerce,dgTMatrix,triangularMatrix.Rdash.method}
\aliasA{coerce,matrix,dgTMatrix-method}{dgTMatrix-class}{coerce,matrix,dgTMatrix.Rdash.method}
\aliasA{crossprod,dgTMatrix,matrix-method}{dgTMatrix-class}{crossprod,dgTMatrix,matrix.Rdash.method}
\aliasA{crossprod,dgTMatrix,missing-method}{dgTMatrix-class}{crossprod,dgTMatrix,missing.Rdash.method}
\aliasA{crossprod,dgTMatrix,numeric-method}{dgTMatrix-class}{crossprod,dgTMatrix,numeric.Rdash.method}
\keyword{classes}{dgTMatrix-class}
\keyword{algebra}{dgTMatrix-class}
\begin{Description}\relax
The \code{"dgTMatrix"} class is the class of sparse
matrices stored as (possibly redundant) triplets.  The internal
representation is not at all unique, contrary to the one for class
\code{\LinkA{dgCMatrix}{dgCMatrix.Rdash.class}}.
\end{Description}
\begin{Section}{Objects from the Class}
Objects can be created by calls of the form \code{new("dgTMatrix",
    ...)}, but more typically via \code{as(*, "dgTMatrix")}.
\end{Section}
\begin{Section}{Slots}
\describe{
\item[\code{i}:] Object of class \code{"integer"} - the row indices
of non-zero entries \emph{in 0-base}, i.e., must be in
\code{0:(nrow(.)-1)}.
\item[\code{j}:] Object of class \code{"integer"} - the column
indices of non-zero entries.  Must be the same length as slot
\code{i} and \emph{0-based} as well, i.e., in \code{0:(ncol(.)-1)}.
\item[\code{x}:] Object of class \code{"numeric"} - the (non-zero)
entry at position \code{(i,j)}.  Must be the same length as slot
\code{i}. If an index pair occurs more than once the corresponding
values of slot \code{x} are added to form the element of the matrix.
\item[\code{Dim}:] Object of class \code{"integer"} of length 2 -
the dimensions of the matrix.
}
\end{Section}
\begin{Section}{Methods}
\describe{
\item[+] \code{signature(e1 = "dgTMatrix", e2 = "dgTMatrix")}
\item[coerce] \code{signature(from = "dgTMatrix", to = "dgCMatrix")}
\item[coerce] \code{signature(from = "dgTMatrix", to = "dgeMatrix")}
\item[coerce] \code{signature(from = "dgTMatrix", to = "matrix")},
and typically coercion methods for more specific signatures, we
are not mentioning here.

Note that these are not guaranteed to continue to exist,
but rather you should use calls like \code{as(x,
        "CsparseMatrix")}, \code{as(x, "generalMatrix")},
\code{as(x, "dMatrix")}, i.e. coercion to higher level virtual classes.
\item[coerce] \code{signature(from = "matrix", to = "dgTMatrix")},
(direct coercion from tradition matrix).

\item[crossprod] \code{signature(x = "dgTMatrix", y = "missing")}
returns \code{t(x) \%*\% x} as an \code{dsCMatrix} object.
\item[crossprod] \code{signature(x = "dgTMatrix", y = "matrix")}: ... 
\item[crossprod] \code{signature(x = "dgTMatrix", y = "numeric")}: ... 
\item[image] \code{signature(x = "dgTMatrix")}: plots an image of
\code{x} using the \code{\LinkA{levelplot}{levelplot}} function
\item[t] \code{signature(x = "dgTMatrix")}: returns the transpose of
\code{x}
}
\end{Section}
\begin{Note}\relax
Triplet matrices are a convenient form in which to construct sparse
matrices after which they can be coerced to
\code{\LinkA{dgCMatrix}{dgCMatrix.Rdash.class}} objects.
\end{Note}
\begin{SeeAlso}\relax
Class \code{\LinkA{dgCMatrix}{dgCMatrix.Rdash.class}} or the superclasses
\code{\LinkA{dsparseMatrix}{dsparseMatrix.Rdash.class}} and
\code{\LinkA{TsparseMatrix}{TsparseMatrix.Rdash.class}};
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
m <- Matrix(0+1:28, nrow = 4)
m[-3,c(2,4:5,7)] <- m[ 3, 1:4] <- m[1:3, 6] <- 0
(mT <- as(m, "dgTMatrix"))
str(mT)
mT[1,]
mT[4, drop = FALSE]
stopifnot(identical(mT[lower.tri(mT)],
                    m [lower.tri(m) ]))
mT[lower.tri(mT,diag=TRUE)] <- 0
mT
\end{ExampleCode}
\end{Examples}

