126 const Index m = order + 1;
142 gridpos(gp_trad, old_grid, new_grid, extpolfac);
143 }
else if (n_old == 1) {
148 for (
Index i = 0; i < n_new; ++i) {
150 gp_trad[i].fd[0] = 0;
151 gp_trad[i].fd[1] = 1;
158 for (
Index s = 0; s < n_new; ++s) {
166 k =
IMIN(
IMAX(gp_trad[s].idx - (m - 1) / 2, 0), n_old - m);
170 if (gp_trad[s].fd[0] <= 0.5)
173 k = gp_trad[s].idx + 1;
193 for (
Index i = 0; i < m; ++i) {
194 gp[s].idx[i] = k + i;
200 for (
Index j = 0; j < m; ++j)
201 if (j != i) num *= new_grid[s] - old_grid[k + j];
205 for (
Index j = 0; j < m; ++j)
206 if (j != i) denom *= old_grid[k + i] - old_grid[k + j];
208 gp[s].w[i] = num / denom;
247 gridpos_poly(agp, old_grid, new_grid, order, extpolfac);
286 if (old_grid[0] >= new_grid[new_grid.
nelem() - 1]) {
287 Vector shifted_old_grid = old_grid;
288 shifted_old_grid -= 360;
290 error_msg, shifted_old_grid, new_grid, order, extpolfac);
292 gridpos_poly(gp, shifted_old_grid, new_grid, order, extpolfac);
293 }
else if (old_grid[old_grid.
nelem() - 1] <= new_grid[0]) {
294 Vector shifted_old_grid = old_grid;
295 shifted_old_grid += 360;
297 error_msg, shifted_old_grid, new_grid, order, extpolfac);
298 gridpos_poly(gp, shifted_old_grid, new_grid, order, extpolfac);
338 Vector large_grid(new_n * 3);
340 large_grid[r_left] = old_grid_n1;
341 large_grid[r_left] -= 360.;
343 large_grid[
Range(new_n, new_n)] = old_grid_n1;
345 large_grid[r_right] = old_grid_n1;
346 large_grid[r_right] += 360.;
348 gridpos_poly(gp, large_grid, new_grid, order, extpolfac);
350 for (ArrayOfGridPosPoly::iterator itgp = gp.begin(); itgp != gp.end(); itgp++)
351 for (ArrayOfIndex::iterator iti = itgp->idx.begin(); iti != itgp->idx.end();
389 error_msg, agp, old_grid, new_grid, order, extpolfac);
442 #define LOOPW(x) for (ConstIterator1D x = t##x##begin; x != t##x##end; ++x)
446 const ConstIterator1D t##x##begin = t##x.w.begin(); \
447 const ConstIterator1D t##x##end = t##x.w.end();
456 for (ArrayOfIndex::const_iterator x = t##x##begin; x != t##x##end; ++x)
459 #define CACHEIDX(x) \
460 const ArrayOfIndex::const_iterator t##x##begin = t##x.idx.begin(); \
461 const ArrayOfIndex::const_iterator t##x##end = t##x.idx.end();
473 os <<
"idx: " << gp.
idx <<
"\n";
474 os <<
"w: " << gp.
w <<
"\n";
544 itw.
get(iti) = (*r) * (*c);
579 itw.
get(iti) = (*p) * (*r) * (*c);
619 itw.
get(iti) = (*b) * (*p) * (*r) * (*c);
664 itw.
get(iti) = (*s) * (*b) * (*p) * (*r) * (*c);
713 itw.
get(iti) = (*v) * (*s) * (*b) * (*p) * (*r) * (*c);
747 tia += a.
get(*c) * itw.
get(iti);
789 tia += a.
get(*r, *c) * itw.
get(iti);
835 tia += a.
get(*p, *r, *c) * itw.
get(iti);
886 tia += a.
get(*b, *p, *r, *c) * itw.
get(iti);
942 tia += a.
get(*s, *b, *p, *r, *c) * itw.
get(iti);
1002 tia += a.
get(*v, *s, *b, *p, *r, *c) * itw.
get(iti);
1031 assert(
is_size(itw, n, cgp[0].
w.nelem()));
1034 for (
Index i = 0; i < n; ++i) {
1070 itw.
get(i, iti) = *c;
1103 assert(
is_size(itw, n, rgp[0].
w.nelem() * cgp[0].w.
nelem()));
1106 for (
Index i = 0; i < n; ++i) {
1124 itw.
get(i, iti) = (*r) * (*c);
1164 for (
Index i = 0; i < n; ++i) {
1177 itw.
get(i, iti) = (*p) * (*r) * (*c);
1218 bgp[0].
w.nelem() * pgp[0].w.
nelem() * rgp[0].w.
nelem() *
1222 for (
Index i = 0; i < n; ++i) {
1238 itw.
get(i, iti) = (*b) * (*p) * (*r) * (*c);
1282 sgp[0].
w.nelem() * bgp[0].w.
nelem() * pgp[0].w.
nelem() *
1286 for (
Index i = 0; i < n; ++i) {
1305 itw.
get(i, iti) = (*s) * (*b) * (*p) * (*r) * (*c);
1352 vgp[0].
w.nelem() * sgp[0].w.
nelem() * bgp[0].w.
nelem() *
1356 for (
Index i = 0; i < n; ++i) {
1378 itw.
get(i, iti) = (*v) * (*s) * (*b) * (*p) * (*r) * (*c);
1407 assert(
is_size(itw, n, cgp[0].
w.nelem()));
1416 for (
Index i = 0; i < n; ++i) {
1428 tia += a.
get(*c) * itw.
get(i, iti);
1464 assert(
is_size(itw, n, rgp[0].
w.nelem() * cgp[0].w.
nelem()));
1473 for (
Index i = 0; i < n; ++i) {
1488 tia += a.
get(*r, *c) * itw.
get(i, iti);
1537 for (
Index i = 0; i < n; ++i) {
1555 tia += a.
get(*p, *r, *c) * itw.
get(i, iti);
1599 bgp[0].
w.nelem() * pgp[0].w.
nelem() * rgp[0].w.
nelem() *
1609 for (
Index i = 0; i < n; ++i) {
1630 tia += a.
get(*b, *p, *r, *c) * itw.
get(i, iti);
1677 sgp[0].
w.nelem() * bgp[0].w.
nelem() * pgp[0].w.
nelem() *
1687 for (
Index i = 0; i < n; ++i) {
1711 tia += a.
get(*s, *b, *p, *r, *c) * itw.
get(i, iti);
1761 vgp[0].
w.nelem() * sgp[0].w.
nelem() * bgp[0].w.
nelem() *
1771 for (
Index i = 0; i < n; ++i) {
1798 tia += a.
get(*v, *s, *b, *p, *r, *c) * itw.
get(i, iti);
1835 assert(
is_size(itw, nr, nc, rgp[0].
w.nelem() * cgp[0].w.
nelem()));
1838 for (
Index ir = 0; ir < nr; ++ir) {
1843 for (
Index ic = 0; ic < nc; ++ic) {
1859 itw.
get(ir, ic, iti) = (*r) * (*c);
1898 itw, np, nr, nc, pgp[0].
w.nelem() * rgp[0].w.
nelem() * cgp[0].w.
nelem()));
1901 for (
Index ip = 0; ip < np; ++ip) {
1904 for (
Index ir = 0; ir < nr; ++ir) {
1907 for (
Index ic = 0; ic < nc; ++ic) {
1916 itw.
get(ip, ir, ic, iti) = (*p) * (*r) * (*c);
1963 bgp[0].
w.nelem() * pgp[0].w.
nelem() * rgp[0].w.
nelem() *
1967 for (
Index ib = 0; ib < nb; ++ib) {
1970 for (
Index ip = 0; ip < np; ++ip) {
1973 for (
Index ir = 0; ir < nr; ++ir) {
1976 for (
Index ic = 0; ic < nc; ++ic) {
1986 itw.
get(ib, ip, ir, ic, iti) = (*b) * (*p) * (*r) * (*c);
2038 sgp[0].
w.nelem() * bgp[0].w.
nelem() * pgp[0].w.
nelem() *
2042 for (
Index is = 0; is <
ns; ++is) {
2045 for (
Index ib = 0; ib < nb; ++ib) {
2048 for (
Index ip = 0; ip < np; ++ip) {
2051 for (
Index ir = 0; ir < nr; ++ir) {
2054 for (
Index ic = 0; ic < nc; ++ic) {
2065 itw.
get(is, ib, ip, ir, ic, iti) =
2066 (*s) * (*b) * (*p) * (*r) * (*c);
2123 vgp[0].
w.nelem() * sgp[0].w.
nelem() * bgp[0].w.
nelem() *
2127 for (
Index iv = 0; iv < nv; ++iv) {
2130 for (
Index is = 0; is <
ns; ++is) {
2133 for (
Index ib = 0; ib < nb; ++ib) {
2136 for (
Index ip = 0; ip < np; ++ip) {
2139 for (
Index ir = 0; ir < nr; ++ir) {
2142 for (
Index ic = 0; ic < nc; ++ic) {
2154 itw.
get(iv, is, ib, ip, ir, ic, iti) =
2155 (*v) * (*s) * (*b) * (*p) * (*r) * (*c);
2196 assert(
is_size(itw, nr, nc, rgp[0].
w.nelem() * cgp[0].w.
nelem()));
2202 itw(0, 0,
Range(
joker)).sum(), 1, sum_check_epsilon));
2205 for (
Index ir = 0; ir < nr; ++ir) {
2210 for (
Index ic = 0; ic < nc; ++ic) {
2223 tia += a.
get(*r, *c) * itw.
get(ir, ic, iti);
2262 assert(
is_size(ia, np, nr, nc));
2264 itw, np, nr, nc, pgp[0].
w.nelem() * rgp[0].w.
nelem() * cgp[0].w.
nelem()));
2270 itw(0, 0, 0,
Range(
joker)).sum(), 1, sum_check_epsilon));
2273 for (
Index ip = 0; ip < np; ++ip) {
2276 for (
Index ir = 0; ir < nr; ++ir) {
2279 for (
Index ic = 0; ic < nc; ++ic) {
2286 Numeric& tia = ia(ip, ir, ic);
2293 tia += a.
get(*p, *r, *c) * itw.
get(ip, ir, ic, iti);
2336 assert(
is_size(ia, nb, np, nr, nc));
2342 bgp[0].
w.nelem() * pgp[0].w.
nelem() * rgp[0].w.
nelem() *
2349 itw(0, 0, 0, 0,
Range(
joker)).sum(), 1, sum_check_epsilon));
2352 for (
Index ib = 0; ib < nb; ++ib) {
2355 for (
Index ip = 0; ip < np; ++ip) {
2358 for (
Index ir = 0; ir < nr; ++ir) {
2361 for (
Index ic = 0; ic < nc; ++ic) {
2368 Numeric& tia = ia(ib, ip, ir, ic);
2376 tia += a.
get(*b, *p, *r, *c) * itw.
get(ib, ip, ir, ic, iti);
2423 assert(
is_size(ia,
ns, nb, np, nr, nc));
2430 sgp[0].
w.nelem() * bgp[0].w.
nelem() * pgp[0].w.
nelem() *
2437 itw(0, 0, 0, 0, 0,
Range(
joker)).sum(), 1, sum_check_epsilon));
2440 for (
Index is = 0; is <
ns; ++is) {
2443 for (
Index ib = 0; ib < nb; ++ib) {
2446 for (
Index ip = 0; ip < np; ++ip) {
2449 for (
Index ir = 0; ir < nr; ++ir) {
2452 for (
Index ic = 0; ic < nc; ++ic) {
2459 Numeric& tia = ia(is, ib, ip, ir, ic);
2469 a.
get(*s, *b, *p, *r, *c) * itw.
get(is, ib, ip, ir, ic, iti);
2520 assert(
is_size(ia, nv,
ns, nb, np, nr, nc));
2528 vgp[0].
w.nelem() * sgp[0].w.
nelem() * bgp[0].w.
nelem() *
2535 itw(0, 0, 0, 0, 0, 0,
Range(
joker)).sum(), 1, sum_check_epsilon));
2538 for (
Index iv = 0; iv < nv; ++iv) {
2541 for (
Index is = 0; is <
ns; ++is) {
2544 for (
Index ib = 0; ib < nb; ++ib) {
2547 for (
Index ip = 0; ip < np; ++ip) {
2550 for (
Index ir = 0; ir < nr; ++ir) {
2553 for (
Index ic = 0; ic < nc; ++ic) {
2560 Numeric& tia = ia(iv, is, ib, ip, ir, ic);
2570 tia += a.
get(*v, *s, *b, *p, *r, *c) *
2571 itw.
get(iv, is, ib, ip, ir, ic, iti);