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

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