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 1347, Mon Aug 7 08:47:43 2006 UTC revision 1389, Fri Aug 18 13:53:33 2006 UTC
# Line 19  Line 19 
19  setMethod("as.array",  signature(x = "Matrix"), function(x) as(x, "matrix"))  setMethod("as.array",  signature(x = "Matrix"), function(x) as(x, "matrix"))
20    
21  ## head and tail apply to all Matrix objects for which subscripting is allowed:  ## head and tail apply to all Matrix objects for which subscripting is allowed:
22    if(paste(R.version$major, R.version$minor, sep=".") < "2.4") {
23  setMethod("head", signature(x = "Matrix"), utils:::head.matrix)  setMethod("head", signature(x = "Matrix"), utils:::head.matrix)
24  setMethod("tail", signature(x = "Matrix"), utils:::tail.matrix)  setMethod("tail", signature(x = "Matrix"), utils:::tail.matrix)
25    } else { # R 2.4.0 and newer
26        setMethod("head", signature(x = "Matrix"), utils::head.matrix)
27        setMethod("tail", signature(x = "Matrix"), utils::tail.matrix)
28    }
29  ## slow "fall back" method {subclasses should have faster ones}:  ## slow "fall back" method {subclasses should have faster ones}:
30  setMethod("as.vector", signature(x = "Matrix", mode = "missing"),  setMethod("as.vector", signature(x = "Matrix", mode = "missing"),
31            function(x) as.vector(as(x, "matrix")))            function(x) as.vector(as(x, "matrix")))
32    
33    ## mainly need these for "dMatrix" or "lMatrix" respectively, but why not general:
34    setMethod("as.numeric", signature(x = "Matrix"),
35              function(x, ...) as.numeric(as.vector(x)))
36    setMethod("as.logical", signature(x = "Matrix"),
37              function(x, ...) as.logical(as.vector(x)))
38    
39    
40  ## Note that isSymmetric is *not* exported  ## Note that isSymmetric is *not* exported
41  ## but that "base" has an isSymmetric() S3-generic since R 2.3.0  ## but that "base" has an isSymmetric() S3-generic since R 2.3.0

Legend:
Removed from v.1347  
changed lines
  Added in v.1389

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