[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Cell arrays of strings in "sort" and "unique"
From: |
David Bateman |
Subject: |
Re: Cell arrays of strings in "sort" and "unique" |
Date: |
Wed, 15 Sep 2004 18:06:19 +0200 |
User-agent: |
Mutt/1.4.1i |
According to John W. Eaton <address@hidden> (on 09/14/04):
> On 14-Sep-2004, David Bateman <address@hidden> wrote:
>
> | I thought this was a bit crufty as a solution. However, given that the
> | basic sorting code is written as a template it would be relatively
> | painless to add sorting of cell arrays of strings as well. Should
> | probably clean up sort.cc in any case since the NDArray, complexNDArray
> | and charNDArray stuff might also be written as a template.
>
> Yes, I noticed that there is now a lot of duplicated code in sort.cc.
Well I've converted it all to use templates, and included sorting of
cell arrays of strings. However, ...
> | http://www.mathworks.com/access/helpdesk/help/techdoc/ref/sort.html
> |
> | it seems that matlab has also added a "mode" flag that can define
> | ascending or descending sorted order. Which again is relatively easy
> | to add, but again more work :-(
>
> The price of aiming at a moving target.
I have a problem in implementing the "descend" flag. Where are the
NaN's sorted? As this was introduced in R14, which I don't have access
to.. So I need some one to run the example
x = [Inf, NaN, -Inf, 3, 2, 1];
[a, ai] = sort (x, "ascend")
[a, ai] = sort (x, "descend")
x = [Inf, NaN, -Inf, 3, 2, 1I];
[a, ai] = sort (x, "ascend")
[a, ai] = sort (x, "descend")
> | However, if we are going to this level of compatiability, maybe we
> | should also revisit the complex sorting code and the decision to do
> | the sorting only on the absolute value rather than in a matlab
> | compatiable way. Then again maybe not as sorting non ordinate values
> | doesn't make much sense in any case.
>
> We might as well be compatible if it is not too difficult. In the old
> days, I think they only said that complex elements X were sorted by
> ABS(X), so I believe Octave was doing the compatible thing at some
> point. But now they say that matches are further sorted by ANGLE(X).
> I would think that it should not be too hard to add that to the
> complex comparison function.
Ok, as I have most of this stuff implemented, I'll do this at the same
time. At least I will when I get feedback on the above question
D.
--
David Bateman address@hidden
Motorola CRM +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax)
91193 Gif-Sur-Yvette FRANCE
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
- Re: Cell arrays of strings in "sort" and "unique", David Bateman, 2004/09/14
- Re: Cell arrays of strings in "sort" and "unique", John W. Eaton, 2004/09/14
- Re: Cell arrays of strings in "sort" and "unique",
David Bateman <=
- Re: Cell arrays of strings in "sort" and "unique", Quentin Spencer, 2004/09/15
- Re: Cell arrays of strings in "sort" and "unique", David Bateman, 2004/09/15
- Re: Cell arrays of strings in "sort" and "unique", Alois Schloegl, 2004/09/15
- Re: Cell arrays of strings in "sort" and "unique", John W. Eaton, 2004/09/15
- Re: Cell arrays of strings in "sort" and "unique", Alois Schloegl, 2004/09/16
Re: Cell arrays of strings in "sort" and "unique", David Bateman, 2004/09/15