\HeaderA{nsparseMatrix-classes}{Sparse "pattern" Matrices}{nsparseMatrix.Rdash.classes}
\aliasA{"!,nsparseMatrix-method}{nsparseMatrix-classes}{"!,nsparseMatrix.Rdash.method}
\aliasA{-,nsparseMatrix,missing-method}{nsparseMatrix-classes}{.Rdash.,nsparseMatrix,missing.Rdash.method}
\aliasA{all,nsparseMatrix-method}{nsparseMatrix-classes}{all,nsparseMatrix.Rdash.method}
\aliasA{any,nsparseMatrix-method}{nsparseMatrix-classes}{any,nsparseMatrix.Rdash.method}
\aliasA{Arith,Matrix,nsparseMatrix-method}{nsparseMatrix-classes}{Arith,Matrix,nsparseMatrix.Rdash.method}
\aliasA{Arith,nsparseMatrix,Matrix-method}{nsparseMatrix-classes}{Arith,nsparseMatrix,Matrix.Rdash.method}
\aliasA{coerce,matrix,ngCMatrix-method}{nsparseMatrix-classes}{coerce,matrix,ngCMatrix.Rdash.method}
\aliasA{coerce,matrix,ngTMatrix-method}{nsparseMatrix-classes}{coerce,matrix,ngTMatrix.Rdash.method}
\aliasA{coerce,matrix,ntCMatrix-method}{nsparseMatrix-classes}{coerce,matrix,ntCMatrix.Rdash.method}
\aliasA{coerce,matrix,ntTMatrix-method}{nsparseMatrix-classes}{coerce,matrix,ntTMatrix.Rdash.method}
\aliasA{coerce,ngCMatrix,dgCMatrix-method}{nsparseMatrix-classes}{coerce,ngCMatrix,dgCMatrix.Rdash.method}
\aliasA{coerce,ngCMatrix,dMatrix-method}{nsparseMatrix-classes}{coerce,ngCMatrix,dMatrix.Rdash.method}
\aliasA{coerce,ngCMatrix,dsparseMatrix-method}{nsparseMatrix-classes}{coerce,ngCMatrix,dsparseMatrix.Rdash.method}
\aliasA{coerce,ngCMatrix,lgCMatrix-method}{nsparseMatrix-classes}{coerce,ngCMatrix,lgCMatrix.Rdash.method}
\aliasA{coerce,ngCMatrix,lMatrix-method}{nsparseMatrix-classes}{coerce,ngCMatrix,lMatrix.Rdash.method}
\aliasA{coerce,ngCMatrix,lsparseMatrix-method}{nsparseMatrix-classes}{coerce,ngCMatrix,lsparseMatrix.Rdash.method}
\aliasA{coerce,ngCMatrix,matrix-method}{nsparseMatrix-classes}{coerce,ngCMatrix,matrix.Rdash.method}
\aliasA{coerce,ngCMatrix,ngeMatrix-method}{nsparseMatrix-classes}{coerce,ngCMatrix,ngeMatrix.Rdash.method}
\aliasA{coerce,ngCMatrix,ngTMatrix-method}{nsparseMatrix-classes}{coerce,ngCMatrix,ngTMatrix.Rdash.method}
\aliasA{coerce,ngCMatrix,ntCMatrix-method}{nsparseMatrix-classes}{coerce,ngCMatrix,ntCMatrix.Rdash.method}
\aliasA{coerce,ngTMatrix,dgTMatrix-method}{nsparseMatrix-classes}{coerce,ngTMatrix,dgTMatrix.Rdash.method}
\aliasA{coerce,ngTMatrix,dMatrix-method}{nsparseMatrix-classes}{coerce,ngTMatrix,dMatrix.Rdash.method}
\aliasA{coerce,ngTMatrix,dsparseMatrix-method}{nsparseMatrix-classes}{coerce,ngTMatrix,dsparseMatrix.Rdash.method}
\aliasA{coerce,ngTMatrix,generalMatrix-method}{nsparseMatrix-classes}{coerce,ngTMatrix,generalMatrix.Rdash.method}
\aliasA{coerce,ngTMatrix,lgeMatrix-method}{nsparseMatrix-classes}{coerce,ngTMatrix,lgeMatrix.Rdash.method}
\aliasA{coerce,ngTMatrix,lgTMatrix-method}{nsparseMatrix-classes}{coerce,ngTMatrix,lgTMatrix.Rdash.method}
\aliasA{coerce,ngTMatrix,lMatrix-method}{nsparseMatrix-classes}{coerce,ngTMatrix,lMatrix.Rdash.method}
\aliasA{coerce,ngTMatrix,matrix-method}{nsparseMatrix-classes}{coerce,ngTMatrix,matrix.Rdash.method}
\aliasA{coerce,ngTMatrix,ngCMatrix-method}{nsparseMatrix-classes}{coerce,ngTMatrix,ngCMatrix.Rdash.method}
\aliasA{coerce,ngTMatrix,ngeMatrix-method}{nsparseMatrix-classes}{coerce,ngTMatrix,ngeMatrix.Rdash.method}
\aliasA{coerce,ngTMatrix,ntTMatrix-method}{nsparseMatrix-classes}{coerce,ngTMatrix,ntTMatrix.Rdash.method}
\aliasA{coerce,ngTMatrix,triangularMatrix-method}{nsparseMatrix-classes}{coerce,ngTMatrix,triangularMatrix.Rdash.method}
\aliasA{coerce,nsCMatrix,dMatrix-method}{nsparseMatrix-classes}{coerce,nsCMatrix,dMatrix.Rdash.method}
\aliasA{coerce,nsCMatrix,dsCMatrix-method}{nsparseMatrix-classes}{coerce,nsCMatrix,dsCMatrix.Rdash.method}
\aliasA{coerce,nsCMatrix,dsparseMatrix-method}{nsparseMatrix-classes}{coerce,nsCMatrix,dsparseMatrix.Rdash.method}
\aliasA{coerce,nsCMatrix,generalMatrix-method}{nsparseMatrix-classes}{coerce,nsCMatrix,generalMatrix.Rdash.method}
\aliasA{coerce,nsCMatrix,lMatrix-method}{nsparseMatrix-classes}{coerce,nsCMatrix,lMatrix.Rdash.method}
\aliasA{coerce,nsCMatrix,lsCMatrix-method}{nsparseMatrix-classes}{coerce,nsCMatrix,lsCMatrix.Rdash.method}
\aliasA{coerce,nsCMatrix,lsparseMatrix-method}{nsparseMatrix-classes}{coerce,nsCMatrix,lsparseMatrix.Rdash.method}
\aliasA{coerce,nsCMatrix,matrix-method}{nsparseMatrix-classes}{coerce,nsCMatrix,matrix.Rdash.method}
\aliasA{coerce,nsCMatrix,ngCMatrix-method}{nsparseMatrix-classes}{coerce,nsCMatrix,ngCMatrix.Rdash.method}
\aliasA{coerce,nsCMatrix,nsTMatrix-method}{nsparseMatrix-classes}{coerce,nsCMatrix,nsTMatrix.Rdash.method}
\aliasA{coerce,nsparseMatrix,dsparseMatrix-method}{nsparseMatrix-classes}{coerce,nsparseMatrix,dsparseMatrix.Rdash.method}
\aliasA{coerce,nsTMatrix,dsTMatrix-method}{nsparseMatrix-classes}{coerce,nsTMatrix,dsTMatrix.Rdash.method}
\aliasA{coerce,nsTMatrix,matrix-method}{nsparseMatrix-classes}{coerce,nsTMatrix,matrix.Rdash.method}
\aliasA{coerce,nsTMatrix,ngCMatrix-method}{nsparseMatrix-classes}{coerce,nsTMatrix,ngCMatrix.Rdash.method}
\aliasA{coerce,nsTMatrix,ngTMatrix-method}{nsparseMatrix-classes}{coerce,nsTMatrix,ngTMatrix.Rdash.method}
\aliasA{coerce,nsTMatrix,nsCMatrix-method}{nsparseMatrix-classes}{coerce,nsTMatrix,nsCMatrix.Rdash.method}
\aliasA{coerce,nsTMatrix,nsyMatrix-method}{nsparseMatrix-classes}{coerce,nsTMatrix,nsyMatrix.Rdash.method}
\aliasA{coerce,ntCMatrix,dMatrix-method}{nsparseMatrix-classes}{coerce,ntCMatrix,dMatrix.Rdash.method}
\aliasA{coerce,ntCMatrix,dsparseMatrix-method}{nsparseMatrix-classes}{coerce,ntCMatrix,dsparseMatrix.Rdash.method}
\aliasA{coerce,ntCMatrix,dtCMatrix-method}{nsparseMatrix-classes}{coerce,ntCMatrix,dtCMatrix.Rdash.method}
\aliasA{coerce,ntCMatrix,lMatrix-method}{nsparseMatrix-classes}{coerce,ntCMatrix,lMatrix.Rdash.method}
\aliasA{coerce,ntCMatrix,lsparseMatrix-method}{nsparseMatrix-classes}{coerce,ntCMatrix,lsparseMatrix.Rdash.method}
\aliasA{coerce,ntCMatrix,ltCMatrix-method}{nsparseMatrix-classes}{coerce,ntCMatrix,ltCMatrix.Rdash.method}
\aliasA{coerce,ntCMatrix,matrix-method}{nsparseMatrix-classes}{coerce,ntCMatrix,matrix.Rdash.method}
\aliasA{coerce,ntCMatrix,ngCMatrix-method}{nsparseMatrix-classes}{coerce,ntCMatrix,ngCMatrix.Rdash.method}
\aliasA{coerce,ntCMatrix,TsparseMatrix-method}{nsparseMatrix-classes}{coerce,ntCMatrix,TsparseMatrix.Rdash.method}
\aliasA{coerce,ntTMatrix,dtTMatrix-method}{nsparseMatrix-classes}{coerce,ntTMatrix,dtTMatrix.Rdash.method}
\aliasA{coerce,ntTMatrix,generalMatrix-method}{nsparseMatrix-classes}{coerce,ntTMatrix,generalMatrix.Rdash.method}
\aliasA{coerce,ntTMatrix,matrix-method}{nsparseMatrix-classes}{coerce,ntTMatrix,matrix.Rdash.method}
\aliasA{coerce,ntTMatrix,ngCMatrix-method}{nsparseMatrix-classes}{coerce,ntTMatrix,ngCMatrix.Rdash.method}
\aliasA{coerce,ntTMatrix,ngTMatrix-method}{nsparseMatrix-classes}{coerce,ntTMatrix,ngTMatrix.Rdash.method}
\aliasA{coerce,ntTMatrix,ntCMatrix-method}{nsparseMatrix-classes}{coerce,ntTMatrix,ntCMatrix.Rdash.method}
\aliasA{coerce,ntTMatrix,ntrMatrix-method}{nsparseMatrix-classes}{coerce,ntTMatrix,ntrMatrix.Rdash.method}
\aliasA{crossprod,ndenseMatrix,nsparseMatrix-method}{nsparseMatrix-classes}{crossprod,ndenseMatrix,nsparseMatrix.Rdash.method}
\aliasA{crossprod,ngCMatrix,missing-method}{nsparseMatrix-classes}{crossprod,ngCMatrix,missing.Rdash.method}
\aliasA{crossprod,ngTMatrix,missing-method}{nsparseMatrix-classes}{crossprod,ngTMatrix,missing.Rdash.method}
\aliasA{crossprod,nsparseMatrix,missing-method}{nsparseMatrix-classes}{crossprod,nsparseMatrix,missing.Rdash.method}
\aliasA{crossprod,nsparseMatrix,ndenseMatrix-method}{nsparseMatrix-classes}{crossprod,nsparseMatrix,ndenseMatrix.Rdash.method}
\aliasA{crossprod,nsparseMatrix,nsparseMatrix-method}{nsparseMatrix-classes}{crossprod,nsparseMatrix,nsparseMatrix.Rdash.method}
\aliasA{crossprod,nsparseMatrix-method}{nsparseMatrix-classes}{crossprod,nsparseMatrix.Rdash.method}
\aliasA{is.na,nsparseMatrix-method}{nsparseMatrix-classes}{is.na,nsparseMatrix.Rdash.method}
\aliasA{ngCMatrix-class}{nsparseMatrix-classes}{ngCMatrix.Rdash.class}
\aliasA{ngRMatrix-class}{nsparseMatrix-classes}{ngRMatrix.Rdash.class}
\aliasA{ngTMatrix-class}{nsparseMatrix-classes}{ngTMatrix.Rdash.class}
\aliasA{nsCMatrix-class}{nsparseMatrix-classes}{nsCMatrix.Rdash.class}
\aliasA{nsparseMatrix-class}{nsparseMatrix-classes}{nsparseMatrix.Rdash.class}
\aliasA{nsRMatrix-class}{nsparseMatrix-classes}{nsRMatrix.Rdash.class}
\aliasA{nsTMatrix-class}{nsparseMatrix-classes}{nsTMatrix.Rdash.class}
\aliasA{ntCMatrix-class}{nsparseMatrix-classes}{ntCMatrix.Rdash.class}
\aliasA{ntRMatrix-class}{nsparseMatrix-classes}{ntRMatrix.Rdash.class}
\aliasA{ntTMatrix-class}{nsparseMatrix-classes}{ntTMatrix.Rdash.class}
\aliasA{Ops,dsparseMatrix,nsparseMatrix-method}{nsparseMatrix-classes}{Ops,dsparseMatrix,nsparseMatrix.Rdash.method}
\aliasA{Ops,lsparseMatrix,nsparseMatrix-method}{nsparseMatrix-classes}{Ops,lsparseMatrix,nsparseMatrix.Rdash.method}
\aliasA{Ops,nsparseMatrix,dsparseMatrix-method}{nsparseMatrix-classes}{Ops,nsparseMatrix,dsparseMatrix.Rdash.method}
\aliasA{Ops,nsparseMatrix,lsparseMatrix-method}{nsparseMatrix-classes}{Ops,nsparseMatrix,lsparseMatrix.Rdash.method}
\aliasA{Ops,nsparseMatrix,sparseMatrix-method}{nsparseMatrix-classes}{Ops,nsparseMatrix,sparseMatrix.Rdash.method}
\aliasA{Ops,sparseMatrix,nsparseMatrix-method}{nsparseMatrix-classes}{Ops,sparseMatrix,nsparseMatrix.Rdash.method}
\aliasA{t,ngCMatrix-method}{nsparseMatrix-classes}{t,ngCMatrix.Rdash.method}
\aliasA{t,ngTMatrix-method}{nsparseMatrix-classes}{t,ngTMatrix.Rdash.method}
\aliasA{t,nsCMatrix-method}{nsparseMatrix-classes}{t,nsCMatrix.Rdash.method}
\aliasA{t,nsTMatrix-method}{nsparseMatrix-classes}{t,nsTMatrix.Rdash.method}
\aliasA{t,ntCMatrix-method}{nsparseMatrix-classes}{t,ntCMatrix.Rdash.method}
\aliasA{t,ntTMatrix-method}{nsparseMatrix-classes}{t,ntTMatrix.Rdash.method}
\aliasA{tcrossprod,ngCMatrix,missing-method}{nsparseMatrix-classes}{tcrossprod,ngCMatrix,missing.Rdash.method}
\aliasA{tcrossprod,ngTMatrix,missing-method}{nsparseMatrix-classes}{tcrossprod,ngTMatrix,missing.Rdash.method}
\aliasA{tcrossprod,nsparseMatrix,missing-method}{nsparseMatrix-classes}{tcrossprod,nsparseMatrix,missing.Rdash.method}
\aliasA{\%*\%,ndenseMatrix,nsparseMatrix-method}{nsparseMatrix-classes}{.Rpcent.*.Rpcent.,ndenseMatrix,nsparseMatrix.Rdash.method}
\aliasA{\%*\%,ngCMatrix,ngCMatrix-method}{nsparseMatrix-classes}{.Rpcent.*.Rpcent.,ngCMatrix,ngCMatrix.Rdash.method}
\aliasA{\%*\%,nsparseMatrix,ndenseMatrix-method}{nsparseMatrix-classes}{.Rpcent.*.Rpcent.,nsparseMatrix,ndenseMatrix.Rdash.method}
\aliasA{\%*\%,nsparseMatrix,nsparseMatrix-method}{nsparseMatrix-classes}{.Rpcent.*.Rpcent.,nsparseMatrix,nsparseMatrix.Rdash.method}
\keyword{classes}{nsparseMatrix-classes}
\keyword{algebra}{nsparseMatrix-classes}
\begin{Description}\relax
The \code{nsparseMatrix} class is a virtual class of sparse
\emph{\dQuote{pattern}} matrices, i.e., binary matrices conceptually
with \code{TRUE}/\code{FALSE} entries.  Only the positions of the
elements that are \code{TRUE} are stored.  These can be stored in the
``triplet'' form (classes \code{ngTMatrix}, \code{nsTMatrix}, and
\code{ntTMatrix} which really contain pairs, not triplets) or in
compressed column-oriented form (classes \code{ngCMatrix},
\code{nsCMatrix}, and \code{ntCMatrix}) or in compressed row-oriented
form (classes \code{ngRMatrix}, \code{nsRMatrix}, and
\code{ntRMatrix}).  The second letter in the name of these non-virtual
classes indicates \code{g}eneral, \code{s}ymmetric, or \code{t}riangular.
\end{Description}
\begin{Section}{Objects from the Class}
Objects can be created by calls of the form \code{new("ngCMatrix",
    ...)} and so on.  More frequently objects are created by coercion of
