Two-dimensional interpolation class by successive one-dimensional interpolation. More...
#include <interp2_seq.h>
This class implements two-dimensional interpolation by iterating the O2scl one-dimensional interpolation routines. Derivatives and integrals along both x- and y-directions can be computed. This class is likely a bit slower than interp2_direct but more flexible.
The convention used by this class is that the first (row) index of the matrix enumerates the x coordinate and that the second (column) index enumerates the y coordinate. See the discussion in the User's guide in the section called Rows and columns vs. x and y.
The function set_data() does not copy the data, it stores pointers to the data. If the data is modified, then the function reset_interp() must be called to reset the interpolation information with the original pointer information. The storage for the data, including the arrays x_grid and y_grid are all managed by the user.
By default, cubic spline interpolation with natural boundary conditions is used. This can be changed by calling set_interp() again with the same data and the new interpolation type.
There is an example for the usage of this class given in examples/ex_interp2_seq.cpp.
Because of the way this class creates pointers to the data, copy construction is not currently allowed.
xfirst is true and the last interpolation used the same value of x. Definition at line 82 of file interp2_seq.h.
Public Types | |
| typedef boost::numeric::ublas::vector< double > | ubvector |
Public Member Functions | |
| void | set_data (size_t n_x, size_t n_y, vec_t &x_grid, vec_t &y_grid, mat_t &data, size_t interp_type=itp_cspline) |
| Initialize the data for the 2-dimensional interpolation. More... | |
| void | reset_interp () |
| Reset the stored interpolation since the data has changed. More... | |
| double | eval (double x, double y) const |
| Perform the 2-d interpolation. | |
| double | operator() (double x, double y) const |
| Perform the 2-d interpolation. | |
| double | deriv_x (double x, double y) const |
| Compute the partial derivative in the x-direction. | |
| double | deriv_xx (double x, double y) const |
| Compute the partial second derivative in the x-direction. | |
| double | integ_x (double x0, double x1, double y) const |
| Compute the integral in the x-direction between x=x0 and x=x1. | |
| double | deriv_y (double x, double y) const |
| Compute the partial derivative in the y-direction. | |
| double | deriv_yy (double x, double y) const |
| Compute the partial second derivative in the y-direction. | |
| double | integ_y (double x, double y0, double y1) const |
| Compute the integral in the y-direction between y=y0 and y=y1. | |
| double | deriv_xy (double x, double y) const |
Compute the mixed partial derivative . | |
| double | eval_gen (int ix, int iy, double x0, double x1, double y0, double y1) const |
| Compute a general interpolation result. More... | |
Protected Attributes | |
| std::vector< interp_vec< vec_t, mat_row_t > * > | itps |
| The array of interpolation objects. | |
| std::vector< mat_row_t * > | vecs |
| An array of rows. | |
| size_t | nx |
| The number of x grid points. | |
| size_t | ny |
| The number of y grid points. | |
| bool | data_set |
| True if the data has been specified by the user. | |
| vec_t * | xfun |
| The x grid. | |
| vec_t * | yfun |
| The y grid. | |
| mat_t * | datap |
| The data. | |
| size_t | itype |
| Interpolation type. | |
Protected Attributes inherited from o2scl::interp2_base< boost::numeric::ublas::vector< double >, boost::numeric::ublas::matrix< double > > | |
| size_t | nx |
| The number of x grid points. | |
| size_t | ny |
| The number of y grid points. | |
| boost::numeric::ublas::vector< double > * | xfun |
| The x grid. | |
| boost::numeric::ublas::vector< double > * | yfun |
| The y grid. | |
| boost::numeric::ublas::matrix< double > * | datap |
| The data. | |
Private Member Functions | |
| interp2_seq (const interp2_seq< vec_t, mat_t, mat_row_t > &) | |
| interp2_seq< vec_t, mat_t, mat_row_t > & | operator= (const interp2_seq< vec_t, mat_t, mat_row_t > &) |
|
inlinevirtual |
This computes
for
and
with the notation
and the value of
is ignored when
and the value of
is ignored when
.
Implements o2scl::interp2_base< boost::numeric::ublas::vector< double >, boost::numeric::ublas::matrix< double > >.
Definition at line 347 of file interp2_seq.h.
|
inline |
This will throw an exception if the set_data() has not been called.
Definition at line 154 of file interp2_seq.h.
|
inline |
If x_first is true, then set_data() creates interpolation objects for each of the rows. Calls to interp() then uses these to create a column at the specified value of x. An interpolation object is created at this column to find the value of the function at the specified value y. If x_first is false, the opposite strategy is employed. These two options may give slightly different results.
Definition at line 115 of file interp2_seq.h.
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).