SCM

SCM Repository

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

Diff of /pkg/R/Rsparse.R

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

revision 1766, Mon Feb 5 16:35:49 2007 UTC revision 1829, Thu Apr 26 06:35:20 2007 UTC
# Line 138  Line 138 
138  setMethod("band", "RsparseMatrix",  setMethod("band", "RsparseMatrix",
139            function(x, k1, k2, ...)            function(x, k1, k2, ...)
140            as(band(.R.2.C(x), k1 = k1, k2 = k2, ...), "RsparseMatrix"))            as(band(.R.2.C(x), k1 = k1, k2 = k2, ...), "RsparseMatrix"))
141    
142    
143    ## These two are obviously more efficient than going through Tsparse:
144    setMethod("colSums", signature(x = "dgRMatrix"),
145              function(x, na.rm = FALSE, dims = 1)
146              tapply1(x@x, factor(x@j, 0:(x@Dim[2]-1)), sum, na.rm = na.rm))
147    
148    setMethod("colMeans", signature(x = "dgRMatrix"),
149              function(x, na.rm = FALSE, dims = 1)
150              tapply1(x@x, factor(x@j, 0:(x@Dim[2]-1)), mean, na.rm = na.rm))
151    

Legend:
Removed from v.1766  
changed lines
  Added in v.1829

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