The R Project SVN R-packages

Rev

Rev 3309 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1473 bates 1
\name{lsparseMatrix-classes}
1469 bates 2
\docType{class}
1473 bates 3
\alias{lsparseMatrix-class}
1469 bates 4
\alias{lgCMatrix-class}
1471 bates 5
\alias{ltCMatrix-class}
6
\alias{lsCMatrix-class}
1473 bates 7
\alias{lgRMatrix-class}
8
\alias{ltRMatrix-class}
9
\alias{lsRMatrix-class}
10
\alias{lgTMatrix-class}
11
\alias{ltTMatrix-class}
12
\alias{lsTMatrix-class}
1857 maechler 13
%
1869 maechler 14
\alias{-,lsparseMatrix,missing-method}
15
\alias{!,lsparseMatrix-method}
1469 bates 16
\alias{\%*\%,lgCMatrix,lgCMatrix-method}
1782 maechler 17
\alias{\%*\%,lsparseMatrix,lsparseMatrix-method}
1833 maechler 18
\alias{\%*\%,lsparseMatrix,ldenseMatrix-method}
19
\alias{\%*\%,ldenseMatrix,lsparseMatrix-method}
1533 bates 20
\alias{chol,lsCMatrix,logical-method}
21
\alias{chol,lsCMatrix,missing-method}
1869 maechler 22
 
