ccgsl 2.7.2
C++wrappersforGnuScientificLibrary
gsl::interp Class Reference

Interpolation functions and objects. More...

#include <interp.hpp>

Collaboration diagram for gsl::interp:
Collaboration graph

Classes

class  accel
 Workspace for acceleration. More...
 

Public Types

typedef gsl_interp_type type
 Convenient typedef. More...
 

Public Member Functions

 interp ()
 The default constructor is only really useful for assigning to. More...
 
 interp (type const *T, size_t const n)
 The default constructor creates a new interp with n elements. More...
 
 interp (gsl_interp *v)
 Could construct from a gsl_interp. More...
 
 interp (interp const &v)
 The copy constructor. More...
 
interpoperator= (interp const &v)
 The assignment operator. More...
 
 ~interp ()
 The destructor only deletes the pointers if count reaches zero. More...
 
 interp (interp &&v)
 Move constructor. More...
 
interpoperator= (interp &&v)
 Move operator. More...
 
bool operator== (interp const &v) const
 Two interp are identically equal if their elements are identical. More...
 
bool operator!= (interp const &v) const
 Two interp are different if their elements are not identical. More...
 
bool operator< (interp const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator> (interp const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator<= (interp const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator>= (interp const &v) const
 A container needs to define an ordering for sorting. More...
 
bool empty () const
 Find if the interp is empty. More...
 
void swap (interp &v)
 Swap two interp objects. More...
 
gsl_interp * get () const
 Get the gsl_interp. More...
 
bool unique () const
 Find if this is the only object sharing the gsl_interp. More...
 
size_t use_count () const
 Find how many interp objects share this pointer. More...
 
 operator bool () const
 Allow conversion to bool. More...
 
int init (double const xa[], double const ya[], size_t const size)
 C++ version of gsl_interp_init(). More...
 
template<typename XA , typename YA >
int init (XA const &xa, YA const &ya)
 C++ version of gsl_interp_init(). More...
 
char const * name () const
 C++ version of gsl_interp_name(). More...
 
unsigned int min_size () const
 C++ version of gsl_interp_min_size(). More...
 
unsigned int type_min_size (gsl_interp_type const *T)
 C++ version of gsl_interp_type_min_size(). More...
 
int eval_e (double const xa[], double const ya[], double x, accel &a, double &y) const
 C++ version of gsl_interp_eval_e(). More...
 
double eval (double const xa[], double const ya[], double x, accel &a) const
 C++ version of gsl_interp_eval(). More...
 
int eval_deriv_e (double const xa[], double const ya[], double x, accel &a, double &d) const
 C++ version of gsl_interp_eval_deriv_e(). More...
 
double eval_deriv (double const xa[], double const ya[], double x, accel &a) const
 C++ version of gsl_interp_eval_deriv(). More...
 
int eval_deriv2_e (double const xa[], double const ya[], double x, accel &a, double &d2) const
 C++ version of gsl_interp_eval_deriv2_e(). More...
 
double eval_deriv2 (double const xa[], double const ya[], double x, accel &a) const
 C++ version of gsl_interp_eval_deriv2(). More...
 
int eval_integ_e (double const xa[], double const ya[], double a, double b, accel &acc, double &result) const
 C++ version of gsl_interp_eval_integ_e(). More...
 
double eval_integ (double const xa[], double const ya[], double a, double b, accel &acc) const
 C++ version of gsl_interp_eval_integ(). More...
 
size_t bsearch (double const x_array[], double x, size_t index_lo, size_t index_hi)
 C++ version of gsl_interp_bsearch(). More...
 
template<typename XA , typename YA >
int eval_e (XA const &xa, YA const &ya, double x, accel &a, double &y) const
 C++ version of gsl_interp_eval_e(). More...
 
template<typename XA , typename YA >
double eval (XA const &xa, YA const &ya, double x, accel &a) const
 C++ version of gsl_interp_eval(). More...
 
template<typename XA , typename YA >
int eval_deriv_e (XA const &xa, YA const &ya, double x, accel &a, double &d) const
 C++ version of gsl_interp_eval_deriv_e(). More...
 
template<typename XA , typename YA >
double eval_deriv (XA const &xa, YA const &ya, double x, accel &a) const
 C++ version of gsl_interp_eval_deriv(). More...
 
template<typename XA , typename YA >
int eval_deriv2_e (XA const &xa, YA const &ya, double x, accel &a, double &d2) const
 C++ version of gsl_interp_eval_deriv2_e(). More...
 
template<typename XA , typename YA >
double eval_deriv2 (XA const &xa, YA const &ya, double x, accel &a) const
 C++ version of gsl_interp_eval_deriv2(). More...
 
template<typename XA , typename YA >
int eval_integ_e (XA const &xa, YA const &ya, double a, double b, accel &acc, double &result) const
 C++ version of gsl_interp_eval_integ_e(). More...
 
template<typename XA , typename YA >
double eval_integ (XA const &xa, YA const &ya, double a, double b, accel &acc) const
 C++ version of gsl_interp_eval_integ(). More...
 

Static Public Member Functions

template<typename X >
static size_t bsearch (X const &x_array, double x, size_t index_lo, size_t index_hi)
 C++ version of gsl_interp_bsearch(). More...
 
static type const * cspline ()
 Static type. More...
 
static type const * cspline_periodic ()
 Static type. More...
 
static type const * akima ()
 Static type. More...
 
static type const * akima_periodic ()
 Static type. More...
 
static type const * steffen ()
 Static type. More...
 

Private Attributes

gsl_interp * ccgsl_pointer
 The shared pointer. More...
 
size_t * count
 The shared reference count. More...
 

Detailed Description

Interpolation functions and objects.

Definition at line 31 of file interp.hpp.

Member Typedef Documentation

◆ type

typedef gsl_interp_type gsl::interp::type

Convenient typedef.

Definition at line 36 of file interp.hpp.

Constructor & Destructor Documentation

◆ interp() [1/5]

gsl::interp::interp ( )
inline

The default constructor is only really useful for assigning to.

Definition at line 40 of file interp.hpp.

References ccgsl_pointer, and count.

Referenced by operator=().

◆ interp() [2/5]

gsl::interp::interp ( type const *  T,
size_t const  n 
)
inlineexplicit

The default constructor creates a new interp with n elements.

Parameters
TThe interpolation type
nThe number of elements in the interp

Definition at line 51 of file interp.hpp.

References ccgsl_pointer, count, and gsl::rstat::n().

◆ interp() [3/5]

gsl::interp::interp ( gsl_interp *  v)
inlineexplicit

Could construct from a gsl_interp.

This is not usually a good idea. In this case we should not use gsl_interp_free() to deallocate the memory.

Parameters
vThe interp

Definition at line 67 of file interp.hpp.

References ccgsl_pointer, and count.

◆ interp() [4/5]

gsl::interp::interp ( interp const &  v)
inline

The copy constructor.

This creates a new reference to the workspace.

Parameters
vThe interp to copy.

Definition at line 78 of file interp.hpp.

References ccgsl_pointer, and count.

◆ ~interp()

gsl::interp::~interp ( )
inline

The destructor only deletes the pointers if count reaches zero.

Definition at line 97 of file interp.hpp.

References ccgsl_pointer, and count.

◆ interp() [5/5]

gsl::interp::interp ( interp &&  v)
inline

Move constructor.

Parameters
vThe interp to move.

Definition at line 109 of file interp.hpp.

References count.

Member Function Documentation

◆ akima()

static type const * gsl::interp::akima ( )
inlinestatic

Static type.

Returns
the named interpolation type

Definition at line 857 of file interp.hpp.

◆ akima_periodic()

static type const * gsl::interp::akima_periodic ( )
inlinestatic

Static type.

Returns
the named interpolation type

Definition at line 862 of file interp.hpp.

◆ bsearch() [1/2]

size_t gsl::interp::bsearch ( double const  x_array[],
double  x,
size_t  index_lo,
size_t  index_hi 
)
inline

C++ version of gsl_interp_bsearch().

Parameters
x_array[]the array of x values
xa given value x
index_lolower bound for result
index_hiupper bound for result
Returns
the index

Definition at line 652 of file interp.hpp.

◆ bsearch() [2/2]

template<typename X >
static size_t gsl::interp::bsearch ( X const &  x_array,
double  x,
size_t  index_lo,
size_t  index_hi 
)
inlinestatic

C++ version of gsl_interp_bsearch().

This version handles std::vector and gsl::vector.

Parameters
x_arraythe array of x values
xa given value x
index_lolower bound for result
index_hiupper bound for result
Returns
the index

Definition at line 839 of file interp.hpp.

◆ cspline()

static type const * gsl::interp::cspline ( )
inlinestatic

Static type.

Returns
the named interpolation type

Definition at line 847 of file interp.hpp.

◆ cspline_periodic()

static type const * gsl::interp::cspline_periodic ( )
inlinestatic

Static type.

Returns
the named interpolation type

Definition at line 852 of file interp.hpp.

◆ empty()

bool gsl::interp::empty ( ) const
inline

Find if the interp is empty.

Returns
true if has size zero; otherwise false

Definition at line 186 of file interp.hpp.

References ccgsl_pointer.

◆ eval() [1/2]

double gsl::interp::eval ( double const  xa[],
double const  ya[],
double  x,
accel a 
) const
inline

C++ version of gsl_interp_eval().

Parameters
xa[]the array of x values
ya[]the array of y values
xa given value x
aan accelerator
Returns
the interpolated value of y at x

Definition at line 528 of file interp.hpp.

References gsl::sf::mathieu::a(), and get().

◆ eval() [2/2]

template<typename XA , typename YA >
double gsl::interp::eval ( XA const &  xa,
YA const &  ya,
double  x,
accel a 
) const
inline

C++ version of gsl_interp_eval().

This version handles std::vector and gsl::vector.

Parameters
xathe array of x values
yathe array of y values
xa given value x
aan accelerator
Returns
the interpolated value of y at x

Definition at line 695 of file interp.hpp.

References gsl::sf::mathieu::a(), and get().

◆ eval_deriv() [1/2]

double gsl::interp::eval_deriv ( double const  xa[],
double const  ya[],
double  x,
accel a 
) const
inline

C++ version of gsl_interp_eval_deriv().

Parameters
xa[]the array of x values
ya[]the array of y values
xa given value x
aan accelerator
Returns
the interpolated value of the derivative of y at x

Definition at line 564 of file interp.hpp.

References gsl::sf::mathieu::a(), and get().

◆ eval_deriv() [2/2]

template<typename XA , typename YA >
double gsl::interp::eval_deriv ( XA const &  xa,
YA const &  ya,
double  x,
accel a 
) const
inline

C++ version of gsl_interp_eval_deriv().

This version handles std::vector and gsl::vector.

Parameters
xathe array of x values
yathe array of y values
xa given value x
aan accelerator
Returns
the interpolated value of the derivative of y at x

Definition at line 737 of file interp.hpp.

References gsl::sf::mathieu::a(), and get().

◆ eval_deriv2() [1/2]

double gsl::interp::eval_deriv2 ( double const  xa[],
double const  ya[],
double  x,
accel a 
) const
inline

C++ version of gsl_interp_eval_deriv2().

Parameters
xa[]the array of x values
ya[]the array of y values
xa given value x
aan accelerator
Returns
the interpolated value of the second derivative of y at x

Definition at line 600 of file interp.hpp.

References gsl::sf::mathieu::a(), and get().

◆ eval_deriv2() [2/2]

template<typename XA , typename YA >
double gsl::interp::eval_deriv2 ( XA const &  xa,
YA const &  ya,
double  x,
accel a 
) const
inline

C++ version of gsl_interp_eval_deriv2().

This version handles std::vector and gsl::vector.

Parameters
xathe array of x values
yathe array of y values
xa given value x
aan accelerator
Returns
the interpolated value of the second derivative of y at x

Definition at line 779 of file interp.hpp.

References gsl::sf::mathieu::a(), and get().

◆ eval_deriv2_e() [1/2]

int gsl::interp::eval_deriv2_e ( double const  xa[],
double const  ya[],
double  x,
accel a,
double &  d2 
) const
inline

C++ version of gsl_interp_eval_deriv2_e().

Parameters
xa[]the array of x values
ya[]the array of y values
xa given value x
aan accelerator
d2the interpolated value of the second derivative of y at x (return value)
Returns
Error code on failure

Definition at line 589 of file interp.hpp.

References gsl::sf::mathieu::a(), and get().

◆ eval_deriv2_e() [2/2]

template<typename XA , typename YA >
int gsl::interp::eval_deriv2_e ( XA const &  xa,
YA const &  ya,
double  x,
accel a,
double &  d2 
) const
inline

C++ version of gsl_interp_eval_deriv2_e().

This version handles std::vector and gsl::vector.

Parameters
xathe array of x values
yathe array of y values
xa given value x
aan accelerator
d2the interpolated value of the second derivative of y at x (return value)
Returns
Error code on failure

Definition at line 766 of file interp.hpp.

References gsl::sf::mathieu::a(), and get().

◆ eval_deriv_e() [1/2]

int gsl::interp::eval_deriv_e ( double const  xa[],
double const  ya[],
double  x,
accel a,
double &  d 
) const
inline

C++ version of gsl_interp_eval_deriv_e().

Parameters
xa[]the array of x values
ya[]the array of y values
xa given value x
aan accelerator
dthe interpolated value of the derivative of y at x (return value)
Returns
Error code on failure

Definition at line 553 of file interp.hpp.

References gsl::sf::mathieu::a(), and get().

◆ eval_deriv_e() [2/2]

template<typename XA , typename YA >
int gsl::interp::eval_deriv_e ( XA const &  xa,
YA const &  ya,
double  x,
accel a,
double &  d 
) const
inline

C++ version of gsl_interp_eval_deriv_e().

This version handles std::vector and gsl::vector.

Parameters
xathe array of x values
yathe array of y values
xa given value x
aan accelerator
dthe interpolated value of the derivative of y at x (return value)
Returns
Error code on failure

Definition at line 724 of file interp.hpp.

References gsl::sf::mathieu::a(), and get().

◆ eval_e() [1/2]

int gsl::interp::eval_e ( double const  xa[],
double const  ya[],
double  x,
accel a,
double &  y 
) const
inline

C++ version of gsl_interp_eval_e().

Parameters
xa[]the array of x values
ya[]the array of y values
xa given value x
aan accelerator
ythe interpolated value of y at x (return value)
Returns
Error code on failure

Definition at line 517 of file interp.hpp.

References gsl::sf::mathieu::a(), and get().

◆ eval_e() [2/2]

template<typename XA , typename YA >
int gsl::interp::eval_e ( XA const &  xa,
YA const &  ya,
double  x,
accel a,
double &  y 
) const
inline

C++ version of gsl_interp_eval_e().

This version handles std::vector and gsl::vector.

Parameters
xathe array of x values
yathe array of y values
xa given value x
aan accelerator
ythe interpolated value of y at x (return value)
Returns
Error code on failure

Definition at line 682 of file interp.hpp.

References gsl::sf::mathieu::a(), and get().

◆ eval_integ() [1/2]

double gsl::interp::eval_integ ( double const  xa[],
double const  ya[],
double  a,
double  b,
accel acc 
) const
inline

C++ version of gsl_interp_eval_integ().

Parameters
xa[]the array of x values
ya[]the array of y values
athe lower integral limit
bthe upper integral limit
accan accelerator
Returns
the interpolated integral between a and b

Definition at line 641 of file interp.hpp.

References gsl::sf::mathieu::a(), gsl::sf::mathieu::b(), get(), and gsl::interp::accel::get().

◆ eval_integ() [2/2]

template<typename XA , typename YA >
double gsl::interp::eval_integ ( XA const &  xa,
YA const &  ya,
double  a,
double  b,
accel acc 
) const
inline

C++ version of gsl_interp_eval_integ().

This version handles std::vector and gsl::vector.

Parameters
xathe array of x values
yathe array of y values
athe lower integral limit
bthe upper integral limit
accan accelerator
Returns
the interpolated integral between a and b

Definition at line 826 of file interp.hpp.

References gsl::sf::mathieu::a(), gsl::sf::mathieu::b(), get(), and gsl::interp::accel::get().

◆ eval_integ_e() [1/2]

int gsl::interp::eval_integ_e ( double const  xa[],
double const  ya[],
double  a,
double  b,
accel acc,
double &  result 
) const
inline

C++ version of gsl_interp_eval_integ_e().

Parameters
xa[]the array of x values
ya[]the array of y values
athe lower integral limit
bthe upper integral limit
accan accelerator
resultthe interpolated integral between a and b (return value)
Returns
Error code on failure

Definition at line 628 of file interp.hpp.

References gsl::sf::mathieu::a(), gsl::sf::mathieu::b(), get(), and gsl::interp::accel::get().

◆ eval_integ_e() [2/2]

template<typename XA , typename YA >
int gsl::interp::eval_integ_e ( XA const &  xa,
YA const &  ya,
double  a,
double  b,
accel acc,
double &  result 
) const
inline

C++ version of gsl_interp_eval_integ_e().

This version handles std::vector and gsl::vector.

Parameters
xathe array of x values
yathe array of y values
athe lower integral limit
bthe upper integral limit
accan accelerator
resultthe interpolated integral between a and b (return value)
Returns
Error code on failure

Definition at line 811 of file interp.hpp.

References gsl::sf::mathieu::a(), gsl::sf::mathieu::b(), get(), and gsl::interp::accel::get().

◆ get()

gsl_interp * gsl::interp::get ( ) const
inline

Get the gsl_interp.

Returns
the gsl_interp

Definition at line 212 of file interp.hpp.

References ccgsl_pointer.

Referenced by eval(), eval_deriv(), eval_deriv2(), eval_deriv2_e(), eval_deriv_e(), eval_e(), eval_integ(), eval_integ_e(), init(), min_size(), and name().

◆ init() [1/2]

int gsl::interp::init ( double const  xa[],
double const  ya[],
size_t const  size 
)
inline

C++ version of gsl_interp_init().

Parameters
xa[]the array of x values
ya[]the array of y values
sizethe size of xa and ya
Returns
Error code on failure

Definition at line 460 of file interp.hpp.

References get(), and gsl::cheb::size().

◆ init() [2/2]

template<typename XA , typename YA >
int gsl::interp::init ( XA const &  xa,
YA const &  ya 
)
inline

C++ version of gsl_interp_init().

This version handles std::vector and gsl::vector.

Parameters
xathe array of x values
yathe array of y values
Returns
Error code on failure

Definition at line 471 of file interp.hpp.

References get().

◆ min_size()

unsigned int gsl::interp::min_size ( ) const
inline

C++ version of gsl_interp_min_size().

Returns
the minimum number of points for the interpolation

Definition at line 486 of file interp.hpp.

References get().

◆ name()

char const * gsl::interp::name ( ) const
inline

C++ version of gsl_interp_name().

Returns
The name of the interpolation method

Definition at line 480 of file interp.hpp.

References get().

◆ operator bool()

gsl::interp::operator bool ( ) const
inlineexplicit

Allow conversion to bool.

Returns
true or false according as this contains a pointer to a gsl_interp.

Definition at line 232 of file interp.hpp.

References ccgsl_pointer.

◆ operator!=()

bool gsl::interp::operator!= ( interp const &  v) const
inline

Two interp are different if their elements are not identical.

Parameters
vThe interp to be compared with this
Returns
false or true according as this and v have identical elements or not

Definition at line 139 of file interp.hpp.

References operator==().

◆ operator<()

bool gsl::interp::operator< ( interp const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for example, for checking, that a interp is nonnegative.

Parameters
vThe interp to be compared with this
Returns
false or true according as this is less than v lexicographically

Definition at line 151 of file interp.hpp.

References ccgsl_pointer.

◆ operator<=()

bool gsl::interp::operator<= ( interp const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for example, for checking, that a interp is nonnegative.

Parameters
vThe interp to be compared with this
Returns
false or true according as this is less than or equal to v lexicographically

Definition at line 171 of file interp.hpp.

References ccgsl_pointer.

◆ operator=() [1/2]

interp & gsl::interp::operator= ( interp &&  v)
inline

Move operator.

Parameters
vThe interp to move.
Returns
A reference to this.

Definition at line 118 of file interp.hpp.

References interp().

◆ operator=() [2/2]

interp & gsl::interp::operator= ( interp const &  v)
inline

The assignment operator.

This copies elementwise.

Parameters
vThe interp to copy

Definition at line 85 of file interp.hpp.

References ccgsl_pointer, and count.

◆ operator==()

bool gsl::interp::operator== ( interp const &  v) const
inline

Two interp are identically equal if their elements are identical.

Parameters
vThe interp to be compared with this
Returns
true or false according as this and v have identical elements or not

Definition at line 131 of file interp.hpp.

References ccgsl_pointer.

Referenced by operator!=().

◆ operator>()

bool gsl::interp::operator> ( interp const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for example, for checking, that a interp is nonnegative.

Parameters
vThe interp to be compared with this
Returns
false or true according as this is greater than v lexicographically

Definition at line 161 of file interp.hpp.

References ccgsl_pointer.

◆ operator>=()

bool gsl::interp::operator>= ( interp const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for example, for checking, that a interp is nonnegative.

Parameters
vThe interp to be compared with this
Returns
false or true according as this is no less than v lexicographically

Definition at line 181 of file interp.hpp.

References ccgsl_pointer.

◆ steffen()

static type const * gsl::interp::steffen ( )
inlinestatic

Static type.

Returns
the named interpolation type

Definition at line 867 of file interp.hpp.

◆ swap()

void gsl::interp::swap ( interp v)
inline

Swap two interp objects.

This works even if the interp have different sizes because it swaps pointers.

Parameters
vThe interp to swap with this.

Definition at line 193 of file interp.hpp.

References ccgsl_pointer, and count.

◆ type_min_size()

unsigned int gsl::interp::type_min_size ( gsl_interp_type const *  T)
inline

C++ version of gsl_interp_type_min_size().

Parameters
TThe type
Returns
The minimum number of points required for the interpolation

Definition at line 493 of file interp.hpp.

◆ unique()

bool gsl::interp::unique ( ) const
inline

Find if this is the only object sharing the gsl_interp.

Returns
true or falses according as this is the only interp object sharing the gsl_interp.

Definition at line 218 of file interp.hpp.

References count.

◆ use_count()

size_t gsl::interp::use_count ( ) const
inline

Find how many interp objects share this pointer.

Returns
the number of interp objects that share this pointer.

Definition at line 223 of file interp.hpp.

References count.

Member Data Documentation

◆ ccgsl_pointer

gsl_interp* gsl::interp::ccgsl_pointer
private

The shared pointer.

Definition at line 201 of file interp.hpp.

Referenced by empty(), get(), interp(), operator bool(), operator<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), swap(), and ~interp().

◆ count

size_t* gsl::interp::count
private

The shared reference count.

Definition at line 205 of file interp.hpp.

Referenced by interp(), operator=(), swap(), unique(), use_count(), and ~interp().


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