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 1174 - (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 898 contains = c("dgeMatrix", "symmetricMatrix"),
149 :     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 :     contains = c("lgeMatrix", "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 :     prototype = prototype(uplo = "U"),
205 : maechler 1165 contains = c("ldenseMatrix", "symmetricMatrix"),
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 :     setClass("ddiMatrix", contains = c("diagonalMatrix", "dMatrix"))
214 :     ## 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 953 representation(j = "integer", p = "integer"),
283 : maechler 1165 contains = c("dsparseMatrix", "generalMatrix"),
284 :     prototype = prototype(p = 0:0),
285 : bates 1037 ##TODO: validity = function(object) .Call("dgRMatrix_validate", object, PACKAGE = "Matrix")
286 : maechler 898 )
287 : bates 477
288 : maechler 946 ## numeric, sparse, sorted compressed sparse row-oriented triangular matrices
289 : bates 477 setClass("dtRMatrix",
290 : maechler 1174 contains = c("RsparseMatrix", "dsparseMatrix", "triangularMatrix"),
291 : maechler 1165 prototype = prototype(p = 0:0, uplo = "U", diag = "N"),# to be valid
292 : maechler 1174 ##TODO: validity = function(object) .Call("dtRMatrix_validate", object, PACKAGE = "Matrix")
293 : maechler 1165
294 : maechler 898 )
295 : bates 477
296 : maechler 946 ## numeric, sparse, sorted compressed sparse row-oriented symmetric matrices
297 : bates 477 setClass("dsRMatrix",
298 : maechler 1174 contains = c("RsparseMatrix", "dsparseMatrix", "symmetricMatrix"),
299 : maechler 1165 prototype = prototype(p = 0:0, uplo = "U"),# to be valid
300 : bates 1037 ##TODO: validity = function(object) .Call("dsRMatrix_validate", object, PACKAGE = "Matrix")
301 : maechler 898 )
302 : bates 477
303 : bates 692 ##---------- logical sparse matrix classes --------------------------------
304 :    
305 :     ## these classes are used in symbolic analysis to determine the
306 : maechler 848 ## locations of non-zero entries
307 : bates 692
308 : maechler 946 ## logical, sparse, triplet general matrices
309 : bates 692 setClass("lgTMatrix",
310 : maechler 1165 contains = c("TsparseMatrix", "lsparseMatrix", "generalMatrix"),
311 : bates 1037 validity =
312 :     function(object) .Call("lgTMatrix_validate", object, PACKAGE = "Matrix")
313 : maechler 898 )
314 : bates 692
315 : maechler 946 ## logical, sparse, triplet triangular matrices
316 : bates 692 setClass("ltTMatrix",
317 : bates 922 contains = c("TsparseMatrix", "lsparseMatrix", "triangularMatrix"),
318 : maechler 1109 prototype = prototype(uplo = "U", diag = "N"),
319 : bates 1037 validity =
320 :     function(object) .Call("ltTMatrix_validate", object, PACKAGE = "Matrix")
321 : maechler 898 )
322 : bates 692
323 : maechler 946 ## logical, sparse, triplet symmetric matrices
324 : bates 692 setClass("lsTMatrix",
325 : maechler 1165 contains = c("TsparseMatrix", "lsparseMatrix", "symmetricMatrix"),
326 : bates 1037 validity =
327 :     function(object) .Call("lsTMatrix_validate", object, PACKAGE = "Matrix")
328 : maechler 898 )
329 : bates 692
330 : maechler 946 ## logical, sparse, sorted compressed sparse column-oriented general matrices
331 : bates 692 setClass("lgCMatrix",
332 : maechler 1165 contains = c("lsparseMatrix", "CsparseMatrix", "generalMatrix"),
333 : maechler 898 prototype = prototype(p = 0:0),# to be valid
334 : bates 1037 validity =
335 :     function(object) .Call("lgCMatrix_validate", object, PACKAGE = "Matrix")
336 : maechler 898 )
337 : bates 692
338 : maechler 946 ## logical, sparse, sorted compressed sparse column-oriented triangular matrices
339 : bates 692 setClass("ltCMatrix",
340 : bates 922 contains = c("lsparseMatrix", "CsparseMatrix", "triangularMatrix"),
341 : maechler 898 prototype = prototype(p = 0:0, uplo = "U", diag = "N"),# to be valid
342 : bates 1037 validity =
343 :     function(object) .Call("ltCMatrix_validate", object, PACKAGE = "Matrix")
344 : maechler 898 )
345 : bates 692
346 : maechler 946 ## logical, sparse, sorted compressed sparse column-oriented symmetric matrices
347 : bates 692 setClass("lsCMatrix",
348 : maechler 1165 contains = c("lsparseMatrix", "CsparseMatrix", "symmetricMatrix"),
349 : maechler 898 prototype = prototype(p = 0:0, uplo = "U"),# to be valid
350 : bates 1037 validity =
351 :     function(object) .Call("lsCMatrix_validate", object, PACKAGE = "Matrix")
352 : maechler 898 )
353 : bates 692
354 : maechler 946 ## logical, sparse, sorted compressed sparse row-oriented general matrices
355 : bates 692 setClass("lgRMatrix",
356 : maechler 898 representation(j = "integer", p = "integer"),
357 :     contains = "lsparseMatrix",
358 : bates 1037 validity =
359 :     function(object) .Call("lgRMatrix_validate", object, PACKAGE = "Matrix")
360 : maechler 898 )
361 : bates 692
362 : maechler 946 ## logical, sparse, sorted compressed sparse row-oriented triangular matrices
363 : bates 692 setClass("ltRMatrix",
364 : maechler 898 contains = c("lgRMatrix", "triangularMatrix"),
365 : bates 1037 validity =
366 :     function(object) .Call("ltRMatrix_validate", object, PACKAGE = "Matrix")
367 : maechler 898 )
368 : bates 692
369 : maechler 946 ## logical, sparse, sorted compressed sparse row-oriented symmetric matrices
370 : bates 692 setClass("lsRMatrix",
371 : maechler 898 contains = c("lgRMatrix", "symmetricMatrix"),
372 : bates 1037 validity =
373 :     function(object) .Call("lsRMatrix_validate", object, PACKAGE = "Matrix")
374 : maechler 898 )
375 : bates 692
376 :     ## Factorization classes
377 :    
378 : maechler 513 setClass("Cholesky", contains = "dtrMatrix")
379 :    
380 : bates 1150 setClass("LDL", contains = "dtrMatrix")
381 :    
382 :     setClass("correlation", representation(sd = "numeric"), contains = "dpoMatrix")
383 :    
384 : bates 638 setClass("pCholesky", contains = "dtpMatrix")
385 :    
386 : bates 1037 setClass("BunchKaufman",
387 :     representation(perm = "integer"),
388 :     contains = "dtrMatrix",
389 :     validity =
390 :     function(object) .Call("BunchKaufman_validate", object, PACKAGE = "Matrix")
391 :     )
392 : bates 631
393 : bates 1037 setClass("pBunchKaufman",
394 :     representation(perm = "integer"),
395 :     contains = "dtpMatrix",
396 :     validity =
397 :     function(object) .Call("pBunchKaufman_validate", object, PACKAGE = "Matrix")
398 :     )
399 : bates 638
400 : maechler 513 setClass("dCholCMatrix",
401 : maechler 898 representation(perm = "integer", Parent = "integer", D = "numeric"),
402 :     contains = "dtCMatrix",
403 : bates 1037 validity =
404 :     function(object) .Call("dCholCMatrix_validate", object, PACKAGE = "Matrix")
405 :     )
406 : maechler 513
407 : bates 730 setClass("lCholCMatrix",
408 : maechler 898 representation(perm = "integer", Parent = "integer"),
409 :     contains = "ltCMatrix",
410 : bates 1037 validity =
411 :     function(object) .Call("lCholCMatrix_validate", object, PACKAGE = "Matrix")
412 :     )
413 : bates 730
414 : bates 1150 setClass("CHMfactor", # cholmod_factor struct as S4 object
415 :     representation(perm = "integer", type = "integer", "VIRTUAL"),
416 :     validity =
417 :     function(object) .Call("CHMfactor_validate", object, PACKAGE = "Matrix")
418 :     )
419 :    
420 :     setClass("CHMsuper", # supernodal cholmod_factor
421 :     representation(super = "integer", pi = "integer", px = "integer",
422 :     s = "integer", "VIRTUAL"),
423 :     contains = "CHMfactor",
424 :     validity =
425 :     function(object) .Call("CHMsuper_validate", object, PACKAGE = "Matrix"))
426 :    
427 :     setClass("CHMsimpl", # simplicial cholmod_factor
428 :     representation(colcount = "integer", p = "integer", i = "integer",
429 :     nz = "integer", nxt = "integer", prv = "integer", "VIRTUAL"),
430 :     contains = "CHMfactor",
431 :     validity =
432 :     function(object) .Call("CHMsuper_validate", object, PACKAGE = "Matrix"))
433 :    
434 :     setClass("dCHMsuper", representation(x = "numeric"), contains = "CHMsuper")
435 :    
436 :     setClass("lCHMsuper", contains = "CHMsuper")
437 :    
438 :     setClass("dCHMsimpl", representation(x = "numeric"), contains = "CHMsimpl")
439 :    
440 :     setClass("lCHMsimpl", contains = "CHMsimpl")
441 :    
442 :    
443 : bates 638 ##-------------------- permutation ----------------------------------------
444 : maechler 513
445 : maechler 953 setClass("pMatrix", representation(perm = "integer"),
446 :     contains = "sparseMatrix",
447 : maechler 898 validity = function(object) {
448 : maechler 953 d <- object@Dim
449 :     if (d[2] != (n <- d[1])) return("pMatrix must be square")
450 : maechler 898 perm <- object@perm
451 :     if (length(perm) != n)
452 :     return(paste("length of 'perm' slot must be", n))
453 :     if(n > 0 &&
454 :     !(all(range(perm) == c(1, n)) && length(unique(perm)) == n))
455 :     return("'perm' slot is not a valid permutation")
456 :     TRUE
457 :     })
458 : bates 638
459 : maechler 953 ### Class Union : no inheritance, but is(*, <class>) :
460 :     setClassUnion("packedMatrix",
461 :     members = c("dspMatrix", "dppMatrix", "dtpMatrix",
462 :     "lspMatrix", "ltpMatrix"))
463 :    
464 :    
465 : maechler 513 ## --------------------- non-"Matrix" Classes --------------------------------
466 :    
467 : maechler 886 ## --- "General" (not Matrix at all) ----
468 :    
469 :     ## for 'i' in x[i] or A[i,] :
470 :     setClassUnion("index", members = c("numeric", "logical", "character"))
471 :    
472 :    
473 :     ## --- Matrix - related ----
474 :    
475 : bates 10 setClass("determinant",
476 : maechler 946 representation(modulus = "numeric",
477 : maechler 898 logarithm = "logical",
478 :     sign = "integer",
479 :     call = "call"))
480 : bates 10
481 : bates 1037 setClass("LU",
482 :     representation(x = "numeric", perm = "integer"),
483 :     validity = function(object) .Call("LU_validate", object, PACKAGE = "Matrix")
484 :     )
485 : bates 10
486 : bates 769 ## -------------------- lmer-related Classes --------------------------------
487 :    
488 :     setOldClass("data.frame")
489 :     setOldClass("family")
490 :     setOldClass("logLik")
491 :     setOldClass("terms")
492 :    
493 :     ## mixed effects representation
494 :     setClass("mer",
495 : bates 1150 representation(## original data
496 : maechler 898 flist = "list", # list of grouping factors
497 : bates 1150 Zt = "dgCMatrix", # sparse representation of Z'
498 :     X = "matrix", # X
499 :     y = "numeric", # y
500 : bates 1156 wts = "numeric", # weights
501 :     wrkres = "numeric",# working residuals (copy of y for LMMs)
502 : bates 1150 method = "character", # parameter estimation method
503 :     useScale = "logical", # should scale factor be included
504 :     family = "family", # glm family
505 :     call = "call", # call to model-fitting function
506 :     ## invariants derived from data structure
507 :     cnames = "list", # column names of model matrices
508 :     nc = "integer", # dimensions of blocks in Omega
509 :     Gp = "integer", # Pointers to groups of rows in Zt
510 :     ## quantities that vary when Z, X or y are updated
511 :     XtX = "dpoMatrix", # X'X
512 :     ZtZ = "dsCMatrix", # Z'Z
513 :     ZtX = "dgeMatrix", # Z'X
514 : maechler 1165 Zty = "numeric", # Z'y
515 :     Xty = "numeric", # X'y
516 : bates 1150 ## primary slots that vary during the optimization
517 :     ## When Omega is updated, these are updated
518 : maechler 898 Omega = "list", # list of relative precision matrices
519 : bates 1150 ## Cholesky factor of inflated [Z:X:y]'[Z:X:y]
520 :     L = "dCHMsuper", # sparse Cholesky factor of Z'Z + Omega
521 :     RZX = "dgeMatrix",
522 :     RXX = "dtrMatrix",
523 : maechler 1109 rZy = "numeric",
524 : bates 967 rXy = "numeric",
525 : bates 940 devComp = "numeric", # Components of deviance
526 :     deviance = "numeric", # Current deviance (ML and REML)
527 : bates 1150 ## Secondary slots only evaluated when requested.
528 : maechler 1165 fixef = "numeric",
529 : bates 1150 ranef = "numeric",
530 :     RZXinv = "dgeMatrix",
531 :     bVar = "list",
532 :     gradComp = "list",
533 :     ## status indicator
534 :     status = "logical"
535 : bates 963 )
536 :     )
537 : bates 940
538 : bates 769 ## Representation of a linear or generalized linear mixed effects model
539 :     setClass("lmer",
540 : maechler 1174 representation(assign = "integer", frame = "data.frame",
541 : maechler 898 terms = "terms"),
542 :     contains = "mer")
543 : maechler 848
544 : bates 1166 setClass("lmer.ranef", contains = "list")
545 : bates 769
546 :    

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