[Rd] "Math" group generics for S4, and a bug

From: Martin Maechler <maechler_at_stat.math.ethz.ch>
Date: Tue, 26 Jun 2007 19:15:40 +0200

>>>>> "MM" == Martin Maechler <maechler_at_stat.math.ethz.ch>
>>>>> on Sat, 23 Jun 2007 00:36:43 +0200 writes:

 {on R-help}

 [.....................]
 [.....................]
 

  >> Duncan Murdoch

      DM> You might have better luck with

      DM> log1p(tasa)

    MM> {very good point, thank you, Duncan!}

       DM> if the authors of the Matrix package have written a
       DM> method for log1p(); if not, you'll probably have to do
       DM> it yourself.

    MM> They have not yet.

    MM> Note however that this - and expm1() - would
    MM> automagically work for sparse matrices if these two
    MM> functions were part of the "Math" S4 group generic.

    MM> I'd say that there's only historical reason for them
    MM> *not* to be part of "Math", and I am likely going to     MM> propose to change this ....

I'm now going to propose ...

As I found, expm1() and log1p() already *HAVE BEEN* in the S3 "Math" group generic

   ``automagically by implementation''.
Just the documentation for this fact has been missing.

Hence, I've added that doc (uncommitted) and I'm about to add them to the S4 Math group as well. When doing so, I'd like to add few more functions to make S3 and S4 "Math" a bit more compatible : Consequently, I'm proposing to add the following functions to the S4 Math group generic :

When trying to do the above,
I'm pretty quickly successful for cummax & cummin, most probably because they are primitive functions. But I currently have problems for the other four, and in exploring these problems,
I've found that

   log10()

does not S4- dispatch on "Math" neither, which I think is a pretty peculiar bug;
I think if that was fixed, then my code changes would also work to make log1p(), expm1(), digamma() and trigamma() correctly part of "S4 - Math Group".

Martin



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue 26 Jun 2007 - 17:19:04 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 26 Jun 2007 - 20:37:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.