Mercurial > hg > octave-lyh
changeset 11624:81f0e11253e9 release-3-0-x
[3-0-0-branch @ 2008-01-28 19:38:13 by jwe]
author | jwe |
---|---|
date | Mon, 28 Jan 2008 19:40:41 +0000 |
parents | d00dcbc03a4c |
children | ccf8e0410ee0 |
files | src/ChangeLog src/DLD-FUNCTIONS/sort.cc src/ov-mapper.cc |
diffstat | 3 files changed, 34 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2008-01-28 David Bateman <dbateman@free.fr> + + * ov-mapper.cc (SPARSE_MAPPER_LOOP_2): Use data method instead of + elem in the case where F(0) is non-zero. + + * DLD-FUNCTIONS/sort.cc (ascending_compare, descending_compare): + Always instantiate the specialized double versions of these + functions so that the NaN values are correctly sorted in the + Sparse<double> sort. + 2008-01-24 Pascal Dupuis <Pascal.Dupuis@worldonline.be> * mxarray.h.in: Include <cstring>.
--- a/src/DLD-FUNCTIONS/sort.cc +++ b/src/DLD-FUNCTIONS/sort.cc @@ -742,6 +742,27 @@ #else +template class octave_sort<double>; +template class vec_index<double>; +template class octave_sort<vec_index<double> *>; + +#if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) +static octave_value_list +mx_sort (ArrayN<double> &m, int dim, sortmode mode); + +static octave_value_list +mx_sort_indexed (ArrayN<double> &m, int dim, sortmode mode); +#endif +#endif + +#if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) +static octave_value_list +mx_sort_sparse (Sparse<double> &m, int dim, sortmode mode); + +static octave_value_list +mx_sort_sparse_indexed (Sparse<double> &m, int dim, sortmode mode); +#endif + template <> bool ascending_compare (double a, double b) @@ -770,27 +791,6 @@ return (xisnan (a->vec) || (a->vec > b->vec)); } -template class octave_sort<double>; -template class vec_index<double>; -template class octave_sort<vec_index<double> *>; - -#if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) -static octave_value_list -mx_sort (ArrayN<double> &m, int dim, sortmode mode); - -static octave_value_list -mx_sort_indexed (ArrayN<double> &m, int dim, sortmode mode); -#endif -#endif - -#if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) -static octave_value_list -mx_sort_sparse (Sparse<double> &m, int dim, sortmode mode); - -static octave_value_list -mx_sort_sparse_indexed (Sparse<double> &m, int dim, sortmode mode); -#endif - // std::abs(Inf) returns NaN!! static inline double xabs (const Complex& x)
--- a/src/ov-mapper.cc +++ b/src/ov-mapper.cc @@ -1,7 +1,7 @@ /* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, - 2006, 2007 John W. Eaton + 2006, 2007, 2008 John W. Eaton This file is part of Octave. @@ -159,7 +159,8 @@ for (octave_idx_type i = M.cidx(j); i < M.cidx (j+1); i++) \ { \ OCTAVE_QUIT; \ - result.elem (M.ridx (i), j) = CONV (F (M.data(i))); \ + /* Use data instead of elem for better performance. */ \ + result.data (M.ridx (i) + j * nr) = CONV (F (M.data(i))); \ \ if (error_state) \ return retval; \