nMatrix-class
Class "nMatrix" of Non-zero Pattern Matrices
Description
The nMatrix
class is the virtual “mother” class of all non-zero pattern (or simply pattern) matrices in the Matrix package.
Slots
Common to all matrix object in the package:
-
Dim
: -
Object of class
"integer"
- the dimensions of the matrix - must be an integer vector with exactly two non-negative values. -
Dimnames
: -
list of length two; each component containing NULL or a
character
vector length equal the correspondingDim
element.
Methods
There is a bunch of coercion methods (for as(..)
), e.g.,
- coerce
-
signature(from = "matrix", to = "nMatrix")
: Note that these coercions (must) coerceNA
s to non-zero, hence conceptuallyTRUE
. This is particularly important whensparseMatrix
objects are coerced to"nMatrix"
and hence tonsparseMatrix
. - coerce
-
signature(from = "dMatrix", to = "nMatrix")
, and - coerce
-
signature(from = "lMatrix", to = "nMatrix")
: For dense matrices withNA
s, these coercions are valid since Matrix version 1.2.0 (still with awarning
or amessage
if"Matrix.warn"
, or"Matrix.verbose"
options
are set.) - coerce
-
signature(from = "nMatrix", to = "matrix")
: ... - coerce
-
signature(from = "nMatrix", to = "dMatrix")
: ... - coerce
-
signature(from = "nMatrix", to = "lMatrix")
: ...
— — —
Additional methods contain group methods, such as
- Ops
-
signature(e1 = "nMatrix", e2 = "....")
, ... - Arith
-
signature(e1 = "nMatrix", e2 = "....")
, ... - Compare
-
signature(e1 = "nMatrix", e2 = "....")
, ... - Logic
-
signature(e1 = "nMatrix", e2 = "....")
, ... - Summary
-
signature(x = "nMatrix", "....")
, ...
See Also
The classes lMatrix
, nsparseMatrix
, and the mother class, Matrix
.
Examples
getClass("nMatrix") L3 <- Matrix(upper.tri(diag(3))) L3 # an "ltCMatrix" as(L3, "nMatrix") # -> ntC* ## similar, not using Matrix() as(upper.tri(diag(3)), "nMatrix")# currently "ngTMatrix"
Copyright (©) 1999–2012 R Foundation for Statistical Computing.
Licensed under the GNU General Public License.