SCM

SCM Repository

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

Diff of /pkg/R/Matrix.R

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

revision 1390, Fri Aug 18 15:41:36 2006 UTC revision 1455, Mon Aug 28 15:35:44 2006 UTC
# Line 98  Line 98 
98    
99  Matrix <-  Matrix <-
100      function (data = NA, nrow = 1, ncol = 1, byrow = FALSE, dimnames = NULL,      function (data = NA, nrow = 1, ncol = 1, byrow = FALSE, dimnames = NULL,
101                sparse = NULL)                sparse = NULL, forceCheck = FALSE)
102  {  {
103      sparseDefault <- function(m)      sparseDefault <- function(m)
104          prod(dim(m)) > 2*sum(as(m, "matrix") != 0)          prod(dim(m)) > 2*sum(as(m, "matrix") != 0)
# Line 107  Line 107 
107      if(is.null(sparse) && (i.M || is(data, "matrix")))      if(is.null(sparse) && (i.M || is(data, "matrix")))
108          sparse <- sparseDefault(data)          sparse <- sparseDefault(data)
109    
110      if (i.M) {      doDN <- TRUE
111        if (i.M && !forceCheck) {
112          sM <- is(data,"sparseMatrix")          sM <- is(data,"sparseMatrix")
113          if((sparse && sM) || (!sparse && !sM))          if((sparse && sM) || (!sparse && !sM))
114              return(data)              return(data)
# Line 133  Line 134 
134                  sparse <- sparseDefault(data)                  sparse <- sparseDefault(data)
135              dimnames(data) <- dimnames              dimnames(data) <- dimnames
136          }          }
137      } else if (!is.null(dimnames))          doDN <- FALSE
138          dimnames(data) <- dimnames      }
   
139      ## 'data' is now a "matrix" or "Matrix"      ## 'data' is now a "matrix" or "Matrix"
140        if (doDN && !is.null(dimnames))
141            dimnames(data) <- dimnames
142    
143      ## check for symmetric / triangular / diagonal :      ## check for symmetric / triangular / diagonal :
144      isSym <- isSymmetric(data)      isSym <- isSymmetric(data)

Legend:
Removed from v.1390  
changed lines
  Added in v.1455

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