41 if (n == dimensions.
length ())
43 for (
int i = 0; i < n; i++)
45 if (ra_idx(i) < 0 || ra_idx(i) >= dimensions(i))
62 ra_idx(start_dimension)++;
64 int n = ra_idx.
length () - 1;
65 int nda = dimensions.
length ();
67 for (
int i = start_dimension; i < n; i++)
69 if (ra_idx(i) < (i < nda ? dimensions(i) : 1))
127 for (
int i = 0; i < n; i ++)
150 for (
int i = 0; i < n; i ++)
182 if (n >= dims.
numel ())
195 if (j >= dims.
numel (1))
198 return j*dims(0) + i;
205 if (i < 0 || j < 0 || k < 0)
211 if (k >= dims.
numel (2))
214 return (k*dims(1) + j)*dims(0) + i;
220 int nd = ra_idx.
length ();
222 for (
int d = 0;
d < nd;
d++)
226 if (ra_idx(
d) >= dv(
d))
239 retval(i) = a(i).
elem (0);
262 assert (n == dimensions.
length ());
266 static const char *tag[3] = {
"row",
"column", 0 };
268 for (
int i = 0; i < n; i++)
269 retval(i) = ra_idx(i).freeze (dimensions(i), tag[i < 2 ? i : 3],
280 bool found_first =
false;
282 for (
int i = 0; i < n; i++)
324 if (ra_idx(i).orig_empty ())
342 int n = frozen_lengths.
length ();
348 if (! ra_idx(i).is_colon_equiv (frozen_lengths(i)))
384 retval(i) = ra_idx(i).
elem (result_idx(i));
394 int n_dims = dims.
length ();
398 for (
int i = 0; i < n_dims; i++)
401 assert (idx > 0 || idx < dims.
numel ());
410 for (
int i = 0; i < n_dims; i++)
412 std::cout <<
"idx: " << idx <<
", var: " << var
413 <<
", dims(" << i <<
"): " << dims(i) <<
"\n";
414 retval(i) = ((
int)
floor(((idx) / (
double)var))) % dims(i);
415 idx -= var * retval(i);
428 bool *
scalar =
new bool [ial], *colon =
new bool [ial];
431 bool all_colons =
true;
432 for (
int i = 0; i < ial; i++)
435 scalar[i] = ia(i).is_scalar ();
436 colon[i] = ia(i).is_colon ();
437 if (! scalar[i]) nonsc++;
438 if (! colon[i]) rdv(i) = ia(i).extent (0);
439 all_colons = all_colons && colon[i];
449 else if (nonsc == rhdvl)
451 for (
int i = 0, j = 0; i < ial; i++)
453 if (scalar[i])
continue;
463 int rhdv0l = rhdv0.
length ();
464 for (
int i = 0, j = 0; i < ial; i++)
466 if (scalar[i])
continue;
468 rdv(i) = (j < rhdv0l) ? rhdv0(j++) : 1;
484 if (icol && jcol && rhdv.
length () == 2)
489 else if (rhdv.
length () == 2
492 rdv(0) = icol ? rhdv(0) : i.
extent (0);
493 rdv(1) = jcol ? rhdv(1) : j.
extent (0);
521 :
ind(_ind),
n(_n) { }
535 bool all_ranges =
true;
543 all_ranges = all_ranges && idx.
is_range ();
546 else if (clen != idx.
length (n))
560 idx = idx * dvx(i) + idxa(i)(0);
563 else if (all_ranges && clen != 0)
570 start = start * dvx(i) + xstart;
571 step = step * dvx(i) + xstep;
585 idxa(i).copy_data (idx_vec);
604 if (idx.
extent (numel) > numel)
613 retval(j) = k % dv(j);
630 rdata[j](i) = k % dv(j);
636 retval(j) = rdata[j];