comparison libinterp/octave-value/ov-intx.h @ 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 e473c4853afc
children 76478d2da117
comparison
equal deleted inserted replaced
18194:1461b9cfac4e 18195:1b6db9303933
356 case umap_isinf: 356 case umap_isinf:
357 return boolNDArray (matrix.dims (), false); 357 return boolNDArray (matrix.dims (), false);
358 case umap_finite: 358 case umap_finite:
359 return boolNDArray (matrix.dims (), true); 359 return boolNDArray (matrix.dims (), true);
360 360
361 // Special cases for Matlab compatibility.
362 case umap_xtolower:
363 case umap_xtoupper:
364 return matrix;
365
361 default: 366 default:
362 { 367 {
368 // FIXME: we should be able to do better than converting to
369 // double here.
363 octave_matrix m (array_value ()); 370 octave_matrix m (array_value ());
364 return m.map (umap); 371 return m.map (umap);
365 } 372 }
366 } 373 }
367 } 374 }
656 case umap_isinf: 663 case umap_isinf:
657 return false; 664 return false;
658 case umap_finite: 665 case umap_finite:
659 return true; 666 return true;
660 667
668 // Special cases for Matlab compatibility.
669 case umap_xtolower:
670 case umap_xtoupper:
671 return scalar;
672
661 default: 673 default:
662 { 674 {
663 octave_scalar m (scalar_value ()); 675 octave_scalar m (scalar_value ());
664 return m.map (umap); 676 return m.map (umap);
665 } 677 }