[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: issorted & sortrows
From: |
John W. Eaton |
Subject: |
Re: issorted & sortrows |
Date: |
Thu, 12 Feb 2009 15:10:05 -0500 |
On 12-Feb-2009, dbateman wrote:
| Jaroslav Hajek-2 wrote:
|
| > I think these are used for sorting cell arrays.
|
| I confirm that they are used to sort cell string arrays
OK, I checked in the following change:
http://hg.savannah.gnu.org/hgweb/octave/rev/a669df7beb73
(sorry about the useless hg log message). This change restricts
sorting on cell arrays to cell arrays of strings only, by implementing
octave_cell::sort and octave_cell::sortrows_idx methods that ensure
that the cell array contains only strings, and then converts the array
of octave_value objects to an array of std::string objects before
doing the sort, then creates a new . It might be good to have a way
to avoid doing the conversion if the array is already sorted, but I
don't see a way to do that since the is_sorted functions always seem
to examine the values. Would it be worth caching the sort mode in the
Array? When creating a cell from an Array<std::string> object, we
could copy the sort mode as well, then the octave_cell::sort function
could skip the sort without having to first convert the
Array<octave_value> object to an Array<std::string> object.
Does that make sense? Does it seem worth the effort?
jwe
- issorted & sortrows, (continued)
- issorted & sortrows, John W. Eaton, 2009/02/11
- Re: issorted & sortrows, Jaroslav Hajek, 2009/02/11
- Re: issorted & sortrows, John W. Eaton, 2009/02/11
- Re: issorted & sortrows, Jaroslav Hajek, 2009/02/11
- Re: issorted & sortrows, David Bateman, 2009/02/11
- Re: issorted & sortrows, John W. Eaton, 2009/02/12
- Re: issorted & sortrows, Jaroslav Hajek, 2009/02/12
- Re: issorted & sortrows, John W. Eaton, 2009/02/12
- Re: issorted & sortrows, Jaroslav Hajek, 2009/02/12
- Re: issorted & sortrows, dbateman, 2009/02/12
- Re: issorted & sortrows,
John W. Eaton <=
- Re: issorted & sortrows, Jaroslav Hajek, 2009/02/12
- Re: issorted & sortrows, John W. Eaton, 2009/02/11
Re: issorted & sortrows, Jaroslav Hajek, 2009/02/11