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: Thu, 31 Jan 2008 10:09:33 +0100
User-agent: Thunderbird 2.0.0.6 (X11/20070914)

John W. Eaton wrote:
> On 27-Jan-2008, 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.
>
> Agreed.
>
> | 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?
>
> I'd like to make this change, and similar changes for other functions
> like max and min so that we can avoid the conditionals in the DEFUN
> functions, and so that other data types can be handled simply by
> defining the appropriate method in the octave_value class hierarchy.
>
> Do you see a reason to not do it?
>
> jwe
>
>   
I see no reason not to do, but there are many ways to do it, and maybe
you don't agree with the one I picked.. Since if this patch is accepted
it'll be the model for how the others are converted to behave in a
similar manner it makes sense to get the way its implemented to be the
closest to what you'd like to see.

Note that I have a new version of this patch that adds tests for cell
string arrays and int -> octave_idx_type changes in oct-sort.{cc,h} for
64-bit platforms, though that doesn't change the basic idea of the patch
and so I won't send it to the list to avoid mail bombing everyone.

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]