Mercurial > octave-nkf
diff libinterp/octave-value/ov-base-sparse.cc @ 18195:1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
* ov-base-sparse.cc (octave_base_sparse<T>::map):
Special case for umap_xtolower and umap_xtoupper.
* ov-float.cc (octave_float_scalar::map): Likewise.
* ov-flt-re-mat.cc (octave_float_matrix::map): Likewise.
* ov-intx.h (OCTAVE_VALUE_INT_MATRIX_T::map,
OCTAVE_VALUE_INT_SCALAR_T::map): Likewise.
* ov-re-mat.cc (octave_matrix::map): Likewise.
* ov-scalar.cc (octave_scalar::map): Likewise.
* build-sparse-tests.sh, mappers.cc: Update tests.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 02 Jan 2014 22:44:37 -0500 |
parents | f1b59ef34eda |
children | 0d5721873d6b |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-base-sparse.cc Thu Jan 02 13:23:51 2014 -0800 +++ b/libinterp/octave-value/ov-base-sparse.cc Thu Jan 02 22:44:37 2014 -0500 @@ -440,11 +440,19 @@ octave_value octave_base_sparse<T>::map (octave_base_value::unary_mapper_t umap) const { + if (umap == umap_xtolower || umap == umap_xtoupper) + return matrix; + // Try the map on the dense value. + // FIXME: We should probably be smarter about this, especially for the + // cases that are expected to return sparse matrices. octave_value retval = this->full_value ().map (umap); // Sparsify the result if possible. + // FIXME: intentionally skip this step for string mappers. Is this wanted? + // FIXME: this will break if some well-meaning person rearranges the + // enum list in ov-base.h. if (umap >= umap_xisalnum && umap <= umap_xtoupper) return retval;