MADNESS 0.10.1
madness::CubicInterpolationTable< T > Class Template Reference

An class for 1-D data interpolation based on cubic polynomials. More...

#include <interpolation_1d.h>

Public Member Functions

 CubicInterpolationTable ()
template<typename functionT>
 CubicInterpolationTable (double lo, double hi, int npt, const functionT &f)
 CubicInterpolationTable (double lo, double hi, int npt, const std::vector< T > &y)
 CubicInterpolationTable (std::vector< T > x, std::vector< T > y)
template<typename functionT>
 CubicInterpolationTable (World &world, double lo, double hi, int npt, const functionT &f, const int min_npts_per_task=min_npts_per_task_default)
virtual ~CubicInterpolationTable ()
template<typename functionT>
double err (const functionT &f) const
double get_hi () const
double get_lo () const
T operator() (double y) const

Static Public Attributes

static int min_npts_per_task_default
 minimum # of points per task

Protected Member Functions

template<typename functionT>
 CubicInterpolationTable (World *world_ptr, double lo, double hi, int npt, const functionT &f, const int min_npts_per_task=std::numeric_limits< double >::max())
void make_interpolation (const std::vector< double > &x, const std::vector< T > &p, const int npts_per_task=std::numeric_limits< int >::max() - 1, World *world_ptr=nullptr)

Static Protected Member Functions

static void cubic_fit (const double *x, const T *f, T *a)
 Grid points. Only stored if not evenly spaced. Empty otherwise.

Protected Attributes

std::vector< T > a
double h
 Below variables meaningful if user does specifies uniform spacing.
double hi
 Interpolation is in range [lo,hi].
double lo
 Interpolation is in range [lo,hi].
int npt
 No. of grid points.
std::vector< double > pts_
 Below variables meaningful if user provides grid points.
double rh

Detailed Description

template<typename T>
class madness::CubicInterpolationTable< T >

An class for 1-D data interpolation based on cubic polynomials.

Needs to be passed the endpoints of the interpolation: [lo,hi] and the number of grid points.

Two methods for generating the interpolation are presently supported: 1) Pass in a std::vector containing the y-points. 2) Pass in some object that provides an appropriate () operator, perhaps a function pointer.

Constructor & Destructor Documentation

◆ CubicInterpolationTable() [1/6]

template<typename T>
template<typename functionT>
madness::CubicInterpolationTable< T >::CubicInterpolationTable ( World * world_ptr,
double lo,
double hi,
int npt,
const functionT & f,
const int min_npts_per_task = std::numeric_limits<double>::max() )
inlineprotected

constructs the interpolation table using optional tasking

Parameters
world_ptrpointer to the World object whose local taskq to use for tasking; if null, will compute serially
lothe lower bound of the interpolation interval
upthe upper bound of the interpolation interval
nptthe number of interpolation points
[in]fa T(T) callable; should be reentrant if npt is less than min_npts_per_task
[in]min_npts_per_taskif npt is greater than this and there is more than 1 thread will use tasks
Warning
computes data locally even if world has more than 1 rank

References a, madness::WorldTaskQueue::add(), madness::f, madness::WorldTaskQueue::fence(), h, hi, lo, make_interpolation(), npt, p(), rh, madness::ThreadPool::size(), task(), and madness::World::taskq.

Referenced by CubicInterpolationTable(), and CubicInterpolationTable().

◆ CubicInterpolationTable() [2/6]

template<typename T>
madness::CubicInterpolationTable< T >::CubicInterpolationTable ( )
inline

References h, hi, lo, npt, and rh.

◆ CubicInterpolationTable() [3/6]

template<typename T>
template<typename functionT>
madness::CubicInterpolationTable< T >::CubicInterpolationTable ( double lo,
double hi,
int npt,
const functionT & f )
inline

constructs the interpolation table serially

Parameters
lothe lower bound of the interpolation interval
upthe upper bound of the interpolation interval
nptthe number of interpolation points
[in]fa T(T) callable; should be reentrant if npt is less than min_npts_per_task
[in]min_npts_per_taskif npt is greater than this and there is more than 1 thread will use tasks

