Go to the documentation of this file.
26 #ifndef O2SCL_INTERP2_SEQ_H
27 #define O2SCL_INTERP2_SEQ_H
33 #include <boost/numeric/ublas/vector.hpp>
34 #include <boost/numeric/ublas/matrix.hpp>
35 #include <boost/numeric/ublas/matrix_proxy.hpp>
37 #include <o2scl/interp.h>
38 #include <o2scl/interp2.h>
40 #ifndef DOXYGEN_NO_O2NS
79 template<
class vec_t=boost::numeric::ublas::vector<
double>,
80 class mat_t=boost::numeric::ublas::matrix<
double>,
81 class mat_row_t=boost::numeric::ublas::matrix_row<mat_t> >
84 #ifdef O2SCL_NEVER_DEFINED
97 virtual ~interp2_seq() {
98 for(
size_t i=0;i<itps.size();i++) {
115 void set_data(
size_t n_x,
size_t n_y, vec_t &x_grid,
116 vec_t &y_grid, mat_t &data,
129 for(
size_t i=0;i<itps.size();i++) {
139 for(
size_t i=0;i<nx;i++) {
140 vecs[i]=
new mat_row_t
141 (o2scl::matrix_row<mat_t,mat_row_t>(*datap,i));
157 for(
size_t i=0;i<itps.size();i++) {
166 for(
size_t i=0;i<nx;i++) {
167 vecs[i]=
new mat_row_t
168 (o2scl::matrix_row<mat_t,mat_row_t>(*datap,i));
181 double eval(
double x,
double y)
const {
182 if (data_set==
false) {
187 for(
size_t i=0;i<nx;i++) {
188 icol[i]=itps[i]->eval(y);
204 if (data_set==
false) {
210 for(
size_t i=0;i<nx;i++) {
211 icol[i]=itps[i]->eval(y);
221 if (data_set==
false) {
227 for(
size_t i=0;i<nx;i++) {
228 icol[i]=itps[i]->eval(y);
239 if (data_set==
false) {
245 for(
size_t i=0;i<nx;i++) {
246 icol[i]=itps[i]->eval(y);
257 if (data_set==
false) {
263 for(
size_t i=0;i<nx;i++) {
264 icol[i]=itps[i]->deriv(y);
274 if (data_set==
false) {
280 for(
size_t i=0;i<nx;i++) {
281 icol[i]=itps[i]->deriv2(y);
291 double integ_y(
double x,
double y0,
double y1)
const {
292 if (data_set==
false) {
298 for(
size_t i=0;i<nx;i++) {
299 icol[i]=itps[i]->integ(y0,y1);
310 if (data_set==
false) {
316 for(
size_t i=0;i<nx;i++) {
317 icol[i]=itps[i]->deriv(y);
348 double y0,
double y1)
const {
349 if (data_set==
false) {
356 for(
size_t i=0;i<nx;i++) {
358 icol[i]=itps[i]->integ(y0,y1);
360 icol[i]=itps[i]->eval(y0);
362 icol[i]=itps[i]->deriv(y0);
364 icol[i]=itps[i]->deriv2(y0);
366 O2SCL_ERR2(
"Invalid value of 'iy' for interp2_seq::",
376 result=six.
deriv(x0);
380 O2SCL_ERR2(
"Invalid value of 'ix' for interp2_seq::",
386 #ifndef DOXYGEN_INTERNAL
391 std::vector<interp_vec<vec_t,mat_row_t> *>
itps;
428 #ifndef DOXYGEN_NO_O2NS
double deriv_x(double x, double y) const
Compute the partial derivative in the x-direction.
Two-dimensional interpolation class by successive one-dimensional interpolation.
std::vector< mat_row_t * > vecs
An array of rows.
size_t ny
The number of y grid points.
virtual double integ(const double x1, const double x2) const
Give the value of the integral .
@ exc_efailed
generic failure
double deriv_xy(double x, double y) const
Compute the mixed partial derivative .
#define O2SCL_ERR2(d, d2, n)
Set an error, two-string version.
double deriv_yy(double x, double y) const
Compute the partial second derivative in the y-direction.
virtual double eval(const double x0) const
Give the value of the function .
double integ_y(double x, double y0, double y1) const
Compute the integral in the y-direction between y=y0 and y=y1.
The main O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl names...
void reset_interp()
Reset the stored interpolation since the data has changed.
double eval_gen(int ix, int iy, double x0, double x1, double y0, double y1) const
Compute a general interpolation result.
Interpolation class for pre-specified vector.
size_t nx
The number of x grid points.
double deriv_xx(double x, double y) const
Compute the partial second derivative in the x-direction.
static const double x1[5]
@ exc_einval
invalid argument supplied by user
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.
std::vector< interp_vec< vec_t, mat_row_t > * > itps
The array of interpolation objects.
bool data_set
True if the data has been specified by the user.
double integ_x(double x0, double x1, double y) const
Compute the integral in the x-direction between x=x0 and x=x1.
double eval(double x, double y) const
Perform the 2-d interpolation.
#define O2SCL_ERR(d, n)
Set an error with message d and code n.
@ itp_cspline
Cubic spline for natural boundary conditions.
virtual double deriv2(const double x0) const
Give the value of the second derivative .
Two-dimensional interpolation base class [abstract].
double operator()(double x, double y) const
Perform the 2-d interpolation.
virtual double deriv(const double x0) const
Give the value of the derivative .
size_t itype
Interpolation type.
double deriv_y(double x, double y) const
Compute the partial derivative in the y-direction.
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).