1476 bates 23
\alias{coerce,lgCMatrix,dgCMatrix-method}
1533 bates 24
\alias{coerce,lgCMatrix,lgTMatrix-method}
3182 maechler 25
\alias{coerce,lgCMatrix,lgeMatrix-method}
1746 maechler 26
\alias{coerce,lgCMatrix,matrix-method}
1857 maechler 27
\alias{coerce,lgTMatrix,dgTMatrix-method}
1533 bates 28
\alias{coerce,lgTMatrix,lgCMatrix-method}
1746 maechler 29
\alias{coerce,lgTMatrix,matrix-method}
1857 maechler 30
\alias{coerce,lsCMatrix,dgTMatrix-method}
1476 bates 31
\alias{coerce,lsCMatrix,dsCMatrix-method}
1857 maechler 32
\alias{coerce,lsCMatrix,lgCMatrix-method}
33
\alias{coerce,lsCMatrix,lsTMatrix-method}
34
\alias{coerce,lsCMatrix,matrix-method}
1533 bates 35
\alias{coerce,ltCMatrix,dtCMatrix-method}
2208 maechler 36
\alias{coerce,ltCMatrix,dMatrix-method}
2255 maechler 37
\alias{coerce,ltCMatrix,lgCMatrix-method}
1857 maechler 38
\alias{coerce,ltCMatrix,matrix-method}
3176 maechler 39
\alias{coerce,matrix,lgCMatrix-method}
40
\alias{coerce,matrix,lgTMatrix-method}
2256 maechler 41
\alias{coerce,matrix,ltCMatrix-method}
1857 maechler 42
%
2123 maechler 43
\alias{coerce,ltTMatrix,dtTMatrix-method}
2255 maechler 44
\alias{coerce,ltTMatrix,lgTMatrix-method}
2123 maechler 45
\alias{coerce,ltTMatrix,matrix-method}
46
%
1473 bates 47
\alias{crossprod,lgCMatrix,missing-method}
1533 bates 48
\alias{crossprod,lgTMatrix,missing-method}
1782 maechler 49
\alias{crossprod,lsparseMatrix-method}
50
\alias{crossprod,lsparseMatrix,missing-method}
1833 maechler 51
\alias{crossprod,lsparseMatrix,lsparseMatrix-method}
52
\alias{crossprod,lsparseMatrix,ldenseMatrix-method}
53
\alias{crossprod,ldenseMatrix,lsparseMatrix-method}
3309 maechler 54
\alias{diag,lgCMatrix-method}
55
\alias{diag,lsparseMatrix-method}
1533 bates 56
\alias{image,lgCMatrix-method}
57
\alias{image,lsCMatrix-method}
58
\alias{image,ltCMatrix-method}
2123 maechler 59
\alias{image,ltTMatrix-method}
1469 bates 60
\alias{t,lgCMatrix-method}
1533 bates 61
\alias{t,lgTMatrix-method}
62
\alias{t,lsCMatrix-method}
63
\alias{t,ltCMatrix-method}
2059 maechler 64
\alias{tcrossprod,lgCMatrix,missing-method}
65
\alias{tcrossprod,lgTMatrix,missing-method}
66
\alias{tcrossprod,lsparseMatrix,missing-method}
1473 bates 67
\title{Sparse logical matrices}
68
\description{The \code{lsparseMatrix} class is a virtual class of sparse
69
  matrices with \code{TRUE}/\code{FALSE} entries.  Only the positions of the
70
  elements that are \code{TRUE} are stored.  These can be stored in the
71
  ``triplet'' form (classes \code{lgTMatrix}, \code{lsTMatrix}, and
72
  \code{ltTMatrix} which really contain pairs, not triplets) or in
1730 maechler 73
  compressed column-oriented form (classes \code{lgCMatrix},
74
  \code{lsCMatrix}, and \code{ltCMatrix}) or in compressed row-oriented
75
  form (classes \code{lgRMatrix}, \code{lsRMatrix}, and
76
  \code{ltRMatrix}).  The second letter in the name of these non-virtual
77
  classes indicates \code{g}eneral, \code{s}ymmetric, or \code{t}riangular.
1473 bates 78
}
1469 bates 79
\section{Objects from the Class}{
1473 bates 80
  Objects can be created by calls of the form \code{new("lgCMatrix",
81
    ...)} and so on.  More frequently objects are created by coercion of
82
  a numeric sparse matrix to the logical form for use in
83
  the symbolic analysis phase
84
  of an algorithm involving sparse matrices.  Such algorithms often
85
  involve two phases: a symbolic phase wherein the positions of the
86
  non-zeros in the result are determined and a numeric phase wherein the
87
  actual results are calculated.  During the symbolic phase only the
88
  positions of the non-zero elements in any operands are of interest,
89
  hence any numeric sparse matrices can be treated as logical sparse
90
  matrices.
1469 bates 91
}
92
\section{Slots}{
93
  \describe{
1471 bates 94
    \item{\code{uplo}:}{Object of class \code{"character"}. Must be
95
      either "U", for upper triangular, and "L", for lower
96
      triangular. Present in the triangular and symmetric classes but not
97
      in the general class.}
98
    \item{\code{diag}:}{Object of class \code{"character"}. Must be
99
      either \code{"U"}, for unit triangular (diagonal is all ones), or
100
      \code{"N"} for non-unit.  The implicit diagonal elements are not
101
      explicitly stored when \code{diag} is \code{"U"}.  Present in the
102
      triangular classes only.}
1469 bates 103
    \item{\code{p}:}{Object of class \code{"integer"} of pointers, one
1473 bates 104
      for each column (row), to the initial (zero-based) index of elements in
105
      the column.  Present in compressed column-oriented and compressed
106
      row-oriented forms only.}
1469 bates 107
    \item{\code{i}:}{Object of class \code{"integer"} of length nnzero
108
      (number of non-zero elements).  These are the row numbers for
1473 bates 109
      each TRUE element in the matrix.  All other elements are FALSE.
110
      Present in triplet and compressed column-oriented forms only.}
111
    \item{\code{j}:}{Object of class \code{"integer"} of length nnzero
112
      (number of non-zero elements).  These are the column numbers for
113
      each TRUE element in the matrix.  All other elements are FALSE.
114
      Present in triplet and compressed column-oriented forms only.}
1469 bates 115
    \item{\code{Dim}:}{Object of class \code{"integer"} - the dimensions
116
      of the matrix.}
117
  }
118
}
119
\section{Methods}{
120
  \describe{
121
    \item{coerce}{\code{signature(from = "dgCMatrix", to = "lgCMatrix")}}
122
    \item{t}{\code{signature(x = "lgCMatrix")}: returns the transpose
123
      of \code{x}}
124
  }
125
}
126
%\references{}
127
%\author{}
1473 bates 128
%\note{}
1469 bates 129
\seealso{
3175 maechler 130
  the class \code{\linkS4class{dgCMatrix}}
1469 bates 131
}
1730 maechler 132
\examples{
1746 maechler 133
m <- Matrix(c(0,0,2:0), 3,5, dimnames=list(LETTERS[1:3],NULL))
134
(dm <- as(m, "dgCMatrix"))# no dimnames for sparse here
135
(lm <- as(dm, "lgCMatrix"))
3182 maechler 136
str(lm) # no 'x' slot
137
!lm     # no longer sparse
1869 maechler 138
 
2362 maechler 139
data(KNex)
140
lmm <- as(KNex $ mm, "lgCMatrix")
1869 maechler 141
xlx <- crossprod(lmm)
142
image(xlx, main=paste("crossprod(lmm) : Sparse", class(xlx)))
1730 maechler 143
}
1469 bates 144
\keyword{classes}
145
\keyword{algebra}