SCM

SCM Repository

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

Diff of /pkg/R/dsparseMatrix.R

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

revision 1330, Fri Jul 21 08:28:18 2006 UTC revision 1331, Sat Jul 22 17:59:53 2006 UTC
# Line 43  Line 43 
43  ## Group Methods, see ?Arith (e.g.)  ## Group Methods, see ?Arith (e.g.)
44  ## -----  ## -----
45    
46    ## Cheap version: work via "dgCMatrix" and use the group methods there:
47    ## NB: have also CsparseMatrix methods (-> ./Csparse.R )
48    ## which may preserve "symmetric", "triangular", ...
49    ## those must trigger *before* these [currently works via alphabetic order..!]
50  setMethod("Arith", ##  "+", "-", "*", "^", "%%", "%/%", "/"  setMethod("Arith", ##  "+", "-", "*", "^", "%%", "%/%", "/"
51            signature(e1 = "dsparseMatrix", e2 = "dsparseMatrix"),            signature(e1 = "dsparseMatrix", e2 = "dsparseMatrix"),
52            function(e1, e2) callGeneric(as(e1, "dgCMatrix"),            function(e1, e2) callGeneric(as(e1, "dgCMatrix"),
# Line 54  Line 58 
58            signature(e1 = "numeric", e2 = "dsparseMatrix"),            signature(e1 = "numeric", e2 = "dsparseMatrix"),
59            function(e1, e2) callGeneric(e1, as(e2, "dgCMatrix")))            function(e1, e2) callGeneric(e1, as(e2, "dgCMatrix")))
60    
61    
62  setMethod("Math",  setMethod("Math",
63            signature(x = "dsparseMatrix"),            signature(x = "dsparseMatrix"),
64            function(x) {            function(x) {
# Line 61  Line 66 
66                if(is(r, "dsparseMatrix")) as(r, class(x))                if(is(r, "dsparseMatrix")) as(r, class(x))
67            })            })
68    
69  if(FALSE) ## unneeded with "Math2" in ./dMatrix.R  ##  "Math2" is in ./dMatrix.R
 setMethod("Math2",  
           signature(x = "dsparseMatrix", digits = "numeric"),  
           function(x, digits) {  
               r <- callGeneric(as(x, "dgCMatrix"), digits = digits)  
               if(is(r, "dsparseMatrix")) as(r, class(x))  
           })  
70    
71    
72  ### cbind2 / rbind2  ### cbind2 / rbind2

Legend:
Removed from v.1330  
changed lines
  Added in v.1331

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