SCM

SCM Repository

[bigmemory] Diff of /pkg/bigalgebra/R/methods.R
ViewVC logotype

Diff of /pkg/bigalgebra/R/methods.R

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

revision 423, Wed Dec 26 23:14:37 2012 UTC revision 471, Tue Nov 25 19:35:57 2014 UTC
# Line 65  Line 65 
65    function(e1,e2)    function(e1,e2)
66    {    {
67      op = .Generic[[1]]      op = .Generic[[1]]
68      if(length(e1)==1 && op=="*") return(daxpy(e1,e2))      if(length(e1)==1) {
69      switch(op,        if (op=="*")
70        `+` = daxpy(1.0,e1,e2),          return(daxpy(e1,e2))
71        `-` = daxpy(-1.0,e2,e1),        return(switch(op,
72            `+` = dadd(e2, e1, 1.0, 1),
73            `-` = dadd(e2, e1,-1.0, 1),
74        stop("Undefined operation")        stop("Undefined operation")
75      )        ))
76        }
77        stop("e1 is not a scalar")
78    }    }
79  )  )
80  setMethod("Arith",c(e1="big.matrix", e2="numeric"),  setMethod("Arith",c(e1="big.matrix", e2="numeric"),
81    function(e1,e2)    function(e1,e2)
82    {    {
83      op = .Generic[[1]]      op = .Generic[[1]]
84      if(length(e2)==1 && op=="*") return(daxpy(e2,e1))      if(length(e2)==1) {
85      switch(op,        if( op=="*")
86        `+` = daxpy(1.0,e1,e2),          return(daxpy(e2,e1))
87        `-` = daxpy(-1.0,e2,e1),        return(switch(op,
88            `+` = dadd(e1,e2, 1.0, 0),
89            `-` = dadd(e1,e2, -1.0, 0),
90        stop("Undefined operation")        stop("Undefined operation")
91      )        ))
92        }
93        stop("e2 is not a scalar")
94    }    }
95  )  )

Legend:
Removed from v.423  
changed lines
  Added in v.471

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