File: CsparseMatrix-class.Rd

package info (click to toggle)
rmatrix 0.999375-43-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 8,068 kB
  • ctags: 2,395
  • sloc: ansic: 37,941; makefile: 216; sh: 128
file content (143 lines) | stat: -rw-r--r-- 7,179 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
\name{CsparseMatrix-class}
\docType{class}
\alias{CsparseMatrix-class}
\alias{\%*\%,CsparseMatrix,CsparseMatrix-method}
\alias{\%*\%,CsparseMatrix,ddenseMatrix-method}
\alias{\%*\%,CsparseMatrix,matrix-method}
\alias{\%*\%,CsparseMatrix,numeric-method}
\alias{\%*\%,ddenseMatrix,CsparseMatrix-method}
\alias{\%*\%,matrix,CsparseMatrix-method}
\alias{\%*\%,numeric,CsparseMatrix-method}
\alias{coerce,CsparseMatrix,lsparseMatrix-method}
\alias{coerce,CsparseMatrix,lMatrix-method}
\alias{coerce,CsparseMatrix,nsparseMatrix-method}
\alias{coerce,CsparseMatrix,nMatrix-method}
\alias{coerce,CsparseMatrix,TsparseMatrix-method}
\alias{coerce,CsparseMatrix,denseMatrix-method}
\alias{coerce,CsparseMatrix,matrix-method}
\alias{coerce,matrix,CsparseMatrix-method}
\alias{coerce,numeric,CsparseMatrix-method}
\alias{crossprod,CsparseMatrix,missing-method}
\alias{crossprod,CsparseMatrix,CsparseMatrix-method}
\alias{crossprod,CsparseMatrix,ddenseMatrix-method}
\alias{crossprod,CsparseMatrix,matrix-method}
\alias{crossprod,CsparseMatrix,numeric-method}
\alias{crossprod,ddenseMatrix,CsparseMatrix-method}
\alias{crossprod,matrix,CsparseMatrix-method}
\alias{diag,CsparseMatrix-method}
\alias{t,CsparseMatrix-method}
\alias{tcrossprod,CsparseMatrix,CsparseMatrix-method}
\alias{tcrossprod,CsparseMatrix,missing-method}
% "[" are in ./Xtrct-methods.Rd
%% Group methods --------- FIXME: not tested yet (or documented)
\alias{Compare,CsparseMatrix,CsparseMatrix-method}
\alias{Arith,CsparseMatrix,CsparseMatrix-method}
\alias{Arith,CsparseMatrix,numeric-method}
\alias{Arith,numeric,CsparseMatrix-method}
\alias{Logic,CsparseMatrix,CsparseMatrix-method}
\alias{Math,CsparseMatrix-method}
%
\alias{.validateCsparse}
%
\title{Class "CsparseMatrix" of Sparse Matrices in Column-compressed Form}
\description{The \code{"CsparseMatrix"} class is the virtual class of
  all sparse matrices coded in sorted compressed column-oriented form.
  Since it is a virtual class, no objects may be created from it.  See
  \code{showClass("CsparseMatrix")} for its subclasses.
}

