R-alpha: Seg.faults with complex: factor(..), unique(..). Missing feature ``sort( complex(..) )''
Martin Maechler
Martin Maechler <maechler@stat.math.ethz.ch>
Tue, 8 Apr 97 10:43:55 +0200
1) Several functions still (0.50 - pre6)
give seg.faults when called with complex:
unique( 1i) --> segfault
In 'factor', levels are defaulted to 'sort(unique(x))'
which seg.faults factor( 1i).
Because of 'factor', table(..complex..) seg.faults,.....
2) sort ( complex ) [[Of course this is minor ..]]
You may not believe this can be useful, but...
I've been digging in old S-code which makes use of this (and also of unique(.))
Be
z = x + 1i*y; x,y real vectors
Then,
order(z) : <--> order(x,y)
This is how it is defined in S (but it is implemented via .Internal(..)).
One could add the following line to the definition of 'sort'
if(is.complex(x)) return( x[order(Re(x),Im(x))] )
which has the drawback of NOT using the 'partial' and 'na.last' arguments.
((This actually makes me think that
maybe 'order' should also accept these two)).
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-