SCM

SCM Repository

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

Diff of /pkg/R/AllClass.R

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1547, Mon Sep 11 14:49:39 2006 UTC revision 1548, Mon Sep 11 22:13:07 2006 UTC
# Line 3  Line 3 
3          options(max.print = 10000)#-> show() of large matrices          options(max.print = 10000)#-> show() of large matrices
4  }  }
5    
6    ## --- New "logic" class -- currently using "raw" instead of "logical"
7    ## LOGIC setClass("logic", contains = "raw")
8    
9  ## ------------- Virtual Classes ----------------------------------------  ## ------------- Virtual Classes ----------------------------------------
10    
11  ## Mother class of all Matrix objects  ## Mother class of all Matrix objects
# Line 54  Line 57 
57           representation(x = "integer", "VIRTUAL"), contains = "Matrix")           representation(x = "integer", "VIRTUAL"), contains = "Matrix")
58    
59  ## Virtual class of logical matrices  ## Virtual class of logical matrices
60  setClass("lMatrix", representation("VIRTUAL"), contains = "Matrix")  setClass("lMatrix",
61  ## Note that logical sparse matrices do not need an x slot so the x  ## LOGIC representation(x = "logic", "VIRTUAL"), contains = "Matrix")
62  ## slot is part of the ldenseMatrix class           representation(x = "logical", "VIRTUAL"), contains = "Matrix")
63    
64    ## Virtual class of nonzero pattern matrices
65    setClass("nMatrix", representation("VIRTUAL"), contains = "Matrix")
66    ## aka 'pattern' matrices -- have no x slot
67    
68  ## Virtual class of complex matrices  ## Virtual class of complex matrices
69  setClass("zMatrix", # letter 'z' is as in the names of Lapack subroutines  setClass("zMatrix", # letter 'z' is as in the names of Lapack subroutines
# Line 71  Line 78 
78           contains = c("dMatrix", "denseMatrix"))           contains = c("dMatrix", "denseMatrix"))
79    
80  ## Virtual class of dense, logical matrices  ## Virtual class of dense, logical matrices
81  setClass("ldenseMatrix", representation(x = "logical", "VIRTUAL"),  setClass("ldenseMatrix", representation("VIRTUAL"),
82           contains = c("lMatrix", "denseMatrix"))           contains = c("lMatrix", "denseMatrix"))
83    
84    ## Virtual class of dense, nonzero pattern matrices - rarely used, for completeness
85    setClass("ndenseMatrix", representation(x = "logical", "VIRTUAL"),
86             contains = c("nMatrix", "denseMatrix"))
87    
88  ## diagonal: has 'diag' slot;  diag = "U"  <--> have identity matrix  ## diagonal: has 'diag' slot;  diag = "U"  <--> have identity matrix
89  setClass("diagonalMatrix", representation(diag = "character", "VIRTUAL"),  setClass("diagonalMatrix", representation(diag = "character", "VIRTUAL"),
90           contains = "denseMatrix",           contains = "denseMatrix",
# Line 112  Line 123 
123  setClass("lsparseMatrix", representation("VIRTUAL"),  setClass("lsparseMatrix", representation("VIRTUAL"),
124           contains = c("lMatrix", "sparseMatrix"))           contains = c("lMatrix", "sparseMatrix"))
125    
126    ## these are the "pattern" matrices for "symbolic analysis" of sparse OPs:
127    setClass("nsparseMatrix", representation("VIRTUAL"),
128             contains = c("nMatrix", "sparseMatrix"))
129    
130  ## ------------------ Proper (non-virtual) Classes ----------------------------  ## ------------------ Proper (non-virtual) Classes ----------------------------
131    
132  ##----------------------  DENSE  -----------------------------------------  ##----------------------  DENSE  -----------------------------------------
# Line 169  Line 184 
184  ## numeric, dense, packed, positive-definite, symmetric matrices  ## numeric, dense, packed, positive-definite, symmetric matrices
185  setClass("dppMatrix", contains = "dspMatrix",  setClass("dppMatrix", contains = "dspMatrix",
186           validity = function(object) .Call(dppMatrix_validate, object)           validity = function(object) .Call(dppMatrix_validate, object)
          )  
187    
188    )
189  ##----- logical dense Matrices -- e.g. as result of <ddenseMatrix>  COMPARISON  ##----- logical dense Matrices -- e.g. as result of <ddenseMatrix>  COMPARISON
190    
191  ## numeric, dense, general matrices  ## logical, dense, general matrices
192  setClass("lgeMatrix", contains = c("ldenseMatrix", "generalMatrix"),  setClass("lgeMatrix", contains = c("ldenseMatrix", "generalMatrix"),
193           ## checks that length( @ x) == prod( @ Dim):           ## checks that length( @ x) == prod( @ Dim):
194           validity = function(object) stopifnot(length(object@x) == prod(object@Dim))           validity = function(object) stopifnot(length(object@x) == prod(object@Dim))
195           )           )
196  ## i.e. "lgeMatrix" cannot be packed, but "ldenseMatrix" can ..  ## i.e. "lgeMatrix" cannot be packed, but "ldenseMatrix" can ..
197    
198  ## numeric, dense, non-packed, triangular matrices  ## logical, dense, non-packed, triangular matrices
199  setClass("ltrMatrix",  setClass("ltrMatrix",
200           contains = c("ldenseMatrix", "triangularMatrix"),           contains = c("ldenseMatrix", "triangularMatrix"),
201           prototype = prototype(uplo = "U", diag = "N"))           prototype = prototype(uplo = "U", diag = "N"))
202    
203  ## numeric, dense, packed, triangular matrices  ## logical, dense, packed, triangular matrices
204  setClass("ltpMatrix",  setClass("ltpMatrix",
205           contains = c("ldenseMatrix", "triangularMatrix"),           contains = c("ldenseMatrix", "triangularMatrix"),
206           prototype = prototype(uplo = "U", diag = "N")           prototype = prototype(uplo = "U", diag = "N")
207           ## validity: ldense*, triangular*  should suffice           ## validity: ldense*, triangular*  should suffice
208           )           )
209    
210  ## numeric, dense, non-packed symmetric matrices  ## logical, dense, non-packed symmetric matrices
211  setClass("lsyMatrix",  setClass("lsyMatrix",
212           contains = c("ldenseMatrix", "symmetricMatrix"),           contains = c("ldenseMatrix", "symmetricMatrix"),
213           prototype = prototype(uplo = "U")           prototype = prototype(uplo = "U")
214           ##, validity = function(object) .Call(lsyMatrix_validate, object)           ##, validity = function(object) .Call(lsyMatrix_validate, object)
215           )           )
216    
217  ## numeric, dense, packed symmetric matrices  ## logical, dense, packed symmetric matrices
218  setClass("lspMatrix",  setClass("lspMatrix",
219           contains = c("ldenseMatrix", "symmetricMatrix"),           contains = c("ldenseMatrix", "symmetricMatrix"),
220           prototype = prototype(uplo = "U"),           prototype = prototype(uplo = "U"),
# Line 208  Line 223 
223           ## "dsp" and "lsp" have the same validate           ## "dsp" and "lsp" have the same validate
224           )           )
225    
226    ##----- nonzero pattern dense Matrices -- "for completeness"
227    
228    ## logical, dense, general matrices
229    setClass("ngeMatrix", contains = c("ndenseMatrix", "generalMatrix"),
230             ## checks that length( @ x) == prod( @ Dim):
231             validity = function(object) stopifnot(length(object@x) == prod(object@Dim))
232             )
233    ## i.e. "ngeMatrix" cannot be packed, but "ndenseMatrix" can ..
234    
235    ## logical, dense, non-packed, triangular matrices
236    setClass("ntrMatrix",
237             contains = c("ndenseMatrix", "triangularMatrix"),
238             prototype = prototype(uplo = "U", diag = "N"))
239    
240    ## logical, dense, packed, triangular matrices
241    setClass("ntpMatrix",
242             contains = c("ndenseMatrix", "triangularMatrix"),
243             prototype = prototype(uplo = "U", diag = "N")
244             ## validity: ldense*, triangular*  should suffice
245             )
246    
247    ## logical, dense, non-packed symmetric matrices
248    setClass("nsyMatrix",
249             contains = c("ndenseMatrix", "symmetricMatrix"),
250             prototype = prototype(uplo = "U")
251             ##, validity = function(object) .Call(lsyMatrix_validate, object)
252             )
253    
254    ## logical, dense, packed symmetric matrices
255    setClass("nspMatrix",
256             contains = c("ndenseMatrix", "symmetricMatrix"),
257             prototype = prototype(uplo = "U"),
258             validity = function(object)
259             .Call(dspMatrix_validate, object)
260             ## "dsp" and "nsp" have the same validate
261             )
262    
263    
264  ## 'diagonalMatrix' already has validity checking  ## 'diagonalMatrix' already has validity checking
265  ## diagonal, numeric matrices;      "d*" has 'x' slot :  ## diagonal, numeric matrices;      "d*" has 'x' slot :
266  setClass("ddiMatrix", contains = c("diagonalMatrix", "ddenseMatrix"))# or "dMatrix"  setClass("ddiMatrix", contains = c("diagonalMatrix", "ddenseMatrix"))# or "dMatrix"
# Line 318  Line 371 
371           contains = c("TsparseMatrix", "lsparseMatrix", "triangularMatrix"),           contains = c("TsparseMatrix", "lsparseMatrix", "triangularMatrix"),
372           prototype = prototype(uplo = "U", diag = "N"),           prototype = prototype(uplo = "U", diag = "N"),
373           validity =           validity =
374           function(object) .Call(ltTMatrix_validate, object)           function(object) .Call(dtTMatrix_validate, object)
375           )           )
376    
377  ## logical, sparse, triplet symmetric matrices  ## logical, sparse, triplet symmetric matrices
378  setClass("lsTMatrix",  setClass("lsTMatrix",
379           contains = c("TsparseMatrix", "lsparseMatrix", "symmetricMatrix"),           contains = c("TsparseMatrix", "lsparseMatrix", "symmetricMatrix"),
380           validity =           validity =
381           function(object) .Call(lsTMatrix_validate, object)           function(object) .Call(dsTMatrix_validate, object)
382           )           )
383    
384  ## logical, sparse, sorted compressed sparse column-oriented general matrices  ## logical, sparse, sorted compressed sparse column-oriented general matrices
# Line 374  Line 427 
427           function(object) .Call(lsRMatrix_validate, object)           function(object) .Call(lsRMatrix_validate, object)
428           )           )
429    
430    ##---------- nonzero pattern sparse matrix classes ---------------------------
431    
432    ## these classes are used in symbolic analysis to determine the
433    ## locations of non-zero entries
434    
435    ## nonzero pattern, sparse, triplet general matrices
436    setClass("ngTMatrix",
437             contains = c("TsparseMatrix", "nsparseMatrix", "generalMatrix"),
438             validity =
439             function(object) .Call(lgTMatrix_validate, object)
440             )
441    
442    ## nonzero pattern, sparse, triplet triangular matrices
443    setClass("ntTMatrix",
444             contains = c("TsparseMatrix", "nsparseMatrix", "triangularMatrix"),
445             prototype = prototype(uplo = "U", diag = "N"),
446             validity =
447             function(object) .Call(ltTMatrix_validate, object)
448             )
449    
450    ## nonzero pattern, sparse, triplet symmetric matrices
451    setClass("nsTMatrix",
452             contains = c("TsparseMatrix", "nsparseMatrix", "symmetricMatrix")
453             ##, validity = function(object) .Call(lsTMatrix_validate, object)
454             )
455    
456    ## nonzero pattern, sparse, sorted compressed column-oriented general matrices
457    setClass("ngCMatrix",
458             contains = c("CsparseMatrix", "nsparseMatrix", "generalMatrix"),
459             prototype = prototype(p = 0:0),# to be valid
460             validity =
461             function(object) .Call(lgCMatrix_validate, object)
462             )
463    
464    ## nonzero pattern, sparse, sorted compressed column-oriented triangular matrices
465    setClass("ntCMatrix",
466             contains = c("CsparseMatrix", "nsparseMatrix", "triangularMatrix"),
467             prototype = prototype(p = 0:0, uplo = "U", diag = "N"),# to be valid
468             validity =
469             function(object) .Call(ltCMatrix_validate, object)
470             )
471    
472    ## nonzero pattern, sparse, sorted compressed column-oriented symmetric matrices
473    setClass("nsCMatrix",
474             contains = c("CsparseMatrix", "nsparseMatrix", "symmetricMatrix"),
475             prototype = prototype(p = 0:0, uplo = "U"),# to be valid
476             validity =
477             function(object) .Call(lsCMatrix_validate, object)
478             )
479    
480    ## nonzero pattern, sparse, sorted compressed row-oriented general matrices
481    setClass("ngRMatrix",
482             representation(j = "integer", p = "integer"),
483             contains = c("RsparseMatrix", "nsparseMatrix", "generalMatrix"),
484             validity =
485             function(object) .Call(lgRMatrix_validate, object)
486             )
487    
488    ## nonzero pattern, sparse, sorted compressed row-oriented triangular matrices
489    setClass("ntRMatrix",
490             contains = c("RsparseMatrix", "nsparseMatrix", "triangularMatrix"),
491             validity =
492             function(object) .Call(ltRMatrix_validate, object)
493             )
494    
495    ## nonzero pattern, sparse, sorted compressed row-oriented symmetric matrices
496    setClass("nsRMatrix",
497             contains = c("RsparseMatrix", "nsparseMatrix", "symmetricMatrix"),
498             validity =
499             function(object) .Call(lsRMatrix_validate, object)
500             )
501    
502  ##-------------------- permutation ----------------------------------------  ##-------------------- permutation ----------------------------------------
503    
504  setClass("pMatrix", representation(perm = "integer"),  setClass("pMatrix", representation(perm = "integer"),
# Line 447  Line 572 
572    
573  setClass("dCHMsuper", contains = "CHMsuper", representation(x = "numeric"))  setClass("dCHMsuper", contains = "CHMsuper", representation(x = "numeric"))
574    
575  setClass("lCHMsuper", contains = "CHMsuper")  setClass("nCHMsuper", contains = "CHMsuper")
576    
577  setClass("dCHMsimpl", contains = "CHMsimpl", representation(x = "numeric"))  setClass("dCHMsimpl", contains = "CHMsimpl", representation(x = "numeric"))
578    
579  setClass("lCHMsimpl", contains = "CHMsimpl")  setClass("nCHMsimpl", contains = "CHMsimpl")
580    
581  ##--- LU ---  ##--- LU ---
582    

Legend:
Removed from v.1547  
changed lines
  Added in v.1548

R-Forge@R-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business University of Wisconsin - Madison Powered By FusionForge