[Rd] cummax / cummin for complex numbers

Marc Schwartz marc_schwartz at me.com
Mon Jul 14 17:27:06 CEST 2014


Ah! That was not clear and this early on a Monday morning, insufficient caffeine levels are common. :-)

I can confirm that this is still an issue in 3.1.1, which is a version newer than what Michael is running and the current stable release. 

They appear to be still reversed in the current SVN trunk (aka R-Devel):

  https://svn.r-project.org/R/trunk/src/main/cum.c

Regards,

Marc

On Jul 14, 2014, at 10:18 AM, Duncan Temple Lang <dtemplelang at ucdavis.edu> wrote:

> I believe Michael's point is that the error messages
> are incorrect - referring to cunmax when cunmin was called
> and vice verse.
> 
> D.
> 
> On 7/14/14, 8:14 AM, Ben Bolker wrote:
>> Michael Haupt <michael.haupt <at> oracle.com> writes:
>> 
>>> 
>>> Dear all,
>>> 
>>> in R 3.1.0, this is happening:
>>> 
>>>> cummin(c(1+1i,2-3i,4+5i))
>>> Error in cummin(c(1 + (0+1i), 2 - (0+3i), 4 + (0+5i))) : 
>>>  'cummax' not defined for complex numbers
>>>> cummax(c(1+1i,2-3i,4+5i))
>>> Error in cummax(c(1 + (0+1i), 2 - (0+3i), 4 + (0+5i))) : 
>>>  'cummin' not defined for complex numbers
>>> 
>>> It may be fixed in R-devel, but I thought I'd mention it to make sure ...
>>> 
>>> Best,
>>> 
>>> Michael
>> 
>>  Well, it is documented in the development version:
>> 
>>   x: a numeric or complex (not ‘cummin’ or ‘cummax’) object, or an
>>          object that can be coerced to one of these.
>> 
>> I imagine the problem is in coming up with a good, consistent definition
>> of the min/max for complex numbers: would you prefer min/max modulus,
>> phase, real part, imaginary part ... ? max()/min() aren't even defined
>> for complex numbers in R ...



More information about the R-devel mailing list