*** src/pt-loop.cc.orig 2003-10-28 22:07:59.000000000 +0100 --- src/pt-loop.cc 2004-06-25 02:18:56.000000000 +0200 *************** *** 241,246 **** --- 241,296 ---- } \ while (0) + #define DO_ND_LOOP(arg) \ + do \ + { \ + Array idx; \ + int ndims = dv.length (); \ + int dim = 0; \ + int steps; \ + \ + idx.resize (ndims, idx_vector (1)); \ + for (int i = 0; i < ndims; i++) \ + { \ + idx (i) = idx_vector (':'); \ + if (dv(i) > 1) \ + { \ + dim = i; \ + break; \ + } \ + } \ + steps = dv.numel () / dv (dim); \ + \ + for (int i = 0; i < steps; i++) \ + { \ + MAYBE_DO_BREAKPOINT; \ + \ + octave_value val (arg.index(idx)); \ + \ + bool quit = false; \ + \ + do_for_loop_once (ult, val, quit); \ + \ + quit = (i == steps - 1 ? true : quit); \ + \ + if (quit) \ + break; \ + \ + idx(dim+1) = idx_vector (idx(dim+1)(0) + 2); \ + for (int j = dim+1; j < ndims; j++) \ + { \ + if (idx(j)(0) < dv(j)) \ + break; \ + else \ + { \ + idx(j) = idx_vector (1); \ + idx(j+1) = idx_vector (idx(j+1)(0) + 2); \ + } \ + } \ + } \ + } \ + while (0) + void tree_simple_for_command::eval (void) { *************** *** 332,373 **** } else if (rhs.is_matrix_type ()) { ! Matrix m_tmp; ! ComplexMatrix cm_tmp; ! ! int nr; ! int steps; if (rhs.is_real_type ()) { ! m_tmp = rhs.matrix_value (); ! nr = m_tmp.rows (); ! steps = m_tmp.columns (); } else { ! cm_tmp = rhs.complex_matrix_value (); ! nr = cm_tmp.rows (); ! steps = cm_tmp.columns (); } if (error_state) goto cleanup; if (rhs.is_real_type ()) ! { ! if (nr == 1) ! DO_LOOP (m_tmp (0, i)); ! else ! DO_LOOP (m_tmp.extract (0, i, nr-1, i)); ! } else ! { ! if (nr == 1) ! DO_LOOP (cm_tmp (0, i)); ! else ! DO_LOOP (cm_tmp.extract (0, i, nr-1, i)); ! } } else if (rhs.is_map ()) { --- 382,409 ---- } else if (rhs.is_matrix_type ()) { ! NDArray m_tmp; ! ComplexNDArray cm_tmp; ! dim_vector dv; if (rhs.is_real_type ()) { ! m_tmp = rhs.array_value (); ! dv = m_tmp.dims (); } else { ! cm_tmp = rhs.complex_array_value (); ! dv = cm_tmp.dims (); } if (error_state) goto cleanup; if (rhs.is_real_type ()) ! DO_ND_LOOP(m_tmp); else ! DO_ND_LOOP(cm_tmp); } else if (rhs.is_map ()) { *************** *** 392,397 **** --- 428,439 ---- break; } } + else if (rhs.is_cell ()) + { + Cell c_tmp = rhs.cell_value (); + dim_vector dv = c_tmp.dims (); + DO_ND_LOOP(c_tmp); + } else { ::error ("invalid type in for loop expression near line %d, column %d", *** src/ov.h.orig 2004-06-25 02:29:50.000000000 +0200 --- src/ov.h 2004-02-20 22:16:54.000000000 +0100 *************** *** 199,205 **** octave_value (const Complex& C); octave_value (const ComplexMatrix& m); octave_value (const ComplexNDArray& cnda); - octave_value (const ArrayN& m); octave_value (const ComplexDiagMatrix& d); octave_value (const ComplexRowVector& v); octave_value (const ComplexColumnVector& v); --- 199,204 ----