[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
problem with sorting
From: |
John W. Eaton |
Subject: |
problem with sorting |
Date: |
Fri, 29 Sep 2006 13:07:25 -0400 |
I noticed this problem:
octave:1> typeinfo (int8 ([1,2;3,4]))
ans = int8 matrix
octave:2> typeinfo (sort (int8 ([1,2;3,4])))
ans = matrix
I think this should return an int8 matrix, to match the type of the
argument passed to sort.
In src/DLD-FUNCTIONS/sort.cc, we dispatch on type and only handle
NDArray, ComplexNDArray, charNDArray, and Cell objects. Integer
values are converted to NDArary objects, then sorted.
How should we fix this? Should we add a sort method to the
octave_value class hierarchy? That way the dispatching can be handled
by virtual methods in the octave_value class. Does anyone see
disadvantages to doing that?
jwe
- problem with sorting,
John W. Eaton <=