From maintainers-request at octave dot org Tue Sep 14 16:27:10 2004 Subject: Re: Cell arrays of strings in "sort" and "unique" From: "John W. Eaton" To: David Bateman Cc: maintainers at octave dot org, Keith Goodman Date: Tue, 14 Sep 2004 17:26:15 -0400 On 14-Sep-2004, David Bateman 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. | 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. | 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. jwe