References CubicInterpolationTable(), madness::f, hi, lo, and npt.

◆ CubicInterpolationTable() [4/6]

template<typename T>
template<typename functionT>
madness::CubicInterpolationTable< T >::CubicInterpolationTable ( World & world,
double lo,
double hi,
int npt,
const functionT & f,
const int min_npts_per_task = min_npts_per_task_default )
inline

constructs the interpolation table using optional tasking

Parameters
worldthe World object whose local taskq to use for tasking
lothe lower bound of the interpolation interval
upthe upper bound of the interpolation interval
nptthe number of interpolation points
[in]fa T(T) callable; should be reentrant if npt is less than min_npts_per_task
[in]min_npts_per_taskif npt is greater than this and there is more than 1 thread will use tasks
Warning
computes data locally even if world has more than 1 rank

References CubicInterpolationTable(), madness::f, hi, lo, min_npts_per_task_default, and npt.

◆ CubicInterpolationTable() [5/6]

template<typename T>
madness::CubicInterpolationTable< T >::CubicInterpolationTable ( std::vector< T > x,
std::vector< T > y )
inline

References a, hi, lo, make_interpolation(), npt, and pts_.

◆ CubicInterpolationTable() [6/6]

template<typename T>
madness::CubicInterpolationTable< T >::CubicInterpolationTable ( double lo,
double hi,
int npt,
const std::vector< T > & y )
inline

References a, h, hi, lo, make_interpolation(), npt, and rh.

◆ ~CubicInterpolationTable()

template<typename T>
virtual madness::CubicInterpolationTable< T >::~CubicInterpolationTable ( )
inlinevirtual

Member Function Documentation

◆ cubic_fit()

template<typename T>
void madness::CubicInterpolationTable< T >::cubic_fit ( const double * x,
const T * f,
T * a )
inlinestaticprotected

Grid points. Only stored if not evenly spaced. Empty otherwise.

References a, and madness::f.

Referenced by make_interpolation().

◆ err()

template<typename T>
template<typename functionT>
double madness::CubicInterpolationTable< T >::err ( const functionT & f) const
inline

References exact, madness::f, fit(), h, lo, npt, and pts_.

◆ get_hi()

template<typename T>
double madness::CubicInterpolationTable< T >::get_hi ( ) const
inline

References hi.

◆ get_lo()

template<typename T>
double madness::CubicInterpolationTable< T >::get_lo ( ) const
inline

References lo.

◆ make_interpolation()

template<typename T>
void madness::CubicInterpolationTable< T >::make_interpolation ( const std::vector< double > & x,
const std::vector< T > & p,
const int npts_per_task = std::numeric_limits<int>::max() - 1,
World * world_ptr = nullptr )
inlineprotected

◆ operator()()

template<typename T>
T madness::CubicInterpolationTable< T >::operator() ( double y) const
inline

References a, hi, lo, npt, pts_, and rh.

Member Data Documentation

◆ a

template<typename T>
std::vector<T> madness::CubicInterpolationTable< T >::a
protected

(1+4)*npt vector of x and polynomial coefficients

Referenced by CubicInterpolationTable(), CubicInterpolationTable(), CubicInterpolationTable(), cubic_fit(), make_interpolation(), and operator()().

◆ h

template<typename T>
double madness::CubicInterpolationTable< T >::h
protected

Below variables meaningful if user does specifies uniform spacing.

Grid spacing.

Referenced by CubicInterpolationTable(), CubicInterpolationTable(), CubicInterpolationTable(), and err().

◆ hi

◆ lo

◆ min_npts_per_task_default

template<typename T>
int madness::CubicInterpolationTable< T >::min_npts_per_task_default
static

minimum # of points per task

Referenced by CubicInterpolationTable().

◆ npt

◆ pts_

template<typename T>
std::vector<double> madness::CubicInterpolationTable< T >::pts_
protected

Below variables meaningful if user provides grid points.

Referenced by CubicInterpolationTable(), err(), and operator()().

◆ rh


The documentation for this class was generated from the following file: