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 1201 - (view) (download)

1 : bates 10 .onLoad <- function(lib, pkg) {
2 : maechler 513 if(is.null(getOption("max.print")))
3 : maechler 898 options(max.print = 10000)#-> show() of large matrices
4 : bates 10 }
5 :    
6 : maechler 513 ## ------------- Virtual Classes ----------------------------------------
7 :    
8 : maechler 946 ## Mother class of all Matrix objects
9 : maechler 953 setClass("Matrix",
10 : bates 1156 representation(Dim = "integer", Dimnames = "list", "VIRTUAL"),
11 : maechler 898 prototype = prototype(Dim = integer(2), Dimnames = list(NULL,NULL)),
12 :     validity = function(object) {
13 :     Dim <- object@Dim
14 :     if (length(Dim) != 2)
15 :     return("Dim slot must be of length 2")
16 :     if (any(Dim < 0))
17 :     return("Dim slot must contain non-negative values")
18 :     Dn <- object@Dimnames
19 :     if (!is.list(Dn) || length(Dn) != 2)
20 :     return("'Dimnames' slot must be list of length 2")
21 :     ## 'else' ok :
22 :     TRUE
23 :     })
24 : bates 10
25 : bates 1156 ## The class of composite matrices - i.e. those for which it makes sense to
26 :     ## create a factorization
27 :     setClass("compMatrix", representation(factors = "list", "VIRTUAL"),
28 :     contains = "Matrix")
29 :    
30 : bates 1160 ## Virtual classes of Matrices determined by above/below diagonal relationships
31 :    
32 : maechler 1165 setClass("generalMatrix", representation = "VIRTUAL", contains = "compMatrix")
33 : bates 1160
34 : maechler 887 setClass("symmetricMatrix",
35 : maechler 898 representation(uplo = "character", "VIRTUAL"),
36 : bates 1160 contains = "compMatrix")
37 : maechler 886
38 : maechler 887 setClass("triangularMatrix",
39 : bates 1160 representation(uplo = "character", diag = "character", "VIRTUAL"),
40 : maechler 1165 contains = "Matrix",
41 :     validity =
42 :     function(object) .Call("triangularMatrix_validate", object, PACKAGE = "Matrix")
43 :     )
44 : maechler 887
45 : bates 1160
46 : maechler 946 ## Virtual class of numeric matrices
47 : bates 477 setClass("dMatrix",
48 : maechler 1165 representation(x = "numeric", "VIRTUAL"), contains = "Matrix",
49 :     validity = function(object)
50 :     .Call("dMatrix_validate", object, PACKAGE = "Matrix"))
51 : bates 477
52 : maechler 946 ## Virtual class of integer matrices
53 : bates 477 setClass("iMatrix",
54 : maechler 898 representation(x = "integer", "VIRTUAL"), contains = "Matrix")
55 : bates 477
56 : maechler 946 ## Virtual class of logical matrices
57 : bates 692 setClass("lMatrix", representation("VIRTUAL"), contains = "Matrix")
58 :     ## Note that logical sparse matrices do not need an x slot so the x
59 :     ## slot is part of the ldenseMatrix class
60 : bates 477
61 : maechler 946 ## Virtual class of complex matrices
62 : bates 477 setClass("zMatrix", # letter 'z' is as in the names of Lapack subroutines
63 : maechler 898 representation(x = "complex", "VIRTUAL"), contains = "Matrix")
64 : bates 477
65 : maechler 1109 ## Virtual class of dense matrices (including "packed")
66 : maechler 953 setClass("denseMatrix", representation("VIRTUAL"),
67 :     contains = "Matrix")
68 : maechler 848
69 : maechler 946 ## Virtual class of dense, numeric matrices
70 : bates 1166 setClass("ddenseMatrix", representation("VIRTUAL"),
71 : maechler 898 contains = c("dMatrix", "denseMatrix"))
72 : maechler 498
73 : maechler 946 ## Virtual class of dense, logical matrices
74 : maechler 953 setClass("ldenseMatrix", representation(x = "logical", "VIRTUAL"),
75 : maechler 898 contains = c("lMatrix", "denseMatrix"))
76 : bates 692
77 : maechler 1109 ## diagonal: has 'diag' slot; diag = "U" <--> have identity matrix
78 :     setClass("diagonalMatrix", representation(diag = "character", "VIRTUAL"),
79 :     contains = "denseMatrix",
80 :     validity = function(object) {
81 :     d <- object@Dim
82 :     if(d[1] != (n <- d[2])) return("matrix is not square")
83 :     lx <- length(object@x)
84 :     if(object@diag == "U" && lx != 0)
85 :     return("diag = \"U\" (identity matrix) requires empty 'x' slot")
86 :     if(object@diag == "N" && lx != n)
87 :     return("diagonal matrix has 'x' slot of length != 'n'")
88 :     TRUE
89 :     },
90 :     prototype = prototype(diag = "N")
91 :     )
92 :    
93 : maechler 676 ## virtual SPARSE ------------
94 :    
95 : maechler 953 setClass("sparseMatrix", representation("VIRTUAL"), contains = "Matrix")
96 : maechler 676
97 : bates 922 ## sparse matrices in Triplet representation (dgT, lgT, ..):
98 :     setClass("TsparseMatrix", representation(i = "integer", j = "integer", "VIRTUAL"),
99 :     contains = "sparseMatrix")
100 : maechler 868
101 : bates 922 setClass("CsparseMatrix", representation(i = "integer", p = "integer", "VIRTUAL"),
102 :     contains = "sparseMatrix")
103 :    
104 :     setClass("RsparseMatrix", representation(p = "integer", j = "integer", "VIRTUAL"),
105 :     contains = "sparseMatrix")
106 :    
107 : maechler 848 setClass("dsparseMatrix", representation("VIRTUAL"),
108 : maechler 898 contains = c("dMatrix", "sparseMatrix"))
109 : maechler 676
110 : maechler 848 setClass("lsparseMatrix", representation("VIRTUAL"),
111 : maechler 898 contains = c("lMatrix", "sparseMatrix"))
112 : bates 692
113 : maechler 513 ## ------------------ Proper (non-virtual) Classes ----------------------------
114 :    
115 : maechler 898 ##---------------------- DENSE -----------------------------------------
116 : maechler 513
117 : maechler 946 ## numeric, dense, general matrices
118 : maechler 1165 setClass("dgeMatrix", contains = c("ddenseMatrix", "generalMatrix"),
119 : maechler 898 ## checks that length( @ x) == prod( @ Dim):
120 : bates 1037 validity =
121 :     function(object) .Call("dgeMatrix_validate", object, PACKAGE = "Matrix")
122 : maechler 898 )
123 : maechler 513 ## i.e. "dgeMatrix" cannot be packed, but "ddenseMatrix" can ..
124 : bates 477
125 : maechler 946 ## numeric, dense, non-packed, triangular matrices
126 : bates 477 setClass("dtrMatrix",
127 : bates 1156 contains = c("ddenseMatrix", "triangularMatrix"),
128 : maechler 898 prototype = prototype(uplo = "U", diag = "N"),
129 : bates 1037 validity =
130 :     function(object) .Call("dtrMatrix_validate", object, PACKAGE = "Matrix")
131 : maechler 898 )
132 : bates 10
133 : maechler 946 ## numeric, dense, packed, triangular matrices
134 : bates 477 setClass("dtpMatrix",
135 : maechler 898 contains = c("ddenseMatrix", "triangularMatrix"),
136 :     prototype = prototype(uplo = "U", diag = "N"),
137 : bates 1037 validity =
138 :     function(object) .Call("dtpMatrix_validate", object, PACKAGE = "Matrix")
139 : maechler 898 )
140 : bates 10
141 : maechler 946 ## numeric, dense, non-packed symmetric matrices
142 : bates 477 setClass("dsyMatrix",
143 : maechler 953 ## FIXME?
144 :     ##> 'ddense*' before 'dge*' so it can use d* or ddense* methods
145 : maechler 1165 ##> WITHOUT a coerce to dge* (losing symmetry)
146 : maechler 953 ##> gives error in crossprod() dispatch
147 :     ##> contains = c("ddenseMatrix", "dgeMatrix", "symmetricMatrix"),
148 : maechler 1189 contains = c("ddenseMatrix", "symmetricMatrix"),
149 : maechler 898 prototype = prototype(uplo = "U"),
150 : bates 1037 validity =
151 :     function(object) .Call("dsyMatrix_validate", object, PACKAGE = "Matrix")
152 : maechler 898 )
153 : bates 10
154 : maechler 946 ## numeric, dense, packed symmetric matrices
155 : bates 477 setClass("dspMatrix",
156 : maechler 898 prototype = prototype(uplo = "U"),
157 : maechler 1165 contains = c("ddenseMatrix", "symmetricMatrix"),
158 : bates 1037 validity =
159 :     function(object) .Call("dspMatrix_validate", object, PACKAGE = "Matrix")
160 : maechler 898 )
161 : bates 10
162 : maechler 946 ## numeric, dense, non-packed, positive-definite, symmetric matrices
163 : bates 477 setClass("dpoMatrix", contains = "dsyMatrix",
164 : bates 1037 validity =
165 :     function(object) .Call("dpoMatrix_validate", object, PACKAGE = "Matrix")
166 : maechler 898 )
167 : bates 10
168 : maechler 946 ## numeric, dense, packed, positive-definite, symmetric matrices
169 : bates 482 setClass("dppMatrix", contains = "dspMatrix",
170 : bates 1037 validity =
171 :     function(object) .Call("dppMatrix_validate", object, PACKAGE = "Matrix")
172 : maechler 898 )
173 : bates 10
174 : maechler 925 ##----- logical dense Matrices -- e.g. as result of <ddenseMatrix> COMPARISON
175 :    
176 : maechler 946 ## numeric, dense, general matrices
177 : maechler 1165 setClass("lgeMatrix", contains = c("ldenseMatrix", "generalMatrix"),
178 : maechler 925 ## checks that length( @ x) == prod( @ Dim):
179 : maechler 946 validity = function(object) stopifnot(length(object@x) == prod(object@Dim))
180 : maechler 925 )
181 :     ## i.e. "lgeMatrix" cannot be packed, but "ldenseMatrix" can ..
182 :    
183 : maechler 946 ## numeric, dense, non-packed, triangular matrices
184 : maechler 925 setClass("ltrMatrix",
185 : bates 1156 contains = c("ldenseMatrix", "triangularMatrix"),
186 : maechler 946 prototype = prototype(uplo = "U", diag = "N"))
187 : maechler 925
188 : maechler 946 ## numeric, dense, packed, triangular matrices
189 : maechler 925 setClass("ltpMatrix",
190 :     contains = c("ldenseMatrix", "triangularMatrix"),
191 : maechler 946 prototype = prototype(uplo = "U", diag = "N")
192 :     ## validity: ldense*, triangular* should suffice
193 : maechler 925 )
194 :    
195 : maechler 946 ## numeric, dense, non-packed symmetric matrices
196 : maechler 925 setClass("lsyMatrix",
197 : maechler 1201 contains = c("ldenseMatrix", "symmetricMatrix"),
198 : maechler 946 prototype = prototype(uplo = "U")
199 : bates 1037 ##, validity = function(object) .Call("lsyMatrix_validate", object, PACKAGE = "Matrix")
200 : maechler 925 )
201 :    
202 : maechler 946 ## numeric, dense, packed symmetric matrices
203 : maechler 925 setClass("lspMatrix",
204 : maechler 1201 contains = c("ldenseMatrix", "symmetricMatrix"),
205 : maechler 925 prototype = prototype(uplo = "U"),
206 : bates 1037 validity = function(object)
207 :     .Call("dspMatrix_validate", object, PACKAGE = "Matrix")
208 : maechler 946 ## "dsp" and "lsp" have the same validate
209 : maechler 925 )
210 :    
211 : maechler 1109 ## 'diagonalMatrix' already has validity checking
212 :     ## diagonal, numeric matrices; "d*" has 'x' slot :
213 : maechler 1201 setClass("ddiMatrix", contains = c("diagonalMatrix", "ddenseMatrix"))# or "dMatrix"
214 : maechler 1109 ## diagonal, logical matrices; "ldense*" has 'x' slot :
215 :     setClass("ldiMatrix", contains = c("diagonalMatrix", "ldenseMatrix"))
216 :    
217 :    
218 : maechler 676 ##-------------------- S P A R S E (non-virtual) --------------------------
219 : maechler 513
220 : bates 692 ##---------- numeric sparse matrix classes --------------------------------
221 : maechler 848
222 : maechler 946 ## numeric, sparse, triplet general matrices
223 : bates 477 setClass("dgTMatrix",
224 : maechler 1165 contains = c("TsparseMatrix", "dsparseMatrix", "generalMatrix"),
225 : bates 1037 validity =
226 :     function(object) .Call("dgTMatrix_validate", object, PACKAGE = "Matrix")
227 : maechler 898 )
228 : bates 10
229 : bates 922 ## Should not have dtTMatrix inherit from dgTMatrix because a dtTMatrix could
230 : maechler 946 ## be less than fully stored if diag = "U". Methods for the dgTMatrix
231 :     ## class would not produce correct results even though all the slots
232 :     ## are present.
233 : bates 922
234 : maechler 946 ## numeric, sparse, triplet triangular matrices
235 : bates 477 setClass("dtTMatrix",
236 : bates 922 contains = c("TsparseMatrix", "dsparseMatrix", "triangularMatrix"),
237 : maechler 898 prototype = prototype(uplo = "U", diag = "N"),
238 : bates 1037 validity =
239 :     function(object) .Call("dtTMatrix_validate", object, PACKAGE = "Matrix")
240 : maechler 898 )
241 : bates 10
242 : bates 922 ## Should not have dsTMatrix inherit from dgTMatrix because a dsTMatrix
243 : maechler 946 ## is not fully stored. Methods for the dgTMatrix class would not
244 :     ## produce correct results even though all the slots are present.
245 : bates 922
246 : maechler 946 ## numeric, sparse, triplet symmetric matrices
247 : bates 482 setClass("dsTMatrix",
248 : maechler 1165 contains = c("TsparseMatrix", "dsparseMatrix", "symmetricMatrix"),
249 : maechler 898 prototype = prototype(uplo = "U"),
250 : bates 1037 validity =
251 :     function(object) .Call("dsTMatrix_validate", object, PACKAGE = "Matrix")
252 : maechler 898 )
253 : bates 10
254 : maechler 946 ## numeric, sparse, sorted compressed sparse column-oriented general matrices
255 : bates 477 setClass("dgCMatrix",
256 : maechler 1165 contains = c("CsparseMatrix", "dsparseMatrix", "generalMatrix"),
257 : maechler 898 prototype = prototype(p = 0:0),# to be valid
258 : bates 1037 validity =
259 :     function(object) .Call("dgCMatrix_validate", object, PACKAGE = "Matrix")
260 : maechler 898 )
261 : bates 10
262 : bates 922 ## see comments for dtTMatrix above
263 : maechler 946 ## numeric, sparse, sorted compressed sparse column-oriented triangular matrices
264 : bates 477 setClass("dtCMatrix",
265 : bates 922 contains = c("CsparseMatrix", "dsparseMatrix", "triangularMatrix"),
266 : maechler 898 prototype = prototype(p = 0:0, uplo = "U", diag = "N"),# to be valid
267 : bates 1037 validity =
268 :     function(object) .Call("tsc_validate", object, PACKAGE = "Matrix")
269 : maechler 898 )
270 : bates 477
271 : bates 922 ## see comments for dsTMatrix above
272 : maechler 946 ## numeric, sparse, sorted compressed sparse column-oriented symmetric matrices
273 : bates 477 setClass("dsCMatrix",
274 : maechler 1165 contains = c("CsparseMatrix", "dsparseMatrix", "symmetricMatrix"),
275 : maechler 898 prototype = prototype(p = 0:0, uplo = "U"),# to be valid
276 : bates 1037 validity =
277 :     function(object) .Call("dsCMatrix_validate", object, PACKAGE = "Matrix")
278 : maechler 898 )
279 : bates 477
280 : maechler 946 ## numeric, sparse, sorted compressed sparse row-oriented general matrices
281 : bates 477 setClass("dgRMatrix",
282 : maechler 1201 contains = c("RsparseMatrix", "dsparseMatrix", "generalMatrix"),
283 : maechler 1165 prototype = prototype(p = 0:0),
284 : bates 1037 ##TODO: validity = function(object) .Call("dgRMatrix_validate", object, PACKAGE = "Matrix")
285 : maechler 898 )
286 : bates 477
287 : maechler 946 ## numeric, sparse, sorted compressed sparse row-oriented triangular matrices
288 : bates 477 setClass("dtRMatrix",
289 : maechler 1174 contains = c("RsparseMatrix", "dsparseMatrix", "triangularMatrix"),
290 : maechler 1165 prototype = prototype(p = 0:0, uplo = "U", diag = "N"),# to be valid
291 : maechler 1174 ##TODO: validity = function(object) .Call("dtRMatrix_validate", object, PACKAGE = "Matrix")
292 : maechler 1165
293 : maechler 898 )
294 : bates 477
295 : maechler 946 ## numeric, sparse, sorted compressed sparse row-oriented symmetric matrices
296 : bates 477 setClass("dsRMatrix",
297 : maechler 1174 contains = c("RsparseMatrix", "dsparseMatrix", "symmetricMatrix"),
298 : maechler 1165 prototype = prototype(p = 0:0, uplo = "U"),# to be valid
299 : bates 1037 ##TODO: validity = function(object) .Call("dsRMatrix_validate", object, PACKAGE = "Matrix")
300 : maechler 898 )
301 : bates 477
302 : bates 692 ##---------- logical sparse matrix classes --------------------------------
303 :    
304 :     ## these classes are used in symbolic analysis to determine the
305 : maechler 848 ## locations of non-zero entries
306 : bates 692
307 : maechler 946 ## logical, sparse, triplet general matrices
308 : bates 692 setClass("lgTMatrix",
309 : maechler 1165 contains = c("TsparseMatrix", "lsparseMatrix", "generalMatrix"),
310 : bates 1037 validity =
311 :     function(object) .Call("lgTMatrix_validate", object, PACKAGE = "Matrix")
312 : maechler 898 )
313 : bates 692
314 : maechler 946 ## logical, sparse, triplet triangular matrices
315 : bates 692 setClass("ltTMatrix",
316 : bates 922 contains = c("TsparseMatrix", "lsparseMatrix", "triangularMatrix"),
317 : maechler 1109 prototype = prototype(uplo = "U", diag = "N"),
318 : bates 1037 validity =
319 :     function(object) .Call("ltTMatrix_validate", object, PACKAGE = "Matrix")
320 : maechler 898 )
321 : bates 692
322 : maechler 946 ## logical, sparse, triplet symmetric matrices
323 : bates 692 setClass("lsTMatrix",
324 : maechler 1165 contains = c("TsparseMatrix", "lsparseMatrix", "symmetricMatrix"),
325 : bates 1037 validity =
326 :     function(object) .Call("lsTMatrix_validate", object, PACKAGE = "Matrix")
327 : maechler 898 )
328 : bates 692
329 : maechler 946 ## logical, sparse, sorted compressed sparse column-oriented general matrices
330 : bates 692 setClass("lgCMatrix",
331 : maechler 1201 contains = c("CsparseMatrix", "lsparseMatrix", "generalMatrix"),
332 : maechler 898 prototype = prototype(p = 0:0),# to be valid
333 : bates 1037 validity =
334 :     function(object) .Call("lgCMatrix_validate", object, PACKAGE = "Matrix")
335 : maechler 898 )
336 : bates 692
337 : maechler 946 ## logical, sparse, sorted compressed sparse column-oriented triangular matrices
338 : bates 692 setClass("ltCMatrix",
339 : maechler 1201 contains = c("CsparseMatrix", "lsparseMatrix", "triangularMatrix"),
340 : maechler 898 prototype = prototype(p = 0:0, uplo = "U", diag = "N"),# to be valid
341 : bates 1037 validity =
342 :     function(object) .Call("ltCMatrix_validate", object, PACKAGE = "Matrix")
343 : maechler 898 )
344 : bates 692
345 : maechler 946 ## logical, sparse, sorted compressed sparse column-oriented symmetric matrices
346 : bates 692 setClass("lsCMatrix",
347 : maechler 1201 contains = c("CsparseMatrix", "lsparseMatrix", "symmetricMatrix"),
348 : maechler 898 prototype = prototype(p = 0:0, uplo = "U"),# to be valid
349 : bates 1037 validity =
350 :     function(object) .Call("lsCMatrix_validate", object, PACKAGE = "Matrix")
351 : maechler 898 )
352 : bates 692
353 : maechler 946 ## logical, sparse, sorted compressed sparse row-oriented general matrices
354 : bates 692 setClass("lgRMatrix",
355 : maechler 898 representation(j = "integer", p = "integer"),
356 : maechler 1201 contains = c("RsparseMatrix", "lsparseMatrix", "generalMatrix"),
357 : bates 1037 validity =
358 :     function(object) .Call("lgRMatrix_validate", object, PACKAGE = "Matrix")
359 : maechler 898 )
360 : bates 692
361 : maechler 946 ## logical, sparse, sorted compressed sparse row-oriented triangular matrices
362 : bates 692 setClass("ltRMatrix",
363 : maechler 1201 contains = c("RsparseMatrix", "lsparseMatrix", "triangularMatrix"),
364 : bates 1037 validity =
365 :     function(object) .Call("ltRMatrix_validate", object, PACKAGE = "Matrix")
366 : maechler 898 )
367 : bates 692
368 : maechler 946 ## logical, sparse, sorted compressed sparse row-oriented symmetric matrices
369 : bates 692 setClass("lsRMatrix",
370 : maechler 1201 contains = c("RsparseMatrix", "lsparseMatrix", "symmetricMatrix"),
371 : bates 1037 validity =
372 :     function(object) .Call("lsRMatrix_validate", object, PACKAGE = "Matrix")
373 : maechler 898 )
374 : bates 692
375 : maechler 1201 ### Factorization classes ---------------------------------------------
376 : bates 692
377 : maechler 513 setClass("Cholesky", contains = "dtrMatrix")
378 :    
379 : bates 1150 setClass("LDL", contains = "dtrMatrix")
380 :    
381 :     setClass("correlation", representation(sd = "numeric"), contains = "dpoMatrix")
382 :    
383 : bates 638 setClass("pCholesky", contains = "dtpMatrix")
384 :    
385 : bates 1037 setClass("BunchKaufman",
386 :     representation(perm = "integer"),
387 :     contains = "dtrMatrix",
388 :     validity =
389 :     function(object) .Call("BunchKaufman_validate", object, PACKAGE = "Matrix")
390 :     )
391 : bates 631
392 : bates 1037 setClass("pBunchKaufman",
393 :     representation(perm = "integer"),
394 :     contains = "dtpMatrix",
395 :     validity =
396 :     function(object) .Call("pBunchKaufman_validate", object, PACKAGE = "Matrix")
397 :     )
398 : bates 638
399 : maechler 513 setClass("dCholCMatrix",
400 : maechler 898 representation(perm = "integer", Parent = "integer", D = "numeric"),
401 :     contains = "dtCMatrix",
402 : bates 1037 validity =
403 :     function(object) .Call("dCholCMatrix_validate", object, PACKAGE = "Matrix")
404 :     )
405 : maechler 513
406 : bates 730 setClass("lCholCMatrix",
407 : maechler 898 representation(perm = "integer", Parent = "integer"),
408 :     contains = "ltCMatrix",
409 : bates 1037 validity =
410 :     function(object) .Call("lCholCMatrix_validate", object, PACKAGE = "Matrix")
411 :     )
412 : bates 730
413 : bates 1150 setClass("CHMfactor", # cholmod_factor struct as S4 object
414 :     representation(perm = "integer", type = "integer", "VIRTUAL"),
415 :     validity =
416 :     function(object) .Call("CHMfactor_validate", object, PACKAGE = "Matrix")
417 :     )
418 :    
419 :     setClass("CHMsuper", # supernodal cholmod_factor
420 :     representation(super = "integer", pi = "integer", px = "integer",
421 :     s = "integer", "VIRTUAL"),
422 :     contains = "CHMfactor",
423 :     validity =
424 :     function(object) .Call("CHMsuper_validate", object, PACKAGE = "Matrix"))
425 :    
426 :     setClass("CHMsimpl", # simplicial cholmod_factor
427 :     representation(colcount = "integer", p = "integer", i = "integer",
428 :     nz = "integer", nxt = "integer", prv = "integer", "VIRTUAL"),
429 :     contains = "CHMfactor",
430 :     validity =
431 :     function(object) .Call("CHMsuper_validate", object, PACKAGE = "Matrix"))
432 :    
433 :     setClass("dCHMsuper", representation(x = "numeric"), contains = "CHMsuper")
434 :    
435 :     setClass("lCHMsuper", contains = "CHMsuper")
436 :    
437 :     setClass("dCHMsimpl", representation(x = "numeric"), contains = "CHMsimpl")
438 :    
439 :     setClass("lCHMsimpl", contains = "CHMsimpl")
440 :    
441 :    
442 : bates 638 ##-------------------- permutation ----------------------------------------
443 : maechler 513
444 : maechler 953 setClass("pMatrix", representation(perm = "integer"),
445 :     contains = "sparseMatrix",
446 : maechler 898 validity = function(object) {
447 : maechler 953 d <- object@Dim
448 :     if (d[2] != (n <- d[1])) return("pMatrix must be square")
449 : maechler 898 perm <- object@perm
450 :     if (length(perm) != n)
451 :     return(paste("length of 'perm' slot must be", n))
452 :     if(n > 0 &&
453 :     !(all(range(perm) == c(1, n)) && length(unique(perm)) == n))
454 :     return("'perm' slot is not a valid permutation")
455 :     TRUE
456 :     })
457 : bates 638
458 : maechler 953 ### Class Union : no inheritance, but is(*, <class>) :
459 : maechler 1189
460 :     ## Definition Packed := dense with length( . @x) < prod( . @Dim)
461 :     ## ~~~~~~
462 : maechler 953 setClassUnion("packedMatrix",
463 :     members = c("dspMatrix", "dppMatrix", "dtpMatrix",
464 : maechler 1189 "lspMatrix", "ltpMatrix", "diagonalMatrix"))
465 : maechler 953
466 :    
467 : maechler 513 ## --------------------- non-"Matrix" Classes --------------------------------
468 :    
469 : maechler 886 ## --- "General" (not Matrix at all) ----
470 :    
471 :     ## for 'i' in x[i] or A[i,] :
472 :     setClassUnion("index", members = c("numeric", "logical", "character"))
473 :    
474 :    
475 :     ## --- Matrix - related ----
476 :    
477 : bates 10 setClass("determinant",
478 : maechler 946 representation(modulus = "numeric",
479 : maechler 898 logarithm = "logical",
480 :     sign = "integer",
481 :     call = "call"))
482 : bates 10
483 : bates 1037 setClass("LU",
484 :     representation(x = "numeric", perm = "integer"),
485 :     validity = function(object) .Call("LU_validate", object, PACKAGE = "Matrix")
486 :     )
487 : bates 10
488 : bates 769 ## -------------------- lmer-related Classes --------------------------------
489 :    
490 :     setOldClass("data.frame")
491 :     setOldClass("family")
492 :     setOldClass("logLik")
493 :     setOldClass("terms")
494 :    
495 :     ## mixed effects representation
496 :     setClass("mer",
497 : bates 1150 representation(## original data
498 : maechler 898 flist = "list", # list of grouping factors
499 : bates 1150 Zt = "dgCMatrix", # sparse representation of Z'
500 :     X = "matrix", # X
501 :     y = "numeric", # y
502 : bates 1156 wts = "numeric", # weights
503 :     wrkres = "numeric",# working residuals (copy of y for LMMs)
504 : bates 1150 method = "character", # parameter estimation method
505 :     useScale = "logical", # should scale factor be included
506 :     family = "family", # glm family
507 :     call = "call", # call to model-fitting function
508 :     ## invariants derived from data structure
509 :     cnames = "list", # column names of model matrices
510 :     nc = "integer", # dimensions of blocks in Omega
511 :     Gp = "integer", # Pointers to groups of rows in Zt
512 :     ## quantities that vary when Z, X or y are updated
513 :     XtX = "dpoMatrix", # X'X
514 :     ZtZ = "dsCMatrix", # Z'Z
515 :     ZtX = "dgeMatrix", # Z'X
516 : maechler 1165 Zty = "numeric", # Z'y
517 :     Xty = "numeric", # X'y
518 : bates 1150 ## primary slots that vary during the optimization
519 :     ## When Omega is updated, these are updated
520 : maechler 898 Omega = "list", # list of relative precision matrices
521 : bates 1150 ## Cholesky factor of inflated [Z:X:y]'[Z:X:y]
522 :     L = "dCHMsuper", # sparse Cholesky factor of Z'Z + Omega
523 :     RZX = "dgeMatrix",
524 :     RXX = "dtrMatrix",
525 : maechler 1109 rZy = "numeric",
526 : bates 967 rXy = "numeric",
527 : bates 940 devComp = "numeric", # Components of deviance
528 :     deviance = "numeric", # Current deviance (ML and REML)
529 : bates 1150 ## Secondary slots only evaluated when requested.
530 : maechler 1165 fixef = "numeric",
531 : bates 1150 ranef = "numeric",
532 :     RZXinv = "dgeMatrix",
533 :     bVar = "list",
534 :     gradComp = "list",
535 :     ## status indicator
536 :     status = "logical"
537 : bates 963 )
538 :     )
539 : bates 940
540 : bates 769 ## Representation of a linear or generalized linear mixed effects model
541 :     setClass("lmer",
542 : maechler 1174 representation(assign = "integer", frame = "data.frame",
543 : maechler 898 terms = "terms"),
544 :     contains = "mer")
545 : maechler 848
546 : bates 1166 setClass("lmer.ranef", contains = "list")
547 : bates 769
548 :    

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