octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making sort a method of Array<T>, Sparse<T> and octave_value classes


From: David Bateman
Subject: Re: Making sort a method of Array<T>, Sparse<T> and octave_value classes
Date: Mon, 28 Jan 2008 11:03:55 +0100
User-agent: Thunderbird 2.0.0.6 (X11/20070914)

David Bateman wrote:
> There was some discussion before 3.0 to make functions like sort,
> spkron, min, max, etc members of the the octave_value classes so that
> the mess of if/else statements in these DEFUN functions might be
> removed. I chose to give the sort method this treatment first as it
> seemed to me to be probably the hardest to do and so is a good test of
> whether it is worth the effort, and yes its taken me a while to get it
> right.
>
> Find attached a patch that moves the sort function to be methods of
> Array<T> and Sparse<T> and then significantly simplifies the Fsort
> function. In fact it moves Fsort to data.cc and DLD-FUNCTIONS/sort.cc
> should also be removed.
>
> In any case, this patch is for discussion and to see whether its a good
> idea to do the same with other functions and if so which ones?
>
> Regards
> D.
>   
A couple of points about this patch that are different than the behavior
of Octave 3.0.0

* All Array<T> types are now sorted.. For example the boolean array's
were previously converted to double arrays before sorting them, but now
remain boolean after the sort.

* The Sparse<double> sort function on IEEE754 architectures gave
incorrect sorting of NaN values, as the specialized double comparison
operators for the double type that correctly sorts the NaN values were
not instantiated. Should I also send a patch for Octave 3.0.0 ?

D.

-- 
David Bateman                                address@hidden
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



reply via email to

[Prev in Thread] Current Thread [Next in Thread]