\section{Slots}{
  \describe{
    \item{\code{i}:}{Object of class \code{"integer"} of length nnzero
      (number of non-zero elements).  These are the \emph{0-based} row numbers for
      each non-zero element in the matrix, i.e., \code{i} must be in
      \code{0:(nrow(.)-1)}}.
    \item{\code{p}:}{Object of class \code{"integer"} for providing pointers, one
      for each column, to the initial (zero-based) index of elements in
      the column.  \code{.@p} is of length \code{ncol(.) + 1}, with
      \code{p[1] == 0} and \code{p[length(p)] == nnzero}, such that in
      fact, \code{diff(.@p)} are the number of non-zero elements for
      each column.}
    \item{\code{Dim}, \code{Dimnames}:}{inherited from
      the superclass, see the \code{\linkS4class{sparseMatrix}} class.}
  }
}
\section{Extends}{
Class \code{"sparseMatrix"}, directly.
Class \code{"Matrix"}, by class \code{"sparseMatrix"}.
}
\section{Methods}{
  \describe{%% The following is generated by promptClass(..) --
    %% FIXME: write a script that update all the *-class.Rd files
    \item{Arith}{\code{signature(e1 = "CsparseMatrix", e2 = "numeric")}: ... }
    \item{Arith}{\code{signature(e1 = "numeric", e2 = "CsparseMatrix")}: ... }
    \item{Math}{\code{signature(x = "CsparseMatrix")}: ... }

    \item{band}{\code{signature(x = "CsparseMatrix")}: ... }
    \item{-}{\code{signature(e1 = "CsparseMatrix", e2 = "numeric")}: ... }
    \item{-}{\code{signature(e1 = "numeric", e2 = "CsparseMatrix")}: ... }
    \item{[<-}{\code{signature(x = "CsparseMatrix", i = "index", j = "missing", value = "replValue")}: ... }
    \item{[<-}{\code{signature(x = "CsparseMatrix", i = "index", j = "index", value = "replValue")}: ... }
    \item{[<-}{\code{signature(x = "CsparseMatrix", i = "missing", j = "index", value = "replValue")}: ... }
    \item{\%*\%}{\code{signature(x = "CsparseMatrix", y = "CsparseMatrix")}: ... }
    \item{\%*\%}{\code{signature(x = "CsparseMatrix", y = "denseMatrix")}: ... }
    \item{\%*\%}{\code{signature(x = "CsparseMatrix", y = "matrix")}: ... }
    \item{+}{\code{signature(e1 = "CsparseMatrix", e2 = "numeric")}: ... }
    \item{+}{\code{signature(e1 = "numeric", e2 = "CsparseMatrix")}: ... }
    \item{coerce}{\code{signature(from = "CsparseMatrix", to = "TsparseMatrix")}: ... }
    \item{coerce}{\code{signature(from = "CsparseMatrix", to = "denseMatrix")}: ... }
    \item{coerce}{\code{signature(from = "CsparseMatrix", to = "matrix")}: ... }
    \item{coerce}{\code{signature(from = "CsparseMatrix", to = "lsparseMatrix")}: ... }
    \item{coerce}{\code{signature(from = "CsparseMatrix", to = "nsparseMatrix")}: ... }
    \item{coerce}{\code{signature(from = "TsparseMatrix", to = "CsparseMatrix")}: ... }
    \item{coerce}{\code{signature(from = "denseMatrix", to = "CsparseMatrix")}: ... }
    \item{crossprod}{\code{signature(x = "CsparseMatrix", y = "CsparseMatrix")}: ... }
    \item{crossprod}{\code{signature(x = "CsparseMatrix", y = "missing")}: ... }
    \item{crossprod}{\code{signature(x = "CsparseMatrix", y = "dgeMatrix")}: ... }
    \item{crossprod}{\code{signature(x = "CsparseMatrix", y = "matrix")}: ... }
    \item{diag}{\code{signature(x = "CsparseMatrix")}: ... }
    \item{gamma}{\code{signature(x = "CsparseMatrix")}: ... }
    \item{lgamma}{\code{signature(x = "CsparseMatrix")}: ... }
    \item{log}{\code{signature(x = "CsparseMatrix")}: ... }
    \item{t}{\code{signature(x = "CsparseMatrix")}: ... }
    \item{tcrossprod}{\code{signature(x = "CsparseMatrix", y = "CsparseMatrix")}: ... }
    \item{tcrossprod}{\code{signature(x = "CsparseMatrix", y = "missing")}: ... }
    \item{tril}{\code{signature(x = "CsparseMatrix")}: ... }
    \item{triu}{\code{signature(x = "CsparseMatrix")}: ... }
  }
}
\note{
  All classes extending \code{CsparseMatrix} have a common validity
  (see \code{\link{validObject}}) check function.  That function
  additionally checks the \code{i} slot for each column to contain
  increasing row numbers. \cr
  In earlier versions of \pkg{Matrix} (\code{<= 0.999375-16}),
  \code{\link{validObject}} automatically re-sorted the entries when
  necessary, and hence \code{new()} calls with somewhat permuted
  \code{i} and \code{x} slots worked, as \code{\link{new}(...)}
  (\emph{with} slot arguments) automatically checks the validity.

  Now, you have to use \code{\link{sparseMatrix}} to achieve the same
  functionality or know how to use \code{.validateCsparse()} to do so.
}
\seealso{
  \code{\link{colSums}}, \code{\link{kronecker}}, and other such methods
  with own help pages.

  Further, the super class of \code{CsparseMatrix},
  \code{\linkS4class{sparseMatrix}}, and, e.g.,
  class \code{\linkS4class{dgCMatrix}} for the links to other classes.
}
\examples{
getClass("CsparseMatrix")

## The common validity check function (based on C code):
getValidity(getClass("CsparseMatrix"))

## This behavior has been changed
# un-sorted i-slot on input is automatically "sorted" :
#M <- new("dgCMatrix", Dim = 2:3, p = as.integer(c(0,1,1,3)),
#         i = c(1L, 1:0), x= c(2,2,1))
#stopifnot(M@i == c(1L, 0:1), M@x == c(2,1,2))
}
\keyword{classes}