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 1664, Fri Nov 3 13:38:32 2006 UTC revision 1665, Fri Nov 3 23:18:07 2006 UTC
# Line 79  Line 79 
79      function (data = NA, nrow = 1, ncol = 1, byrow = FALSE, dimnames = NULL,      function (data = NA, nrow = 1, ncol = 1, byrow = FALSE, dimnames = NULL,
80                sparse = NULL, forceCheck = FALSE)                sparse = NULL, forceCheck = FALSE)
81  {  {
82      sparseDefault <- function(m)      sparseDefault <- function(m) prod(dim(m)) > 2*sum(isN0(as(m, "matrix")))
         prod(dim(m)) > 2*sum(is.na(m <- as(m, "matrix")) | m != 0)  
83    
84      i.M <- is(data, "Matrix")      i.M <- is(data, "Matrix")
85    
# Line 186  Line 185 
185  setMethod("tcrossprod", signature(x = "numeric", y = "Matrix"),  setMethod("tcrossprod", signature(x = "numeric", y = "Matrix"),
186            function(x, y = NULL)  callGeneric(as.matrix(x), y))            function(x, y = NULL)  callGeneric(as.matrix(x), y))
187    
188    ## maybe not optimal
189    setMethod("solve", signature(a = "Matrix", b = "missing"),
190              function(a, b, ...) solve(a, Diagonal(nrow(a))))
191    
192  setMethod("solve", signature(a = "Matrix", b = "numeric"),  setMethod("solve", signature(a = "Matrix", b = "numeric"),
193            function(a, b, ...) callGeneric(a, as.matrix(b)))            function(a, b, ...) callGeneric(a, as.matrix(b)))
194  ## when no sub-class method is found, bail out  ## when no sub-class method is found, bail out

Legend:
Removed from v.1664  
changed lines
  Added in v.1665

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