Mercurial > hg > octave-terminal
changeset 10702:c49911ab7ac7
implement missing copy_data case in idx_vector (bug #30099)
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Mon, 14 Jun 2010 10:41:47 +0200 |
parents | 657e63dcfd88 |
children | 5eb420d92307 |
files | liboctave/ChangeLog liboctave/idx-vector.cc |
diffstat | 2 files changed, 18 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2010-06-14 Jaroslav Hajek <highegg@gmail.com> + + * idx-vector.cc (idx_vector::copy_data): Handle class_mask case. + (idx_vector::increment): Fix class_colon and add class_mask. + 2010-06-06 Michael Goffioul <michael.goffioul@gmail.com> * mx-op-defs.h (MNANCHK): Add matrix element type argument and use it
--- a/liboctave/idx-vector.cc +++ b/liboctave/idx-vector.cc @@ -1014,13 +1014,14 @@ { case class_colon: retval = 1; - // fall through... + break; case class_range: retval = dynamic_cast<idx_range_rep *> (rep) -> get_step (); break; case class_vector: + case class_mask: { if (length (0) > 1) retval = elem (1) - elem (0); @@ -1087,6 +1088,17 @@ } break; + case class_mask: + { + idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); + const bool *mask = r->get_data (); + octave_idx_type ext = r->extent (0); + for (octave_idx_type i = 0, j = 0; i < ext; i++) + if (mask[i]) + data[j++] = i; + } + break; + default: assert (false); break;