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 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 {
187 for(
size_t i=0;i<
nx;i++) {
188 icol[i]=
itps[i]->eval(y);
210 for(
size_t i=0;i<
nx;i++) {
211 icol[i]=
itps[i]->eval(y);
227 for(
size_t i=0;i<
nx;i++) {
228 icol[i]=
itps[i]->eval(y);
245 for(
size_t i=0;i<
nx;i++) {
246 icol[i]=
itps[i]->eval(y);
249 result=six.
integ(x0,x1);
263 for(
size_t i=0;i<
nx;i++) {
264 icol[i]=
itps[i]->deriv(y);
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 {
298 for(
size_t i=0;i<
nx;i++) {
299 icol[i]=
itps[i]->integ(y0,y1);
316 for(
size_t i=0;i<
nx;i++) {
317 icol[i]=
itps[i]->deriv(y);
348 double y0,
double y1)
const {
355 for(
size_t i=0;i<
nx;i++) {
357 icol[i]=
itps[i]->integ(y0,y1);
359 icol[i]=
itps[i]->eval(y0);
361 icol[i]=
itps[i]->deriv(y0);
363 icol[i]=
itps[i]->deriv2(y0);
365 O2SCL_ERR2(
"Invalid value of 'iy' for interp2_seq::",
371 result=six.
integ(x0,x1);
375 result=six.
deriv(x0);
379 O2SCL_ERR2(
"Invalid value of 'ix' for interp2_seq::",
385 #ifndef DOXYGEN_INTERNAL 390 std::vector<interp_vec<vec_t,mat_row_t> *>
itps;
421 (
const interp2_seq<vec_t,mat_t,mat_row_t>&);
427 #ifndef DOXYGEN_NO_O2NS size_t ny
The number of y grid points.
Interpolation class for pre-specified vector.
double deriv_yy(double x, double y) const
Compute the partial second derivative in the y-direction.
double integ_x(double x0, double x1, double y) const
Compute the integral in the x-direction between x=x0 and x=x1.
Two-dimensional interpolation class by successive one-dimensional interpolation.
double deriv_x(double x, double y) const
Compute the partial derivative in the x-direction.
The main O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl names...
size_t itype
Interpolation type.
std::vector< mat_row_t * > vecs
An array of rows.
virtual double deriv2(const double x0) const
Give the value of the second derivative .
invalid argument supplied by user
std::vector< interp_vec< vec_t, mat_row_t > * > itps
The array of interpolation objects.
virtual double deriv(const double x0) const
Give the value of the derivative .
Cubic spline for natural boundary conditions.
double deriv_y(double x, double y) const
Compute the partial derivative in the y-direction.
#define O2SCL_ERR2(d, d2, n)
Set an error, two-string version.
virtual double integ(const double x1, const double x2) const
Give the value of the integral .
bool data_set
True if the data has been specified by the user.
#define O2SCL_ERR(d, n)
Set an error with message d and code n.
double operator()(double x, double y) const
Perform the 2-d interpolation.
double eval(double x, double y) const
Perform the 2-d interpolation.
Two-dimensional interpolation base class [abstract].
double eval_gen(int ix, int iy, double x0, double x1, double y0, double y1) const
Compute a general interpolation result.
double deriv_xy(double x, double y) const
Compute the mixed partial derivative .
size_t nx
The number of x grid points.
void reset_interp()
Reset the stored interpolation since the data has changed.
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_xx(double x, double y) const
Compute the partial second derivative in the x-direction.
virtual double eval(const double x0) const
Give the value of the function .
static const double x1[5]
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.