TMB Documentation
v1.9.11
|
Get a smooth representation of a data matrix. More...
#include <interpol.hpp>
Public Member Functions | |
interpol2D (matrix< Type > data, vector< Type > x_range, vector< Type > y_range, interpol2D_config< Type > cfg=interpol2D_config< Type >()) | |
Construct interpolation object. More... | |
double | operator() (double x, double y, int nx=0, int ny=0) |
Scalar evaluation with double types. More... | |
ad | operator() (ad x, ad y, int nx=0, int ny=0) |
Scalar evaluation with ad types. More... | |
Public Member Functions inherited from TMBad::global::Operator< ninput, noutput > | |
void | dependencies_updating (Args<> &args, Dependencies &dep) const |
Default implementation of OperatorPure::dependencies_updating() | |
void * | operator_data () |
Return operator specific dynamic information (optional) | |
OperatorPure * | other_fuse (OperatorPure *self, OperatorPure *other) |
How to fuse this operator (self) with another (other) | |
void | print (print_config cfg) |
Print this operator (optional) | |
Additional Inherited Members | |
Static Public Attributes inherited from TMBad::global::DynamicOperator< 2, 1 > | |
static const bool | dynamic |
static const int | max_fuse_depth |
Static Public Attributes inherited from TMBad::global::Operator< ninput, noutput > | |
static const bool | add_forward_replay_copy |
Should this operator replay it self by invoking the copy CTOR ? | |
static const bool | add_static_identifier |
Should this operator have a static identifier ? | |
static const bool | allow_remap |
Is it safe to remap the inputs of this operator? More... | |
static const int | dependent_variable |
Is output of this operator a dependent variable ? | |
static const bool | dynamic |
Does this operator require dynamic allocation ? | |
static const bool | elimination_protected |
Protect this operator from elimination by the tape optimizer ? | |
static const bool | have_dependencies |
Have dependencies member been defined ? | |
static const bool | have_eval |
Does this class have an eval member from which to define forward ? | |
static const bool | have_forward_incr_reverse_decr |
Have forward_incr and reverse_incr members been defined ? | |
static const bool | have_forward_mark_reverse_mark |
Have forward_mark and reverse_mark members been defined ? | |
static const bool | have_forward_reverse |
Have forward and reverse members been defined ? | |
static const bool | have_increment_decrement |
Have increment and decrement members been defined ? | |
static const bool | have_input_size_output_size |
Have input_size and output_size members been defined ? | |
static const bool | implicit_dependencies |
Does this operator have implicit dependencies? More... | |
static const int | independent_variable |
Is output of this operator an independent variable ? | |
static const bool | is_constant |
Is this a constant operator ? | |
static const bool | is_linear |
Is this a linear operator ? | |
static const int | max_fuse_depth |
How many times can this operator be doubled ? | |
static const int | ninput |
Number of operator inputs. | |
static const int | noutput |
Number of operator outputs. | |
static const bool | smart_pointer |
Is this operator a 'smart pointer' (with reference counting) ? | |
static const bool | updating |
This operator may update existing variables ? More... | |
Get a smooth representation of a data matrix.
This 2D interpolation can be put on the AD tape. Interpolation data is shared among instances so you can do interpolation many times without duplicating the data.
In addition the operator is thread safe, whether used with manual parallelization (parallel_accumulator
etc) or automatic parallization (TMBad::autopar
).
The actual interpolation is based on a kernel smoothing approach: To obtain the interpolated value at coordinate (x,y), the coordinate is first transformed to continous matrix index coordinates using the supplied x_range
and y_range
. The distance to each matrix entry d(i,j)
is then calculated, and a corresponding 'weight' is given as a function (kernel) of the distance divided by the 'interpolation radius' (R), i.e. W(i,j)=kernel(d(i,j)/R)
. The final interpolated value becomes sum(W*F)/sum(W)
where F
is the data matrix.
We note that the interpolation radius (interpol2D_config::R) is relative to matrix index coordinates (and is thus not related to the x_range
and y_range
).
Definition at line 145 of file interpol.hpp.
|
inline |
Construct interpolation object.
data | Matrix of data values. |
x_range | Vector of length 2 corresponding to first and last data row. |
y_range | Vector of length 2 corresponding to first and last data column. |
cfg | Control parameters |
Definition at line 165 of file interpol.hpp.
|
inline |
Scalar evaluation with double types.
x | x-coordinate |
y | y-coordinate |
nx | x-derivative order |
ny | y-derivative order |
Definition at line 193 of file interpol.hpp.
|
inline |
Scalar evaluation with ad types.
x | x-coordinate |
y | y-coordinate |
nx | x-derivative order |
ny | y-derivative order |
Definition at line 202 of file interpol.hpp.