SCM

SCM Repository

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

Diff of /pkg/R/dgTMatrix.R

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

revision 522, Mon Feb 7 09:25:25 2005 UTC revision 523, Mon Feb 7 09:25:50 2005 UTC
# Line 66  Line 66 
66                  }, ...)                  }, ...)
67        })        })
68    
69  ## MM: probably rather use groupGeneric "Arith" here -- or for "dgeMatrix" !  ## Uses the triplet convention of *adding* entries with same (i,j):
70  setMethod("+", signature(e1 = "dgTMatrix", e2 = "dgTMatrix"),  setMethod("+", signature(e1 = "dgTMatrix", e2 = "dgTMatrix"),
71            function(e1, e2) {            function(e1, e2) {
72                if (any(e1@Dim != e2@Dim))                if (any(e1@Dim != e2@Dim))
73                    error("Dimensions not compatible for addition")                    stop("Dimensions not compatible for addition")
74                new("dgTMatrix", i = c(e1@i, e2@i), j = c(e1@j, e2@j),                new("dgTMatrix", i = c(e1@i, e2@i), j = c(e1@j, e2@j),
75                    x = c(e1@x, e2@x), Dim = e1@Dim)                    x = c(e1@x, e2@x), Dim = e1@Dim)
76            })            })

Legend:
Removed from v.522  
changed lines
  Added in v.523

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