a numeric sparse matrix to the pattern form for use in
the symbolic analysis phase
of an algorithm involving sparse matrices.  Such algorithms often
involve two phases: a symbolic phase wherein the positions of the
non-zeros in the result are determined and a numeric phase wherein the
actual results are calculated.  During the symbolic phase only the
positions of the non-zero elements in any operands are of interest,
hence numeric sparse matrices can be treated as sparse pattern
matrices.
\end{Section}
\begin{Section}{Slots}
\describe{
\item[\code{uplo}:] Object of class \code{"character"}. Must be
either "U", for upper triangular, and "L", for lower
triangular. Present in the triangular and symmetric classes but not
in the general class.
\item[\code{diag}:] Object of class \code{"character"}. Must be
either \code{"U"}, for unit triangular (diagonal is all ones), or
\code{"N"} for non-unit.  The implicit diagonal elements are not
explicitly stored when \code{diag} is \code{"U"}.  Present in the
triangular classes only.
\item[\code{p}:] Object of class \code{"integer"} of pointers, one
for each column (row), to the initial (zero-based) index of elements in
the column.  Present in compressed column-oriented and compressed
row-oriented forms only.
\item[\code{i}:] Object of class \code{"integer"} of length nnzero
(number of non-zero elements).  These are the row numbers for
each TRUE element in the matrix.  All other elements are FALSE.
Present in triplet and compressed column-oriented forms only.
\item[\code{j}:] Object of class \code{"integer"} of length nnzero
(number of non-zero elements).  These are the column numbers for
each TRUE element in the matrix.  All other elements are FALSE.
Present in triplet and compressed column-oriented forms only.
\item[\code{Dim}:] Object of class \code{"integer"} - the dimensions
of the matrix.
}
\end{Section}
\begin{Section}{Methods}
\describe{
\item[coerce] \code{signature(from = "dgCMatrix", to =
        "ngCMatrix")}, and many similar ones; typically you should
coerce to \code{"nsparseMatrix"} (or \code{"nMatrix"}).  Note that
coercion to a sparse pattern matrix records all the potential
non-zero entries, i.e., explicit (\dQuote{non-structural}) zeroes
are coerced to \code{TRUE}, not \code{FALSE}, see the example.

\item[t] \code{signature(x = "ngCMatrix")}: returns the transpose
of \code{x}
}
\end{Section}
\begin{SeeAlso}\relax
the class \code{\LinkA{dgCMatrix}{dgCMatrix.Rdash.class}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
(m <- Matrix(c(0,0,2:0), 3,5, dimnames=list(LETTERS[1:3],NULL)))
## ``extract the nonzero-pattern of (m) into an nMatrix'':
nm <- as(m, "nsparseMatrix") ## -> will be a "ngCMatrix"
str(nm) # no 'x' slot
nnm <- !nm     # no longer sparse
(nnm <- as(nnm, "sparseMatrix"))# "lgCMatrix"
## consistency check:
stopifnot(xor(as( nm, "matrix"),
              as(nnm, "matrix")))

## low-level way of adding "non-structural zeros" :
nnm@x[2:4] <- c(FALSE,NA,NA)
nnm
as(nnm, "nMatrix") # NAs *and* non-structural 0  |--->  'TRUE'

data(KNex)
nmm <- as(KNex $ mm, "ngCMatrix")
str(xlx <- crossprod(nmm))# "nsCMatrix"
stopifnot(isSymmetric(xlx))
image(xlx, main=paste("crossprod(nmm) : Sparse", class(xlx)))
\end{ExampleCode}
\end{Examples}

