Mercurial > hg > octave-terminal
changeset 9842:10519b4d6507
fix indexed numel for non-numeric indices
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 20 Nov 2009 08:19:42 +0100 |
parents | 6f1ea8241c99 |
children | 71483d19204f |
files | src/ChangeLog src/utils.cc |
diffstat | 2 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2009-11-20 Jaroslav Hajek <highegg@gmail.com> + + * utils.cc (dims_to_numel): Fallback to index_vector query for + non-numeric types. + 2009-11-20 Jaroslav Hajek <highegg@gmail.com> * ov-bool.h (octave_bool::is_numeric_type): New overload.
--- a/src/utils.cc +++ b/src/utils.cc @@ -1027,10 +1027,18 @@ retval = 1; for (octave_idx_type i = 0; i < len; i++) { - if (idx(i).is_magic_colon ()) + octave_value idxi = idx(i); + if (idxi.is_magic_colon ()) retval *= dv(i); + else if (idxi.is_numeric_type ()) + retval *= idxi.numel (); else - retval *= idx(i).numel (); + { + idx_vector jdx = idxi.index_vector (); + if (error_state) + break; + retval *= jdx.length (dv(i)); + } } }