MADNESS 0.10.1
Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
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)
 
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
 
T operator() (double y) const
 

Static Public Attributes

static int min_npts_per_task_default = 1024
 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(), World *world_ptr=nullptr)
 

Static Protected Member Functions

static void cubic_fit (const double *x, const T *f, T *a)
 

Protected Attributes

std::vector< Ta
 (1+4)*npt vector of x and polynomial coefficients
 
double h
 Grid spacing.
 
double hi
 Interpolation is in range [lo,hi].
 
double lo
 Interpolation is in range [lo,hi].
 
int npt
 No. of grid points.
 
double rh
 1/h
 

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/5]

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 madness::WorldTaskQueue::add(), madness::f, madness::WorldTaskQueue::fence(), madness::CubicInterpolationTable< T >::h, madness::CubicInterpolationTable< T >::make_interpolation(), madness::CubicInterpolationTable< T >::npt, p(), madness::ThreadPool::size(), task(), and madness::World::taskq.

◆ CubicInterpolationTable() [2/5]

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

◆ CubicInterpolationTable() [3/5]

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

◆ CubicInterpolationTable() [4/5]

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

◆ CubicInterpolationTable() [5/5]

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

◆ ~CubicInterpolationTable()

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

Member Function Documentation

◆ cubic_fit()

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

◆ err()

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

◆ 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(),
World world_ptr = nullptr 
)
inlineprotected

◆ operator()()

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

Member Data Documentation

◆ a

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

◆ h

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

◆ hi

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

Interpolation is in range [lo,hi].

◆ lo

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

◆ min_npts_per_task_default

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

minimum # of points per task

◆ npt

template<typename T >
int madness::CubicInterpolationTable< T >::npt
protected

◆ rh

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

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