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 512, Fri Feb 4 23:45:12 2005 UTC revision 513, Fri Feb 4 23:46:08 2005 UTC
# Line 1  Line 1 
 ## Ensure that the methods package is available  
1  .onLoad <- function(lib, pkg) {  .onLoad <- function(lib, pkg) {
2      require("methods", character = TRUE, quietly = TRUE)      if(is.null(getOption("max.print")))
3            options(max.print = 10000)#-> show() of large matrices
4  }  }
5    
6    ## ------------- Virtual Classes ----------------------------------------
7    
8  # Virtual class of all Matrix objects  # Virtual class of all Matrix objects
9  setClass("Matrix", representation(Dim = "integer"),  setClass("Matrix", representation(Dim = "integer"),
10           prototype = prototype(Dim = integer(2)),           prototype = prototype(Dim = integer(2)),
# Line 17  Line 19 
19    
20  # Virtual class of numeric matrices  # Virtual class of numeric matrices
21  setClass("dMatrix",  setClass("dMatrix",
22           representation(x = "numeric"),           representation(x = "numeric"), contains = "Matrix")
          contains = "Matrix")  
23    
24  # Virtual class of integer matrices  # Virtual class of integer matrices
25  setClass("iMatrix",  setClass("iMatrix",
26           representation(x = "integer"),           representation(x = "integer"), contains = "Matrix")
          contains = "Matrix")  
27    
28  # Virtual class of logical matrices  # Virtual class of logical matrices
29  setClass("lMatrix",  setClass("lMatrix",
30           representation(x = "logical"),           representation(x = "logical"), contains = "Matrix")
          contains = "Matrix")  
31    
32  # Virtual class of complex matrices  # Virtual class of complex matricesn
33  setClass("zMatrix", # letter 'z' is as in the names of Lapack subroutines  setClass("zMatrix", # letter 'z' is as in the names of Lapack subroutines
34           representation(x = "complex"),           representation(x = "complex"), contains = "Matrix")
          contains = "Matrix")  
35    
36  # Virtual class of dense, numeric matrices  # Virtual class of dense, numeric matrices
37  setClass("ddenseMatrix",  setClass("ddenseMatrix",
38           representation(rcond = "numeric", factors = "list"),           representation(rcond = "numeric", factors = "list"),
39           contains = "dMatrix")           contains = "dMatrix")
40    
41    ## ------------------ Proper (non-virtual) Classes ----------------------------
42    
43    ##----------------------  DENSE  -----------------------------------------
44    
45  # numeric, dense, general matrices  # numeric, dense, general matrices
46  setClass("dgeMatrix", contains = "ddenseMatrix",  setClass("dgeMatrix", contains = "ddenseMatrix",
47           validity = function(object) { ## checks the length of x is prod(Dim)           ## checks the length of x is prod(Dim):
48               .Call("dgeMatrix_validate", object)           validity = function(object) .Call("dgeMatrix_validate", object)
49           })           )
50    ## i.e. "dgeMatrix" cannot be packed, but "ddenseMatrix" can ..
51    
52  # numeric, dense, non-packed, triangular matrices  # numeric, dense, non-packed, triangular matrices
53  setClass("dtrMatrix",  setClass("dtrMatrix",
54           representation(uplo = "character", diag = "character"),           representation(uplo = "character", diag = "character"),
55           contains = "dgeMatrix",           contains = "dgeMatrix",
56           prototype = prototype(uplo = "U", diag = "N"),           prototype = prototype(uplo = "U", diag = "N"),
57           validity = function(object) {           validity = function(object) .Call("dtrMatrix_validate", object)
58               .Call("dtrMatrix_validate", object)           )
          })  
59    
60  # numeric, dense, packed, triangular matrices  # numeric, dense, packed, triangular matrices
61  setClass("dtpMatrix",  setClass("dtpMatrix",
62           representation(uplo = "character", diag = "character"),           representation(uplo = "character", diag = "character"),
63           contains = "ddenseMatrix",           contains = "ddenseMatrix",
64           prototype = prototype(uplo = "U", diag = "N"),           prototype = prototype(uplo = "U", diag = "N"),
65           validity = function(object) {           validity = function(object) .Call("dtpMatrix_validate", object)
66               .Call("dtpMatrix_validate", object)           )
          })  
67    
68  # numeric, dense, non-packed symmetric matrices  # numeric, dense, non-packed symmetric matrices
69  setClass("dsyMatrix",  setClass("dsyMatrix",
# Line 72  Line 73 
73           validity = function(object) .Call("dsyMatrix_validate", object)           validity = function(object) .Call("dsyMatrix_validate", object)
74           )           )
75    
76  # numeric, dense, non-packed symmetric matrices  # numeric, dense, packed symmetric matrices
77  setClass("dspMatrix",  setClass("dspMatrix",
78           representation(uplo = "character"),           representation(uplo = "character"),
79           prototype = prototype(uplo = "U"),           prototype = prototype(uplo = "U"),
80           contains = "dgeMatrix",           contains = "ddenseMatrix",
81           validity = function(object) .Call("dspMatrix_validate", object)           validity = function(object) .Call("dspMatrix_validate", object)
82           )           )
83    
# Line 90  Line 91 
91           validity = function(object) .Call("dppMatrix_validate", object)           validity = function(object) .Call("dppMatrix_validate", object)
92           )           )
93    
94    ##-------------------- S P A R S E ----------------------------------------
95    
96  # numeric, sparse, triplet general matrices  # numeric, sparse, triplet general matrices
97  setClass("dgTMatrix",  setClass("dgTMatrix",
98           representation(i = "integer", j = "integer", factors = "list"),           representation(i = "integer", j = "integer", factors = "list"),
# Line 154  Line 157 
157           )           )
158    
159  ## Compressed sparse column matrix in blocks  ## Compressed sparse column matrix in blocks
160  setClass("dgBCMatrix", representation(p = "integer", i = "integer", x = "array"))  setClass("dgBCMatrix",
161             representation(p = "integer", i = "integer", x = "array"))
162    
163    setClass("Cholesky", contains = "dtrMatrix")
164    
165    setClass("dCholCMatrix",
166             representation(perm = "integer", Parent = "integer", D = "numeric"),
167             contains = "dtCMatrix",
168             validity = function(object) .Call("dCholCMatrix_validate", object))
169    
170    
171    ## --------------------- non-"Matrix" Classes --------------------------------
172    
173  setClass("determinant",  setClass("determinant",
174           representation(modulus ="numeric",           representation(modulus ="numeric",
# Line 164  Line 178 
178    
179  setClass("LU", representation(x = "numeric",  setClass("LU", representation(x = "numeric",
180                                pivot = "integer"),                                pivot = "integer"),
181           validity = function(object)           validity = function(object) .Call("LU_validate", object))
                     .Call("LU_validate", object))  
   
 setClass("Cholesky", contains = "dtrMatrix")  
   
 setClass("dCholCMatrix",  
          representation = representation(perm = "integer", Parent = "integer",  
          D = "numeric"),  
          contains = "dtCMatrix",  
          validity = function(object)  
            .Call("dCholCMatrix_validate", object))  
182    
183  setClass("sscCrosstab", representation =  setClass("sscCrosstab", representation =
184           representation(Gp = "integer", perm = "integer"),           representation(Gp = "integer", perm = "integer"),
185           contains = "dsCMatrix",           contains = "dsCMatrix",
186           validity = function(object)           validity = function(object) .Call("sscCrosstab_validate", object))
            .Call("sscCrosstab_validate", object))  
187    
188  setClass("ssclme", representation =  setClass("ssclme", representation =
189           representation(           representation(

Legend:
Removed from v.512  
changed lines
  Added in v.513

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