SCM

SCM Repository

[matrix] Annotation of /pkg/R/AllClass.R
ViewVC logotype

Annotation of /pkg/R/AllClass.R

Parent Directory Parent Directory | Revision Log Revision Log


Revision 482 - (view) (download)

1 : bates 296 # Ensure that the methods package is available
2 : bates 10 .onLoad <- function(lib, pkg) {
3 : bates 202 require("methods", character = TRUE, quietly = TRUE)
4 : bates 10 }
5 :    
6 :     # Virtual class of all Matrix objects
7 : bates 477 setClass("Matrix", representation(Dim = "integer"),
8 :     validity = function(object) {
9 :     Dim <- object@Dim
10 :     if (length(Dim) != 2)
11 :     return("Dim slot must be of length 2")
12 :     if (any(Dim < 0))
13 :     return("Dim slot must contain non-negative values")
14 :     TRUE
15 :     })
16 : bates 10
17 : bates 477 # Virtual class of numeric matrices
18 :     setClass("dMatrix",
19 :     representation(x = "numeric"),
20 :     contains = "Matrix")
21 :    
22 :     # Virtual class of integer matrices
23 :     setClass("iMatrix",
24 :     representation(x = "integer"),
25 :     contains = "Matrix")
26 :    
27 :     # Virtual class of logical matrices
28 :     setClass("lMatrix",
29 :     representation(x = "logical"),
30 :     contains = "Matrix")
31 :    
32 :     # Virtual class of complex matrices
33 :     setClass("zMatrix", # letter 'z' is as in the names of Lapack subroutines
34 :     representation(x = "complex"),
35 :     contains = "Matrix")
36 :    
37 :     # Virtual class of dense, numeric matrices
38 :     setClass("ddenseMatrix",
39 :     representation(rcond = "numeric", factors = "list"),
40 :     contains = "dMatrix")
41 :    
42 :     # numeric, dense, general matrices
43 :     setClass("dgeMatrix", contains = "ddenseMatrix",
44 :     validity = function(object) { ## dgeMatrix checks the length of x is prod(Dim)
45 :     .Call("dgeMatrix_validate", object)
46 :     })
47 :    
48 :     # numeric, dense, non-packed, triangular matrices
49 :     setClass("dtrMatrix",
50 :     representation(uplo = "character", diag = "character"),
51 :     contains = "dgeMatrix",
52 :     prototype = prototype(uplo = "U", diag = "N"),
53 : bates 10 validity = function(object) {
54 : bates 477 .Call("dtrMatrix_validate", object)
55 : bates 10 })
56 :    
57 : bates 477 # numeric, dense, packed, triangular matrices
58 :     setClass("dtpMatrix",
59 : bates 10 representation(uplo = "character", diag = "character"),
60 : bates 477 contains = "ddenseMatrix",
61 : bates 10 prototype = prototype(uplo = "U", diag = "N"),
62 :     validity = function(object) {
63 : bates 477 .Call("dtpMatrix_validate", object)
64 : bates 10 })
65 :    
66 : bates 477 # numeric, dense, non-packed symmetric matrices
67 :     setClass("dsyMatrix",
68 :     representation(uplo = "character"),
69 :     prototype = prototype(uplo = "U"),
70 :     contains = "dgeMatrix",
71 :     validity = function(object) .Call("dsyMatrix_validate", object)
72 :     )
73 : bates 10
74 : bates 477 # numeric, dense, non-packed symmetric matrices
75 :     setClass("dspMatrix",
76 : bates 10 representation(uplo = "character"),
77 : bates 477 prototype = prototype(uplo = "U"),
78 :     contains = "dgeMatrix",
79 :     validity = function(object) .Call("dspMatrix_validate", object)
80 :     )
81 : bates 10
82 : bates 477 # numeric, dense, non-packed, postive-definite, symmetric matrices
83 :     setClass("dpoMatrix", contains = "dsyMatrix",
84 :     validity = function(object) .Call("dpoMatrix_validate", object)
85 :     )
86 : bates 10
87 : bates 477 # numeric, dense, packed, postive-definite, symmetric matrices
88 : bates 482 setClass("dppMatrix", contains = "dspMatrix",
89 : bates 477 validity = function(object) .Call("dppMatrix_validate", object)
90 : bates 10 )
91 :    
92 : bates 477 # numeric, sparse, triplet general matrices
93 :     setClass("dgTMatrix",
94 :     representation(i = "integer", j = "integer", factors = "list"),
95 :     contains = "dMatrix",
96 :     validity = function(object) .Call("dgTMatrix_validate", object)
97 : bates 10 )
98 :    
99 : bates 477 # numeric, sparse, triplet triangular matrices
100 :     setClass("dtTMatrix",
101 : bates 13 representation(uplo = "character", diag = "character"),
102 : bates 477 contains = "dgTMatrix",
103 :     validity = function(object) .Call("dtTMatrix_validate", object)
104 :     )
105 : bates 10
106 : bates 477 # numeric, sparse, triplet symmetric matrices
107 : bates 482 setClass("dsTMatrix",
108 : bates 477 representation(uplo = "character"),
109 : bates 482 contains = "dgTMatrix",
110 : bates 477 validity = function(object) .Call("dsTMatrix_validate", object)
111 :     )
112 : bates 10
113 : bates 477 # numeric, sparse, sorted compressed sparse column-oriented general matrices
114 :     setClass("dgCMatrix",
115 :     representation(i = "integer", p = "integer", factors = "list"),
116 :     contains = "dMatrix",
117 :     validity = function(object) .Call("dgCMatrix_validate", object)
118 :     )
119 : bates 10
120 : bates 477 # numeric, sparse, sorted compressed sparse column-oriented triangular matrices
121 :     setClass("dtCMatrix",
122 :     representation(uplo = "character", diag = "character"),
123 :     contains = "dgCMatrix",
124 :     validity = function(object) .Call("dtCMatrix_validate", object)
125 :     )
126 :    
127 :     # numeric, sparse, sorted compressed sparse column-oriented symmetric matrices
128 :     setClass("dsCMatrix",
129 :     representation(uplo = "character"),
130 :     contains = "dgCMatrix",
131 :     validity = function(object) .Call("dsCMatrix_validate", object)
132 :     )
133 :    
134 :     # numeric, sparse, sorted compressed sparse row-oriented general matrices
135 :     setClass("dgRMatrix",
136 :     representation(j = "integer", p = "integer", factors = "list"),
137 :     contains = "dMatrix",
138 :     validity = function(object) .Call("dgRMatrix_validate", object)
139 :     )
140 :    
141 :     # numeric, sparse, sorted compressed sparse row-oriented triangular matrices
142 :     setClass("dtRMatrix",
143 :     representation(uplo = "character", diag = "character"),
144 :     contains = "dgRMatrix",
145 :     validity = function(object) .Call("dtRMatrix_validate", object)
146 :     )
147 :    
148 :     # numeric, sparse, sorted compressed sparse row-oriented symmetric matrices
149 :     setClass("dsRMatrix",
150 :     representation(uplo = "character"),
151 :     contains = "dgRMatrix",
152 :     validity = function(object) .Call("dsRMatrix_validate", object)
153 :     )
154 :    
155 :     ## Compressed sparse column matrix in blocks
156 :     setClass("dgBCMatrix", representation(p = "integer", i = "integer", x = "array"))
157 :    
158 : bates 10 setClass("determinant",
159 :     representation(modulus ="numeric",
160 :     logarithm = "logical",
161 :     sign = "integer",
162 :     call = "call"))
163 :    
164 : bates 477 setClass("LU", representation(x = "numeric",
165 : bates 10 pivot = "integer"),
166 :     validity = function(object)
167 : bates 302 .Call("LU_validate", object))
168 : bates 10
169 : bates 477 setClass("Cholesky", contains = "dtrMatrix")
170 : bates 10
171 : bates 477 setClass("dCholCMatrix",
172 : bates 257 representation = representation(perm = "integer", Parent = "integer",
173 :     D = "numeric"),
174 : bates 477 contains = "dtCMatrix",
175 : bates 10 validity = function(object)
176 : bates 477 .Call("dCholCMatrix_validate", object))
177 : bates 10
178 :     setClass("sscCrosstab", representation =
179 :     representation(Gp = "integer", perm = "integer"),
180 : bates 477 contains = "dsCMatrix",
181 : bates 10 validity = function(object)
182 : bates 302 .Call("sscCrosstab_validate", object))
183 : bates 10
184 :     setClass("ssclme", representation =
185 :     representation(
186 :     D = "numeric", # Diagonal of D in LDL'
187 :     DIsqrt = "numeric", # inverse square root of D
188 :     Dim = "integer", # Dimensions of Z'Z and LDL'
189 :     Gp = "integer", # Pointers to groups of columns of Z
190 :     Li = "integer", # Row indices of L
191 :     Lp = "integer", # Column pointers of L
192 :     Lx = "numeric", # Non-zero, off-diagonals of L
193 :     Omega = "list", # List of symmetric matrices
194 :     Parent = "integer", # Elimination tree of L
195 :     RXX = "matrix", # Augmented RXX component or inverse
196 :     RZX = "matrix", # Augmented RZX component or inverse
197 :     XtX = "matrix", # Original X'X matrix
198 :     ZtX = "matrix", # Original Z'X matrix
199 :     bVar = "list", # Diagonal blocks on (Z'Z+W)^{-1}
200 :     deviance = "numeric", # Current deviance (ML and REML)
201 :     devComp = "numeric", # Components of deviance
202 :     i = "integer", # Row indices of Z'Z
203 :     nc = "integer", # number of columns in model matrices
204 :     p = "integer", # Pointers to columns of Z'Z
205 :     status = "logical", # record if factored, if inverted
206 :     x = "numeric" # Non-zeroes in upper triangle of Z'Z
207 :     ),
208 :     validity = function(object)
209 : bates 302 .Call("ssclme_validate", object))
210 : bates 10
211 :     # positive-definite symmetric matrices as matrices
212 :     setClass("pdmatrix", contains="matrix")
213 :    
214 :     # factors of positive-definite symmetric matrices
215 :     setClass("pdfactor", representation("matrix", logDet = "numeric"))
216 :    
217 :     # correlation matrices and standard deviations
218 :     setClass("corrmatrix", representation("matrix", stdDev = "numeric"))
219 :    
220 : bates 325
221 :    

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge