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 1467, Wed Aug 30 21:35:09 2006 UTC revision 1472, Fri Sep 1 15:31:04 2006 UTC
# Line 13  Line 13 
13  setMethod("crossprod", signature(x = "ddenseMatrix", y = "dsparseMatrix"),  setMethod("crossprod", signature(x = "ddenseMatrix", y = "dsparseMatrix"),
14            function(x, y = NULL) callGeneric(as(x, "dgeMatrix"), y))            function(x, y = NULL) callGeneric(as(x, "dgeMatrix"), y))
15    
 setMethod("diag", signature(x = "dsparseMatrix"),  
           function(x, nrow, ncol = n) diag(as(x, "dgCMatrix")))  
   
16  ## and coerce dsparse* to dgC*  ## and coerce dsparse* to dgC*
17  ## setMethod("%*%", signature(x = "dsparseMatrix", y = "dgeMatrix"),  ## setMethod("%*%", signature(x = "dsparseMatrix", y = "dgeMatrix"),
18  ##           function(x, y) callGeneric(as(x, "dgCMatrix"), y))  ##           function(x, y) callGeneric(as(x, "dgCMatrix"), y))
# Line 46  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:  ##-> now moved to ./Csparse.R (and 'up' to ./sparseMatrix.R):
 ## NB: have also CsparseMatrix methods (-> ./Csparse.R )  
 ## which may preserve "symmetric", "triangular", ...  
 ## those must trigger *before* these [currently works via alphabetic order..!]  
 setMethod("Arith", ##  "+", "-", "*", "^", "%%", "%/%", "/"  
           signature(e1 = "dsparseMatrix", e2 = "dsparseMatrix"),  
           function(e1, e2) callGeneric(as(e1, "dgCMatrix"),  
                                        as(e2, "dgCMatrix")))  
 setMethod("Arith",  
           signature(e1 = "dsparseMatrix", e2 = "numeric"),  
           function(e1, e2) callGeneric(as(e1, "dgCMatrix"), e2))  
 setMethod("Arith",  
           signature(e1 = "numeric", e2 = "dsparseMatrix"),  
           function(e1, e2) callGeneric(e1, as(e2, "dgCMatrix")))  
   
   
 setMethod("Math",  
           signature(x = "dsparseMatrix"),  
           function(x) {  
               r <- callGeneric(as(x, "dgCMatrix"))  
               if(is(r, "dsparseMatrix")) as(r, class(x))  
           })  
   
47  ##  "Math2" is in ./dMatrix.R  ##  "Math2" is in ./dMatrix.R
48    
49    

Legend:
Removed from v.1467  
changed lines
  Added in v.1472

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