#include <iostream>
#include "interpolation_poly.h"
#include "interpolation.h"
#include "logic.h"
Go to the source code of this file.
Defines | |
#define | IMAX(a, b) |
#define | IMIN(a, b) |
#define | LOOPW(x) for ( ConstIterator1D x=t##x.w.begin(); x!=t##x.w.end(); ++x ) |
Macro for interpolation weight loops. | |
#define | LOOPIDX(x) for (ArrayOfIndex::const_iterator x=t##x.idx.begin(); x!=t##x.idx.end(); ++x) |
Macro for interpolation index loops. | |
Functions | |
void | gridpos_poly (ArrayOfGridPosPoly &gp, ConstVectorView old_grid, ConstVectorView new_grid, const Index order, const Numeric &extpolfac) |
Set up grid positions for higher order interpolation. | |
void | gridpos_poly (GridPosPoly &gp, ConstVectorView old_grid, const Numeric &new_grid, const Index order, const Numeric &extpolfac) |
gridpos_poly | |
ostream & | operator<< (ostream &os, const GridPosPoly &gp) |
Output operator for GridPosPoly. | |
void | interpweights (VectorView itw, const GridPosPoly &tc) |
Red 1D interpolation weights. | |
void | interpweights (VectorView itw, const GridPosPoly &tr, const GridPosPoly &tc) |
Red 2D interpolation weights. | |
void | interpweights (VectorView itw, const GridPosPoly &tp, const GridPosPoly &tr, const GridPosPoly &tc) |
Red 3D interpolation weights. | |
void | interpweights (VectorView itw, const GridPosPoly &tb, const GridPosPoly &tp, const GridPosPoly &tr, const GridPosPoly &tc) |
Red 4D interpolation weights. | |
void | interpweights (VectorView itw, const GridPosPoly &ts, const GridPosPoly &tb, const GridPosPoly &tp, const GridPosPoly &tr, const GridPosPoly &tc) |
Red 5D interpolation weights. | |
void | interpweights (VectorView itw, const GridPosPoly &tv, const GridPosPoly &ts, const GridPosPoly &tb, const GridPosPoly &tp, const GridPosPoly &tr, const GridPosPoly &tc) |
Red 6D interpolation weights. | |
Numeric | interp (ConstVectorView itw, ConstVectorView a, const GridPosPoly &tc) |
Red 1D Interpolate. | |
Numeric | interp (ConstVectorView itw, ConstMatrixView a, const GridPosPoly &tr, const GridPosPoly &tc) |
Red 2D Interpolate. | |
Numeric | interp (ConstVectorView itw, ConstTensor3View a, const GridPosPoly &tp, const GridPosPoly &tr, const GridPosPoly &tc) |
Red 3D Interpolate. | |
Numeric | interp (ConstVectorView itw, ConstTensor4View a, const GridPosPoly &tb, const GridPosPoly &tp, const GridPosPoly &tr, const GridPosPoly &tc) |
Red 4D Interpolate. | |
Numeric | interp (ConstVectorView itw, ConstTensor5View a, const GridPosPoly &ts, const GridPosPoly &tb, const GridPosPoly &tp, const GridPosPoly &tr, const GridPosPoly &tc) |
Red 5D Interpolate. | |
Numeric | interp (ConstVectorView itw, ConstTensor6View a, const GridPosPoly &tv, const GridPosPoly &ts, const GridPosPoly &tb, const GridPosPoly &tp, const GridPosPoly &tr, const GridPosPoly &tc) |
Red 6D Interpolate. | |
void | interpweights (MatrixView itw, const ArrayOfGridPosPoly &cgp) |
Compute 1D interpolation weights. | |
void | interpweights (MatrixView itw, const ArrayOfGridPosPoly &rgp, const ArrayOfGridPosPoly &cgp) |
Compute 2D interpolation weights for a sequence of positions. | |
void | interpweights (MatrixView itw, const ArrayOfGridPosPoly &pgp, const ArrayOfGridPosPoly &rgp, const ArrayOfGridPosPoly &cgp) |
Compute 3D interpolation weights for a sequence of positions. | |
void | interpweights (MatrixView itw, const ArrayOfGridPosPoly &bgp, const ArrayOfGridPosPoly &pgp, const ArrayOfGridPosPoly &rgp, const ArrayOfGridPosPoly &cgp) |
Compute 4D interpolation weights for a sequence of positions. | |
void | interpweights (MatrixView itw, const ArrayOfGridPosPoly &sgp, const ArrayOfGridPosPoly &bgp, const ArrayOfGridPosPoly &pgp, const ArrayOfGridPosPoly &rgp, const ArrayOfGridPosPoly &cgp) |
Compute 5D interpolation weights for a sequence of positions. | |
void | interpweights (MatrixView itw, const ArrayOfGridPosPoly &vgp, const ArrayOfGridPosPoly &sgp, const ArrayOfGridPosPoly &bgp, const ArrayOfGridPosPoly &pgp, const ArrayOfGridPosPoly &rgp, const ArrayOfGridPosPoly &cgp) |
Compute 6D interpolation weights for a sequence of positions. | |
void | interp (VectorView ia, ConstMatrixView itw, ConstVectorView a, const ArrayOfGridPosPoly &cgp) |
Interpolate 1D field. | |
void | interp (VectorView ia, ConstMatrixView itw, ConstMatrixView a, const ArrayOfGridPosPoly &rgp, const ArrayOfGridPosPoly &cgp) |
Interpolate 2D field to a sequence of positions. | |
void | interp (VectorView ia, ConstMatrixView itw, ConstTensor3View a, const ArrayOfGridPosPoly &pgp, const ArrayOfGridPosPoly &rgp, const ArrayOfGridPosPoly &cgp) |
Interpolate 3D field to a sequence of positions. | |
void | interp (VectorView ia, ConstMatrixView itw, ConstTensor4View a, const ArrayOfGridPosPoly &bgp, const ArrayOfGridPosPoly &pgp, const ArrayOfGridPosPoly &rgp, const ArrayOfGridPosPoly &cgp) |
Interpolate 4D field to a sequence of positions. | |
void | interp (VectorView ia, ConstMatrixView itw, ConstTensor5View a, const ArrayOfGridPosPoly &sgp, const ArrayOfGridPosPoly &bgp, const ArrayOfGridPosPoly &pgp, const ArrayOfGridPosPoly &rgp, const ArrayOfGridPosPoly &cgp) |
Interpolate 5D field to a sequence of positions. | |
void | interp (VectorView ia, ConstMatrixView itw, ConstTensor6View a, const ArrayOfGridPosPoly &vgp, const ArrayOfGridPosPoly &sgp, const ArrayOfGridPosPoly &bgp, const ArrayOfGridPosPoly &pgp, const ArrayOfGridPosPoly &rgp, const ArrayOfGridPosPoly &cgp) |
Interpolate 6D field to a sequence of positions. | |
void | interpweights (Tensor3View itw, const ArrayOfGridPosPoly &rgp, const ArrayOfGridPosPoly &cgp) |
Compute 2D interpolation weights for an entire field. | |
void | interpweights (Tensor4View itw, const ArrayOfGridPosPoly &pgp, const ArrayOfGridPosPoly &rgp, const ArrayOfGridPosPoly &cgp) |
Compute 3D interpolation weights for an entire field. | |
void | interpweights (Tensor5View itw, const ArrayOfGridPosPoly &bgp, const ArrayOfGridPosPoly &pgp, const ArrayOfGridPosPoly &rgp, const ArrayOfGridPosPoly &cgp) |
Compute 4D interpolation weights for an entire field. | |
void | interpweights (Tensor6View itw, const ArrayOfGridPosPoly &sgp, const ArrayOfGridPosPoly &bgp, const ArrayOfGridPosPoly &pgp, const ArrayOfGridPosPoly &rgp, const ArrayOfGridPosPoly &cgp) |
Compute 5D interpolation weights for an entire field. | |
void | interpweights (Tensor7View itw, const ArrayOfGridPosPoly &vgp, const ArrayOfGridPosPoly &sgp, const ArrayOfGridPosPoly &bgp, const ArrayOfGridPosPoly &pgp, const ArrayOfGridPosPoly &rgp, const ArrayOfGridPosPoly &cgp) |
Compute 6D interpolation weights for an entire field. | |
void | interp (MatrixView ia, ConstTensor3View itw, ConstMatrixView a, const ArrayOfGridPosPoly &rgp, const ArrayOfGridPosPoly &cgp) |
Interpolate 2D field to another 2D field. | |
void | interp (Tensor3View ia, ConstTensor4View itw, ConstTensor3View a, const ArrayOfGridPosPoly &pgp, const ArrayOfGridPosPoly &rgp, const ArrayOfGridPosPoly &cgp) |
Interpolate 3D field to another 3D field. | |
void | interp (Tensor4View ia, ConstTensor5View itw, ConstTensor4View a, const ArrayOfGridPosPoly &bgp, const ArrayOfGridPosPoly &pgp, const ArrayOfGridPosPoly &rgp, const ArrayOfGridPosPoly &cgp) |
Interpolate 4D field to another 4D field. | |
void | interp (Tensor5View ia, ConstTensor6View itw, ConstTensor5View a, const ArrayOfGridPosPoly &sgp, const ArrayOfGridPosPoly &bgp, const ArrayOfGridPosPoly &pgp, const ArrayOfGridPosPoly &rgp, const ArrayOfGridPosPoly &cgp) |
Interpolate 5D field to another 5D field. | |
void | interp (Tensor6View ia, ConstTensor7View itw, ConstTensor6View a, const ArrayOfGridPosPoly &vgp, const ArrayOfGridPosPoly &sgp, const ArrayOfGridPosPoly &bgp, const ArrayOfGridPosPoly &pgp, const ArrayOfGridPosPoly &rgp, const ArrayOfGridPosPoly &cgp) |
Interpolate 6D field to another 6D field. | |
Variables | |
const Numeric | sum_check_epsilon = 1e-6 |
The maximum difference from 1 that we allow for a sum check. |
Not only is the philosophy the same, these higher order functions also make direct use of the linear functions in some important cases.
Definition in file interpolation_poly.cc.
#define IMAX | ( | a, | |||
b | ) |
Value:
(imaxarg1=(a), imaxarg2=(b),(imaxarg1) > (imaxarg2) ?\ (imaxarg1) : (imaxarg2))
Definition at line 47 of file interpolation_poly.cc.
Referenced by gridpos_poly().
#define IMIN | ( | a, | |||
b | ) |
Value:
(iminarg1=(a), iminarg2=(b),(iminarg1) < (iminarg2) ?\ (iminarg1) : (iminarg2))
Definition at line 51 of file interpolation_poly.cc.
Referenced by gridpos_poly().
#define LOOPIDX | ( | x | ) | for (ArrayOfIndex::const_iterator x=t##x.idx.begin(); x!=t##x.idx.end(); ++x) |
Macro for interpolation index loops.
This is the same as LOOPW, but for loops over tx.idx. Since tx.idx is an ArrayOfIndex, not a Vector, we have to use a different type of iterator.
Definition at line 240 of file interpolation_poly.cc.
Referenced by interp().
#define LOOPW | ( | x | ) | for ( ConstIterator1D x=t##x.w.begin(); x!=t##x.w.end(); ++x ) |
Macro for interpolation weight loops.
We use the macro LOOPW to make the notation for the nested for loops in the interpweights functions more concise, and to avoid typing errors.
Should resolve to something like:
for ( Index x=0; x<tx.w.nelem(); ++x )
But with iterators:
for ( ConstIterator1D x=tx.w.begin(); x!=tx.w.end(); ++x )
Definition at line 232 of file interpolation_poly.cc.
Referenced by interpweights().
void gridpos_poly | ( | GridPosPoly & | gp, | |
ConstVectorView | old_grid, | |||
const Numeric & | new_grid, | |||
const Index | order, | |||
const Numeric & | extpolfac | |||
) |
gridpos_poly
Creates a grid position structure for higher order interpolation.
This is a gateway to the function for arrays of GridPosPoly, to be used for e.g. "red interpolation".
gp | The GridPos structure. |
old_grid | The original grid. | |
new_grid | The position where we want to have the interpolated value. | |
order | Interpolation order. 1 = linear, 2 = quadratic, etc.. The number of points used in the interpolation will be order+1. | |
extpolfac | Extrapolation factor. Default value is 0.5, which means that extrapolation of half of the last grid distance is allowed. You don't have to specify this. |
Definition at line 196 of file interpolation_poly.cc.
References gridpos_poly().
void gridpos_poly | ( | ArrayOfGridPosPoly & | gp, | |
ConstVectorView | old_grid, | |||
ConstVectorView | new_grid, | |||
const Index | order, | |||
const Numeric & | extpolfac | |||
) |
Set up grid positions for higher order interpolation.
This function performs the same task as gridpos, but for arbitrary orders of interpolation. (Linear is also possible, as a special case.)
The formula for calculating the weights w is taken from Numerical Recipes, 2nd edition, section 3.1, eq. 3.1.1.
gp | Output: An array of grid positions. | |
old_grid | Original grid. | |
new_grid | New grid. | |
order | Interpolation order. 1 = linear, 2 = quadratic, etc.. The number of points used in the interpolation will be order+1. | |
extpolfac | Extrapolation fraction. Should normally not be specified, then the default of 0.5 is used. |
Definition at line 89 of file interpolation_poly.cc.
References gridpos(), IMAX, IMIN, is_size(), and ConstVectorView::nelem().
Referenced by abs_lookupSetupBatch(), choose_abs_nls_pert(), choose_abs_t_pert(), GasAbsLookup::Extract(), gridpos_poly(), test07(), and test08().
void interp | ( | Tensor6View | ia, | |
ConstTensor7View | itw, | |||
ConstTensor6View | a, | |||
const ArrayOfGridPosPoly & | vgp, | |||
const ArrayOfGridPosPoly & | sgp, | |||
const ArrayOfGridPosPoly & | bgp, | |||
const ArrayOfGridPosPoly & | pgp, | |||
const ArrayOfGridPosPoly & | rgp, | |||
const ArrayOfGridPosPoly & | cgp | |||
) |
Interpolate 6D field to another 6D field.
This performs a "green" type interpolation of the field, that means that the grid position Arrays are interpreted as defining the grids for the interpolated field.
This function can be easily distinguished from the other interpolation function (that creates a sequence of interpolated values), because of the dimension of ia and itw.
The size of ia and itw in all dimensions must be consistent with the grid position Arrays.
ia | Interpolated field. |
itw | Interpolation weights. | |
a | The field to interpolate. | |
vgp | The grid position Array for the vitrine dimension. | |
sgp | The grid position Array for the shelf dimension. | |
bgp | The grid position Array for the book dimension. | |
pgp | The grid position Array for the page dimension. | |
rgp | The grid position Array for the row dimension. | |
cgp | The grid position Array for the column dimension. |
Definition at line 2420 of file interpolation_poly.cc.
References GridPos::idx, is_same_within_epsilon(), is_size(), joker, LOOPIDX, Array< base >::nelem(), ns, and sum_check_epsilon.
void interp | ( | Tensor5View | ia, | |
ConstTensor6View | itw, | |||
ConstTensor5View | a, | |||
const ArrayOfGridPosPoly & | sgp, | |||
const ArrayOfGridPosPoly & | bgp, | |||
const ArrayOfGridPosPoly & | pgp, | |||
const ArrayOfGridPosPoly & | rgp, | |||
const ArrayOfGridPosPoly & | cgp | |||
) |
Interpolate 5D field to another 5D field.
This performs a "green" type interpolation of the field, that means that the grid position Arrays are interpreted as defining the grids for the interpolated field.
This function can be easily distinguished from the other interpolation function (that creates a sequence of interpolated values), because of the dimension of ia and itw.
The size of ia and itw in all dimensions must be consistent with the grid position Arrays.
ia | Interpolated field. |
itw | Interpolation weights. | |
a | The field to interpolate. | |
sgp | The grid position Array for the shelf dimension. | |
bgp | The grid position Array for the book dimension. | |
pgp | The grid position Array for the page dimension. | |
rgp | The grid position Array for the row dimension. | |
cgp | The grid position Array for the column dimension. |
Definition at line 2318 of file interpolation_poly.cc.
References GridPos::idx, is_same_within_epsilon(), is_size(), joker, LOOPIDX, Array< base >::nelem(), ns, and sum_check_epsilon.
void interp | ( | Tensor4View | ia, | |
ConstTensor5View | itw, | |||
ConstTensor4View | a, | |||
const ArrayOfGridPosPoly & | bgp, | |||
const ArrayOfGridPosPoly & | pgp, | |||
const ArrayOfGridPosPoly & | rgp, | |||
const ArrayOfGridPosPoly & | cgp | |||
) |
Interpolate 4D field to another 4D field.
This performs a "green" type interpolation of the field, that means that the grid position Arrays are interpreted as defining the grids for the interpolated field.
This function can be easily distinguished from the other interpolation function (that creates a sequence of interpolated values), because of the dimension of ia and itw.
The size of ia and itw in all dimensions must be consistent with the grid position Arrays.
ia | Interpolated field. |
itw | Interpolation weights. | |
a | The field to interpolate. | |
bgp | The grid position Array for the book dimension. | |
pgp | The grid position Array for the page dimension. | |
rgp | The grid position Array for the row dimension. | |
cgp | The grid position Array for the column dimension. |
Definition at line 2226 of file interpolation_poly.cc.
References GridPos::idx, is_same_within_epsilon(), is_size(), joker, LOOPIDX, Array< base >::nelem(), and sum_check_epsilon.
void interp | ( | Tensor3View | ia, | |
ConstTensor4View | itw, | |||
ConstTensor3View | a, | |||
const ArrayOfGridPosPoly & | pgp, | |||
const ArrayOfGridPosPoly & | rgp, | |||
const ArrayOfGridPosPoly & | cgp | |||
) |
Interpolate 3D field to another 3D field.
This performs a "green" type interpolation of the field, that means that the grid position Arrays are interpreted as defining the grids for the interpolated field.
This function can be easily distinguished from the other interpolation function (that creates a sequence of interpolated values), because of the dimension of ia and itw.
The size of ia and itw in all dimensions must be consistent with the grid position Arrays.
ia | Interpolated field. |
itw | Interpolation weights. | |
a | The field to interpolate. | |
pgp | The grid position Array for the page dimension. | |
rgp | The grid position Array for the row dimension. | |
cgp | The grid position Array for the column dimension. |
Definition at line 2144 of file interpolation_poly.cc.
References GridPos::idx, is_same_within_epsilon(), is_size(), joker, LOOPIDX, Array< base >::nelem(), and sum_check_epsilon.
void interp | ( | MatrixView | ia, | |
ConstTensor3View | itw, | |||
ConstMatrixView | a, | |||
const ArrayOfGridPosPoly & | rgp, | |||
const ArrayOfGridPosPoly & | cgp | |||
) |
Interpolate 2D field to another 2D field.
This performs a "green" type interpolation of the field, that means that the grid position Arrays are interpreted as defining the grids for the interpolated field.
This function can be easily distinguished from the other interpolation function (that creates a sequence of interpolated values), because of the dimension of ia and itw.
The size of ia and itw in all dimensions must be consistent with the grid position Arrays.
ia | Interpolated field. |
itw | Interpolation weights. | |
a | The field to interpolate. | |
rgp | The grid position Array for the row dimension. | |
cgp | The grid position Array for the column dimension. |
Definition at line 2073 of file interpolation_poly.cc.
References GridPos::idx, is_same_within_epsilon(), is_size(), joker, LOOPIDX, Array< base >::nelem(), and sum_check_epsilon.
void interp | ( | VectorView | ia, | |
ConstMatrixView | itw, | |||
ConstTensor6View | a, | |||
const ArrayOfGridPosPoly & | vgp, | |||
const ArrayOfGridPosPoly & | sgp, | |||
const ArrayOfGridPosPoly & | bgp, | |||
const ArrayOfGridPosPoly & | pgp, | |||
const ArrayOfGridPosPoly & | rgp, | |||
const ArrayOfGridPosPoly & | cgp | |||
) |
Interpolate 6D field to a sequence of positions.
This performs a "blue" type interpolation of the field, that means that the grid position Arrays are interpreted as defining a sequence of positions. ALL GRID POSITION ARRAYS MUST HAVE THE SAME LENGTH!
The output vector ia also must have the same length. And the dimension of itw must be consistent with this.
This function can be easily distinguished from the other interpolation function (that creates an entire field of interpolated values), because of the dimension of ia and itw.
ia | Vector containing the interpolated field values. |
itw | Interpolation weights. | |
a | The field to interpolate. | |
vgp | The grid position Array for the vitrine dimension. | |
sgp | The grid position Array for the shelf dimension. | |
bgp | The grid position Array for the book dimension. | |
pgp | The grid position Array for the page dimension. | |
rgp | The grid position Array for the row dimension. | |
cgp | The grid position Array for the column dimension. |
Definition at line 1611 of file interpolation_poly.cc.
References GridPos::idx, is_same_within_epsilon(), is_size(), joker, LOOPIDX, Array< base >::nelem(), and sum_check_epsilon.
void interp | ( | VectorView | ia, | |
ConstMatrixView | itw, | |||
ConstTensor5View | a, | |||
const ArrayOfGridPosPoly & | sgp, | |||
const ArrayOfGridPosPoly & | bgp, | |||
const ArrayOfGridPosPoly & | pgp, | |||
const ArrayOfGridPosPoly & | rgp, | |||
const ArrayOfGridPosPoly & | cgp | |||
) |
Interpolate 5D field to a sequence of positions.
This performs a "blue" type interpolation of the field, that means that the grid position Arrays are interpreted as defining a sequence of positions. ALL GRID POSITION ARRAYS MUST HAVE THE SAME LENGTH!
The output vector ia also must have the same length. And the dimension of itw must be consistent with this.
This function can be easily distinguished from the other interpolation function (that creates an entire field of interpolated values), because of the dimension of ia and itw.
ia | Vector containing the interpolated field values. |
itw | Interpolation weights. | |
a | The field to interpolate. | |
sgp | The grid position Array for the shelf dimension. | |
bgp | The grid position Array for the book dimension. | |
pgp | The grid position Array for the page dimension. | |
rgp | The grid position Array for the row dimension. | |
cgp | The grid position Array for the column dimension. |
Definition at line 1524 of file interpolation_poly.cc.
References GridPos::idx, is_same_within_epsilon(), is_size(), joker, LOOPIDX, Array< base >::nelem(), and sum_check_epsilon.
void interp | ( | VectorView | ia, | |
ConstMatrixView | itw, | |||
ConstTensor4View | a, | |||
const ArrayOfGridPosPoly & | bgp, | |||
const ArrayOfGridPosPoly & | pgp, | |||
const ArrayOfGridPosPoly & | rgp, | |||
const ArrayOfGridPosPoly & | cgp | |||
) |
Interpolate 4D field to a sequence of positions.
This performs a "blue" type interpolation of the field, that means that the grid position Arrays are interpreted as defining a sequence of positions. ALL GRID POSITION ARRAYS MUST HAVE THE SAME LENGTH!
The output vector ia also must have the same length. And the dimension of itw must be consistent with this.
This function can be easily distinguished from the other interpolation function (that creates an entire field of interpolated values), because of the dimension of ia and itw.
ia | Vector containing the interpolated field values. |
itw | Interpolation weights. | |
a | The field to interpolate. | |
bgp | The grid position Array for the book dimension. | |
pgp | The grid position Array for the page dimension. | |
rgp | The grid position Array for the row dimension. | |
cgp | The grid position Array for the column dimension. |
Definition at line 1444 of file interpolation_poly.cc.
References GridPos::idx, is_same_within_epsilon(), is_size(), joker, LOOPIDX, Array< base >::nelem(), and sum_check_epsilon.
void interp | ( | VectorView | ia, | |
ConstMatrixView | itw, | |||
ConstTensor3View | a, | |||
const ArrayOfGridPosPoly & | pgp, | |||
const ArrayOfGridPosPoly & | rgp, | |||
const ArrayOfGridPosPoly & | cgp | |||
) |
Interpolate 3D field to a sequence of positions.
This performs a "blue" type interpolation of the field, that means that the grid position Arrays are interpreted as defining a sequence of positions. ALL GRID POSITION ARRAYS MUST HAVE THE SAME LENGTH!
The output vector ia also must have the same length. And the dimension of itw must be consistent with this.
This function can be easily distinguished from the other interpolation function (that creates an entire field of interpolated values), because of the dimension of ia and itw.
ia | Vector containing the interpolated field values. |
itw | Interpolation weights. | |
a | The field to interpolate. | |
pgp | The grid position Array for the page dimension. | |
rgp | The grid position Array for the row dimension. | |
cgp | The grid position Array for the column dimension. |
Definition at line 1371 of file interpolation_poly.cc.
References GridPos::idx, is_same_within_epsilon(), is_size(), joker, LOOPIDX, Array< base >::nelem(), and sum_check_epsilon.
void interp | ( | VectorView | ia, | |
ConstMatrixView | itw, | |||
ConstMatrixView | a, | |||
const ArrayOfGridPosPoly & | rgp, | |||
const ArrayOfGridPosPoly & | cgp | |||
) |
Interpolate 2D field to a sequence of positions.
This performs a "blue" type interpolation of the field, that means that the grid position Arrays are interpreted as defining a sequence of positions. ALL GRID POSITION ARRAYS MUST HAVE THE SAME LENGTH!
The output vector ia also must have the same length. And the dimension of itw must be consistent with this.
This function can be easily distinguished from the other interpolation function (that creates an entire field of interpolated values), because of the dimension of ia and itw.
ia | Vector containing the interpolated field values. |
itw | Interpolation weights. | |
a | The field to interpolate. | |
rgp | The grid position Array for the row dimension. | |
cgp | The grid position Array for the column dimension. |
Definition at line 1305 of file interpolation_poly.cc.
References GridPos::idx, is_same_within_epsilon(), is_size(), joker, LOOPIDX, Array< base >::nelem(), and sum_check_epsilon.
void interp | ( | VectorView | ia, | |
ConstMatrixView | itw, | |||
ConstVectorView | a, | |||
const ArrayOfGridPosPoly & | cgp | |||
) |
Interpolate 1D field.
For this 1D case there is no distinction between "blue" and "green" type interpolation.
The output vector ia must have the same length as the grid position vector cgp. And the dimension of itw must be consistent with this.
ia | Vector containing the interpolated field values. |
itw | Interpolation weights. | |
a | The field to interpolate. | |
cgp | The grid position Array for the column dimension. |
Definition at line 1246 of file interpolation_poly.cc.
References GridPos::idx, is_same_within_epsilon(), is_size(), joker, LOOPIDX, Array< base >::nelem(), and sum_check_epsilon.
Numeric interp | ( | ConstVectorView | itw, | |
ConstTensor6View | a, | |||
const GridPosPoly & | tv, | |||
const GridPosPoly & | ts, | |||
const GridPosPoly & | tb, | |||
const GridPosPoly & | tp, | |||
const GridPosPoly & | tr, | |||
const GridPosPoly & | tc | |||
) |
Red 6D Interpolate.
"Red" interpolation returns just a scalar.
The dimension of itw must be consistent with the dimension of the interpolation (2^n).
itw | Interpolation weights. | |
a | The field to interpolate. | |
tv | The grid position for the vitrine dimension. | |
ts | The grid position for the shelf dimension. | |
tb | The grid position for the book dimension. | |
tp | The grid position for the page dimension. | |
tr | The grid position for the row dimension. | |
tc | The grid position for the column dimension. |
Definition at line 791 of file interpolation_poly.cc.
References is_same_within_epsilon(), is_size(), LOOPIDX, ConstVectorView::nelem(), ConstVectorView::sum(), sum_check_epsilon, and GridPosPoly::w.
Numeric interp | ( | ConstVectorView | itw, | |
ConstTensor5View | a, | |||
const GridPosPoly & | ts, | |||
const GridPosPoly & | tb, | |||
const GridPosPoly & | tp, | |||
const GridPosPoly & | tr, | |||
const GridPosPoly & | tc | |||
) |
Red 5D Interpolate.
"Red" interpolation returns just a scalar.
The dimension of itw must be consistent with the dimension of the interpolation (2^n).
itw | Interpolation weights. | |
a | The field to interpolate. | |
ts | The grid position for the shelf dimension. | |
tb | The grid position for the book dimension. | |
tp | The grid position for the page dimension. | |
tr | The grid position for the row dimension. | |
tc | The grid position for the column dimension. |
Definition at line 728 of file interpolation_poly.cc.
References is_same_within_epsilon(), is_size(), LOOPIDX, ConstVectorView::nelem(), ConstVectorView::sum(), sum_check_epsilon, and GridPosPoly::w.
Numeric interp | ( | ConstVectorView | itw, | |
ConstTensor4View | a, | |||
const GridPosPoly & | tb, | |||
const GridPosPoly & | tp, | |||
const GridPosPoly & | tr, | |||
const GridPosPoly & | tc | |||
) |
Red 4D Interpolate.
"Red" interpolation returns just a scalar.
The dimension of itw must be consistent with the dimension of the interpolation (2^n).
itw | Interpolation weights. | |
a | The field to interpolate. | |
tb | The grid position for the book dimension. | |
tp | The grid position for the page dimension. | |
tr | The grid position for the row dimension. | |
tc | The grid position for the column dimension. |
Definition at line 670 of file interpolation_poly.cc.
References is_same_within_epsilon(), is_size(), LOOPIDX, ConstVectorView::nelem(), ConstVectorView::sum(), sum_check_epsilon, and GridPosPoly::w.
Numeric interp | ( | ConstVectorView | itw, | |
ConstTensor3View | a, | |||
const GridPosPoly & | tp, | |||
const GridPosPoly & | tr, | |||
const GridPosPoly & | tc | |||
) |
Red 3D Interpolate.
"Red" interpolation returns just a scalar.
The dimension of itw must be consistent with the dimension of the interpolation (2^n).
itw | Interpolation weights. | |
a | The field to interpolate. | |
tp | The grid position for the page dimension. | |
tr | The grid position for the row dimension. | |
tc | The grid position for the column dimension. |
Definition at line 617 of file interpolation_poly.cc.
References is_same_within_epsilon(), is_size(), LOOPIDX, ConstVectorView::nelem(), ConstVectorView::sum(), sum_check_epsilon, and GridPosPoly::w.
Numeric interp | ( | ConstVectorView | itw, | |
ConstMatrixView | a, | |||
const GridPosPoly & | tr, | |||
const GridPosPoly & | tc | |||
) |
Red 2D Interpolate.
"Red" interpolation returns just a scalar.
The dimension of itw must be consistent with the dimension of the interpolation (2^n).
itw | Interpolation weights. | |
a | The field to interpolate. | |
tr | The grid position for the row dimension. | |
tc | The grid position for the column dimension. |
Definition at line 569 of file interpolation_poly.cc.
References is_same_within_epsilon(), is_size(), LOOPIDX, ConstVectorView::nelem(), ConstVectorView::sum(), sum_check_epsilon, and GridPosPoly::w.
Numeric interp | ( | ConstVectorView | itw, | |
ConstVectorView | a, | |||
const GridPosPoly & | tc | |||
) |
Red 1D Interpolate.
"Red" interpolation returns just a scalar.
The dimension of itw must be consistent with the dimension of the interpolation (2^n).
itw | Interpolation weights. | |
a | The field to interpolate. | |
tc | The grid position for the column dimension. |
Definition at line 527 of file interpolation_poly.cc.
References is_same_within_epsilon(), is_size(), LOOPIDX, ConstVectorView::nelem(), ConstVectorView::sum(), sum_check_epsilon, and GridPosPoly::w.
void interpweights | ( | Tensor7View | itw, | |
const ArrayOfGridPosPoly & | vgp, | |||
const ArrayOfGridPosPoly & | sgp, | |||
const ArrayOfGridPosPoly & | bgp, | |||
const ArrayOfGridPosPoly & | pgp, | |||
const ArrayOfGridPosPoly & | rgp, | |||
const ArrayOfGridPosPoly & | cgp | |||
) |
Compute 6D interpolation weights for an entire field.
Compute the weights for a "green" type interpolation of the field, that means that the grid position Arrays are interpreted as defining the grids for the interpolated field.
The dimensions of itw must be consistent with this.
Note that we still do not need the actual field for this step.
This function can be easily distinguished from the other interpweights function (for "green" interpolation), because the output is a Tensor with one more dimension than the number of grid position Arrays.
itw | Interpolation weights |
vgp | The grid position Array for the vitrine dimension. | |
sgp | The grid position Array for the shelf dimension. | |
bgp | The grid position Array for the book dimension. | |
pgp | The grid position Array for the page dimension. | |
rgp | The grid position Array for the row dimension. | |
cgp | The grid position Array for the column dimension. |
Definition at line 1987 of file interpolation_poly.cc.
References is_size(), LOOPIT, LOOPW, Array< base >::nelem(), and ns.
void interpweights | ( | Tensor6View | itw, | |
const ArrayOfGridPosPoly & | sgp, | |||
const ArrayOfGridPosPoly & | bgp, | |||
const ArrayOfGridPosPoly & | pgp, | |||
const ArrayOfGridPosPoly & | rgp, | |||
const ArrayOfGridPosPoly & | cgp | |||
) |
Compute 5D interpolation weights for an entire field.
Compute the weights for a "green" type interpolation of the field, that means that the grid position Arrays are interpreted as defining the grids for the interpolated field.
The dimensions of itw must be consistent with this.
Note that we still do not need the actual field for this step.
This function can be easily distinguished from the other interpweights function (for "green" interpolation), because the output is a Tensor with one more dimension than the number of grid position Arrays.
itw | Interpolation weights |
sgp | The grid position Array for the shelf dimension. | |
bgp | The grid position Array for the book dimension. | |
pgp | The grid position Array for the page dimension. | |
rgp | The grid position Array for the row dimension. | |
cgp | The grid position Array for the column dimension. |
Definition at line 1905 of file interpolation_poly.cc.
References is_size(), LOOPIT, LOOPW, Array< base >::nelem(), and ns.
void interpweights | ( | Tensor5View | itw, | |
const ArrayOfGridPosPoly & | bgp, | |||
const ArrayOfGridPosPoly & | pgp, | |||
const ArrayOfGridPosPoly & | rgp, | |||
const ArrayOfGridPosPoly & | cgp | |||
) |
Compute 4D interpolation weights for an entire field.
Compute the weights for a "green" type interpolation of the field, that means that the grid position Arrays are interpreted as defining the grids for the interpolated field.
The dimensions of itw must be consistent with this.
Note that we still do not need the actual field for this step.
This function can be easily distinguished from the other interpweights function (for "green" interpolation), because the output is a Tensor with one more dimension than the number of grid position Arrays.
itw | Interpolation weights |
bgp | The grid position Array for the book dimension. | |
pgp | The grid position Array for the page dimension. | |
rgp | The grid position Array for the row dimension. | |
cgp | The grid position Array for the column dimension. |
Definition at line 1832 of file interpolation_poly.cc.
References is_size(), LOOPIT, LOOPW, and Array< base >::nelem().
void interpweights | ( | Tensor4View | itw, | |
const ArrayOfGridPosPoly & | pgp, | |||
const ArrayOfGridPosPoly & | rgp, | |||
const ArrayOfGridPosPoly & | cgp | |||
) |
Compute 3D interpolation weights for an entire field.
Compute the weights for a "green" type interpolation of the field, that means that the grid position Arrays are interpreted as defining the grids for the interpolated field.
The dimensions of itw must be consistent with this.
Note that we still do not need the actual field for this step.
This function can be easily distinguished from the other interpweights function (for "green" interpolation), because the output is a Tensor with one more dimension than the number of grid position Arrays.
itw | Interpolation weights |
pgp | The grid position Array for the page dimension. | |
rgp | The grid position Array for the row dimension. | |
cgp | The grid position Array for the column dimension. |
Definition at line 1768 of file interpolation_poly.cc.
References is_size(), LOOPIT, LOOPW, and Array< base >::nelem().
void interpweights | ( | Tensor3View | itw, | |
const ArrayOfGridPosPoly & | rgp, | |||
const ArrayOfGridPosPoly & | cgp | |||
) |
Compute 2D interpolation weights for an entire field.
Compute the weights for a "green" type interpolation of the field, that means that the grid position Arrays are interpreted as defining the grids for the interpolated field.
The dimensions of itw must be consistent with this.
Note that we still do not need the actual field for this step.
This function can be easily distinguished from the other interpweights function (for "green" interpolation), because the output is a Tensor with one more dimension than the number of grid position Arrays.
itw | Interpolation weights |
rgp | The grid position Array for the row dimension. | |
cgp | The grid position Array for the column dimension. |
Definition at line 1704 of file interpolation_poly.cc.
References is_size(), LOOPIT, LOOPW, and Array< base >::nelem().
void interpweights | ( | MatrixView | itw, | |
const ArrayOfGridPosPoly & | vgp, | |||
const ArrayOfGridPosPoly & | sgp, | |||
const ArrayOfGridPosPoly & | bgp, | |||
const ArrayOfGridPosPoly & | pgp, | |||
const ArrayOfGridPosPoly & | rgp, | |||
const ArrayOfGridPosPoly & | cgp | |||
) |
Compute 6D interpolation weights for a sequence of positions.
Compute the weights for a "blue" type interpolation of the field, that means that the grid position Arrays are interpreted as defining a sequence of positions. ALL GRID POSITION ARRAYS MUST HAVE THE SAME LENGTH!
The dimensions of itw must be also consistent with this.
Note that we still do not need the actual field for this step.
This function can be easily distinguished from the other interpweights function (for "green" interpolation), because the output is a Matrix, whereas in the other case it is a Tensor with one more dimension than there are input grid position Arrays.
itw | Interpolation weights. |
vgp | The grid position Array for the vitrine dimension. | |
sgp | The grid position Array for the shelf dimension. | |
bgp | The grid position Array for the book dimension. | |
pgp | The grid position Array for the page dimension. | |
rgp | The grid position Array for the row dimension. | |
cgp | The grid position Array for the column dimension. |
Definition at line 1181 of file interpolation_poly.cc.
References is_size(), LOOPIT, LOOPW, and Array< base >::nelem().
void interpweights | ( | MatrixView | itw, | |
const ArrayOfGridPosPoly & | sgp, | |||
const ArrayOfGridPosPoly & | bgp, | |||
const ArrayOfGridPosPoly & | pgp, | |||
const ArrayOfGridPosPoly & | rgp, | |||
const ArrayOfGridPosPoly & | cgp | |||
) |
Compute 5D interpolation weights for a sequence of positions.
Compute the weights for a "blue" type interpolation of the field, that means that the grid position Arrays are interpreted as defining a sequence of positions. ALL GRID POSITION ARRAYS MUST HAVE THE SAME LENGTH!
The dimensions of itw must be also consistent with this.
Note that we still do not need the actual field for this step.
This function can be easily distinguished from the other interpweights function (for "green" interpolation), because the output is a Matrix, whereas in the other case it is a Tensor with one more dimension than there are input grid position Arrays.
itw | Interpolation weights. |
sgp | The grid position Array for the shelf dimension. | |
bgp | The grid position Array for the book dimension. | |
pgp | The grid position Array for the page dimension. | |
rgp | The grid position Array for the row dimension. | |
cgp | The grid position Array for the column dimension. |
Definition at line 1112 of file interpolation_poly.cc.
References is_size(), LOOPIT, LOOPW, and Array< base >::nelem().
void interpweights | ( | MatrixView | itw, | |
const ArrayOfGridPosPoly & | bgp, | |||
const ArrayOfGridPosPoly & | pgp, | |||
const ArrayOfGridPosPoly & | rgp, | |||
const ArrayOfGridPosPoly & | cgp | |||
) |
Compute 4D interpolation weights for a sequence of positions.
Compute the weights for a "blue" type interpolation of the field, that means that the grid position Arrays are interpreted as defining a sequence of positions. ALL GRID POSITION ARRAYS MUST HAVE THE SAME LENGTH!
The dimensions of itw must be also consistent with this.
Note that we still do not need the actual field for this step.
This function can be easily distinguished from the other interpweights function (for "green" interpolation), because the output is a Matrix, whereas in the other case it is a Tensor with one more dimension than there are input grid position Arrays.
itw | Interpolation weights. |
bgp | The grid position Array for the book dimension. | |
pgp | The grid position Array for the page dimension. | |
rgp | The grid position Array for the row dimension. | |
cgp | The grid position Array for the column dimension. |
Definition at line 1049 of file interpolation_poly.cc.
References is_size(), LOOPIT, LOOPW, and Array< base >::nelem().
void interpweights | ( | MatrixView | itw, | |
const ArrayOfGridPosPoly & | pgp, | |||
const ArrayOfGridPosPoly & | rgp, | |||
const ArrayOfGridPosPoly & | cgp | |||
) |
Compute 3D interpolation weights for a sequence of positions.
Compute the weights for a "blue" type interpolation of the field, that means that the grid position Arrays are interpreted as defining a sequence of positions. ALL GRID POSITION ARRAYS MUST HAVE THE SAME LENGTH!
The dimensions of itw must be also consistent with this.
Note that we still do not need the actual field for this step.
This function can be easily distinguished from the other interpweights function (for "green" interpolation), because the output is a Matrix, whereas in the other case it is a Tensor with one more dimension than there are input grid position Arrays.
itw | Interpolation weights. |
pgp | The grid position Array for the page dimension. | |
rgp | The grid position Array for the row dimension. | |
cgp | The grid position Array for the column dimension. |
Definition at line 992 of file interpolation_poly.cc.
References is_size(), LOOPIT, LOOPW, and Array< base >::nelem().
void interpweights | ( | MatrixView | itw, | |
const ArrayOfGridPosPoly & | rgp, | |||
const ArrayOfGridPosPoly & | cgp | |||
) |
Compute 2D interpolation weights for a sequence of positions.
Compute the weights for a "blue" type interpolation of the field, that means that the grid position Arrays are interpreted as defining a sequence of positions. ALL GRID POSITION ARRAYS MUST HAVE THE SAME LENGTH!
The dimensions of itw must be also consistent with this.
Note that we still do not need the actual field for this step.
This function can be easily distinguished from the other interpweights function (for "green" interpolation), because the output is a Matrix, whereas in the other case it is a Tensor with one more dimension than there are input grid position Arrays.
itw | Interpolation weights. |
rgp | The grid position Array for the row dimension. | |
cgp | The grid position Array for the column dimension. |
Definition at line 933 of file interpolation_poly.cc.
References is_size(), LOOPIT, LOOPW, and Array< base >::nelem().
void interpweights | ( | MatrixView | itw, | |
const ArrayOfGridPosPoly & | cgp | |||
) |
Compute 1D interpolation weights.
For this 1D case there is no distinction between "blue" and "green" type interpolation.
The dimensions of itw must be consistent with cgp.
Note that we still do not need the actual field for this step.
itw | Interpolation weights. |
cgp | The grid position Array for the column dimension. |
Definition at line 859 of file interpolation_poly.cc.
References is_size(), LOOPIT, LOOPW, and Array< base >::nelem().
void interpweights | ( | VectorView | itw, | |
const GridPosPoly & | tv, | |||
const GridPosPoly & | ts, | |||
const GridPosPoly & | tb, | |||
const GridPosPoly & | tp, | |||
const GridPosPoly & | tr, | |||
const GridPosPoly & | tc | |||
) |
Red 6D interpolation weights.
"Red" interpolation returns just a scalar, so the weights are stored in a Vector.
The length of itw must be consistent with the dimension of the field to be interpolated (2^n).
itw | Interpolation weights. |
tv | The grid position for the vitrine dimension. | |
ts | The grid position for the shelf dimension. | |
tb | The grid position for the book dimension. | |
tp | The grid position for the page dimension. | |
tr | The grid position for the row dimension. | |
tc | The grid position for the column dimension. |
Definition at line 481 of file interpolation_poly.cc.
References is_size(), LOOPW, ConstVectorView::nelem(), and GridPosPoly::w.
void interpweights | ( | VectorView | itw, | |
const GridPosPoly & | ts, | |||
const GridPosPoly & | tb, | |||
const GridPosPoly & | tp, | |||
const GridPosPoly & | tr, | |||
const GridPosPoly & | tc | |||
) |
Red 5D interpolation weights.
"Red" interpolation returns just a scalar, so the weights are stored in a Vector.
The length of itw must be consistent with the dimension of the field to be interpolated (2^n).
itw | Interpolation weights. |
ts | The grid position for the shelf dimension. | |
tb | The grid position for the book dimension. | |
tp | The grid position for the page dimension. | |
tr | The grid position for the row dimension. | |
tc | The grid position for the column dimension. |
Definition at line 435 of file interpolation_poly.cc.
References is_size(), LOOPW, ConstVectorView::nelem(), and GridPosPoly::w.
void interpweights | ( | VectorView | itw, | |
const GridPosPoly & | tb, | |||
const GridPosPoly & | tp, | |||
const GridPosPoly & | tr, | |||
const GridPosPoly & | tc | |||
) |
Red 4D interpolation weights.
"Red" interpolation returns just a scalar, so the weights are stored in a Vector.
The length of itw must be consistent with the dimension of the field to be interpolated (2^n).
itw | Interpolation weights. |
tb | The grid position for the book dimension. | |
tp | The grid position for the page dimension. | |
tr | The grid position for the row dimension. | |
tc | The grid position for the column dimension. |
Definition at line 393 of file interpolation_poly.cc.
References is_size(), LOOPW, ConstVectorView::nelem(), and GridPosPoly::w.
void interpweights | ( | VectorView | itw, | |
const GridPosPoly & | tp, | |||
const GridPosPoly & | tr, | |||
const GridPosPoly & | tc | |||
) |
Red 3D interpolation weights.
"Red" interpolation returns just a scalar, so the weights are stored in a Vector.
The length of itw must be consistent with the dimension of the field to be interpolated (2^n).
itw | Interpolation weights. |
tp | The grid position for the page dimension. | |
tr | The grid position for the row dimension. | |
tc | The grid position for the column dimension. |
Definition at line 355 of file interpolation_poly.cc.
References is_size(), LOOPW, ConstVectorView::nelem(), and GridPosPoly::w.
void interpweights | ( | VectorView | itw, | |
const GridPosPoly & | tr, | |||
const GridPosPoly & | tc | |||
) |
Red 2D interpolation weights.
"Red" interpolation returns just a scalar, so the weights are stored in a Vector.
The length of itw must be consistent with the dimension of the field to be interpolated (2^n).
itw | Interpolation weights. |
tr | The grid position for the row dimension. | |
tc | The grid position for the column dimension. |
Definition at line 322 of file interpolation_poly.cc.
References is_size(), LOOPW, ConstVectorView::nelem(), and GridPosPoly::w.
void interpweights | ( | VectorView | itw, | |
const GridPosPoly & | tc | |||
) |
Red 1D interpolation weights.
"Red" interpolation returns just a scalar, so the weights are stored in a Vector.
The length of itw must be consistent with the dimension of the field to be interpolated (2^n).
itw | Interpolation weights. |
tc | The grid position for the column dimension. |
Definition at line 288 of file interpolation_poly.cc.
References is_size(), LOOPW, ConstVectorView::nelem(), and GridPosPoly::w.
ostream& operator<< | ( | ostream & | os, | |
const GridPosPoly & | gp | |||
) |
Output operator for GridPosPoly.
This is just intended for testing and debugging.
os | Output stream. | |
gp | Grid position. |
Definition at line 252 of file interpolation_poly.cc.
References GridPosPoly::idx, and GridPosPoly::w.
const Numeric sum_check_epsilon = 1e-6 |
The maximum difference from 1 that we allow for a sum check.
The sum check makes sure that the sum of all weights is approximately 1.
We cannot use a sharp comparison there, due to numerical noise. The value of 1e-6 is an ad-hoc value.
This shold be ok, the main point of the test is to make sure that what we have really *are* interpolation weights, and not something else.
Definition at line 68 of file interpolation_poly.cc.