Displaying 3 results from an estimated 3 matches for "pmin2".
Did you mean:
pin2
2015 Dec 24
2
override pmin/pmax for my own matrix
Hello,
I'm trying to override pmin and pmax for my own matrix. These two
functions have ... as an argument. I tried to override them as
follows:
setMethod("pmax", class_name, function(x, ..., na.rm) { ... })
I use this way to override primitive functions such as min/max and it
works fine.
But it doesn't work for pmin and pmax. I guess because they are
regular functions?
How
2015 Dec 24
0
override pmin/pmax for my own matrix
...e="...")
setMethod("pmax", "Class", function(..., na.rm=FALSE) { })
One caveat is that all arguments passed via "..." must derive from the
class specified for "..." in the method signature. At some point we
should solve that by introducing a binary pmin2, pmax2 as we have for
cbind and rbind.
On Thu, Dec 24, 2015 at 5:54 AM, Da Zheng <zhengda1936 at gmail.com> wrote:
> Hello,
>
> I'm trying to override pmin and pmax for my own matrix. These two
> functions have ... as an argument. I tried to override them as
> follows:
&g...
2005 Dec 20
0
pmin(), pmax() - slower than necessary for common cases
...;- function(k,x) (x+k - abs(x-k))/2
pmax. <- function(k,x) (x+k + abs(x-k))/2
are probably the fastest way of computing pmin() and pmax() of
two arguments {yes, they "suffer" from rounding error of about 1
to 2 bits...} currently in R.
One "solution" could be to provide pmin2() and pmax2()
functions based on trival .Internal() versions.
The experiments below are for the special case of k=0 where I
found the above mentioned factor of 19 which is a bit
overoptimistic for the general case; here is my pmax-ex.R source file
(as text/plain attachment ASCII-code --> ea...