SCM

SCM Repository

[matrix] Diff of /pkg/Matrix/R/Ops.R
ViewVC logotype

Diff of /pkg/Matrix/R/Ops.R

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

revision 3202, Tue Jan 31 14:59:23 2017 UTC revision 3203, Tue Jan 31 15:46:36 2017 UTC
# Line 71  Line 71 
71    
72  ## bail-outs -- on highest possible level, hence "Ops", not "Compare"/"Arith" :  ## bail-outs -- on highest possible level, hence "Ops", not "Compare"/"Arith" :
73  .bail.out.Ops <- function(e1, e2) {  .bail.out.Ops <- function(e1, e2) {
74      if(is(e1, "Matrix") && is(e2, "Matrix"))      if(is(e1, "mMatrix") && is(e2, "mMatrix"))
75          dimCheck(e1,e2)          dimCheck(e1,e2)
76      .bail.out.2(.Generic, class(e1), class(e2))      .bail.out.2(.Generic, class(e1), class(e2))
77            }            }
78  setMethod("Ops", signature(e1 = "Matrix", e2 = "ANY"), .bail.out.Ops)  setMethod("Ops", signature(e1 = "Matrix", e2 = "ANY"),
79  setMethod("Ops", signature(e1 = "ANY", e2 = "Matrix"), .bail.out.Ops)            function(e1, e2) {
80                  if(is(e1, "mMatrix") && is(e2, "mMatrix")) dimCheck(e1,e2)
81                  if(is.matrix(e2) && identical(e2, as.matrix(e2)) &&
82                     is.object(e2) && !isS4(e2)) # e.g. for "table"
83                      callGeneric(e1, unclass(e2))
84                  else
85                      .bail.out.2(.Generic, class(e1), class(e2))
86              })
87    setMethod("Ops", signature(e1 = "ANY", e2 = "Matrix"),
88              function(e1, e2) {
89                  if(is(e1, "mMatrix") && is(e2, "mMatrix")) dimCheck(e1,e2)
90                  if(is.matrix(e1) && identical(e1, as.matrix(e1)) &&
91                     is.object(e1) && !isS4(e1)) # e.g. for "table"
92                      callGeneric(unclass(e1), e2)
93                  else
94                      .bail.out.2(.Generic, class(e1), class(e2))
95              })
96  rm(.bail.out.Ops)  rm(.bail.out.Ops)
97    
98  ## "General principle"  ## "General principle"

Legend:
Removed from v.3202  
changed lines
  Added in v.3203

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