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

Higher level interface for interpolation. More...

#include <spline.hpp>

Collaboration diagram for gsl::spline:
Collaboration graph

Public Types

typedef gsl_interp_type type
 Convenience typedef. More...
 

Public Member Functions

 spline ()
 The default constructor is only really useful for assigning to. More...
 
 spline (type const *T, size_t const n)
 The default constructor creates a new spline with n elements. More...
 
 spline (gsl_spline *v)
 Could construct from a gsl_spline. More...
 
 spline (spline const &v)
 The copy constructor. More...
 
splineoperator= (spline const &v)
 The assignment operator. More...
 
 ~spline ()
 The destructor only deletes the pointers if count reaches zero. More...
 
 spline (spline &&v)
 Move constructor. More...
 
splineoperator= (spline &&v)
 Move operator. More...
 
bool operator== (spline const &v) const
 Two spline are identically equal if their elements are identical. More...
 
bool operator!= (spline const &v) const
 Two spline are different if their elements are not identical. More...
 
bool operator< (spline const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator> (spline const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator<= (spline const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator>= (spline const &v) const
 A container needs to define an ordering for sorting. More...
 
bool empty () const
 Find if the spline is empty. More...
 
void swap (spline &v)
 Swap two spline objects. More...
 
gsl_spline * get () const
 Get the gsl_spline. More...
 
bool unique () const
 Find if this is the only object sharing the gsl_spline. More...
 
size_t use_count () const
 Find how many spline objects share this pointer. More...
 
 operator bool () const
 Allow conversion to bool. More...
 
int init (double const xa[], double const ya[], size_t size)
 C++ version of gsl_spline_init(). More...
 
template<typename XA , typename YA >
int init (XA const &xa, YA const &ya)
 C++ version of gsl_spline_init(). More...
 
char const * name () const
 C++ version of gsl_spline_name(). More...
 
unsigned int min_size () const
 C++ version of gsl_spline_min_size(). More...
 
int eval_e (double x, interp::accel &a, double *y) const
 C++ version of gsl_spline_eval_e(). More...
 
int eval_e (double x, interp::accel &a, double &y) const
 C++ version of gsl_spline_eval_e(). More...
 
double eval (double x, interp::accel &a) const
 C++ version of gsl_spline_eval(). More...
 
int eval_deriv_e (double x, interp::accel &a, double *y) const
 C++ version of gsl_spline_eval_deriv_e(). More...
 
int eval_deriv_e (double x, interp::accel &a, double &y) const
 C++ version of gsl_spline_eval_deriv_e(). More...
 
double eval_deriv (double x, interp::accel &a) const
 C++ version of gsl_spline_eval_deriv(). More...
 
int eval_deriv2_e (double x, interp::accel &a, double *y) const
 C++ version of gsl_spline_eval_deriv2_e(). More...
 
int eval_deriv2_e (double x, interp::accel &a, double &y) const
 C++ version of gsl_spline_eval_deriv2_e(). More...
 
double eval_deriv2 (double x, interp::accel &a) const
 C++ version of gsl_spline_eval_deriv2(). More...
 
int eval_integ_e (double a, double b, interp::accel &acc, double *y) const
 C++ version of gsl_spline_eval_integ_e(). More...
 
int eval_integ_e (double a, double b, interp::accel &acc, double &y) const
 C++ version of gsl_spline_eval_integ_e(). More...
 
double eval_integ (double a, double b, interp::accel &acc) const
 C++ version of gsl_spline_eval_integ(). More...
 

Private Attributes

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

Detailed Description

Higher level interface for interpolation.

Definition at line 31 of file spline.hpp.

Member Typedef Documentation

◆ type

typedef gsl_interp_type gsl::spline::type

Convenience typedef.

Definition at line 36 of file spline.hpp.

Constructor & Destructor Documentation

◆ spline() [1/5]

gsl::spline::spline ( )
inline

The default constructor is only really useful for assigning to.

Definition at line 40 of file spline.hpp.

References ccgsl_pointer, and count.

Referenced by operator=().

◆ spline() [2/5]

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

The default constructor creates a new spline with n elements.

Parameters
TThe interpolation type: use static functions from interp to choose a type
nThe number of elements in the spline

Definition at line 52 of file spline.hpp.

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

◆ spline() [3/5]

gsl::spline::spline ( gsl_spline *  v)
inlineexplicit

Could construct from a gsl_spline.

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

Parameters
vThe spline

Definition at line 68 of file spline.hpp.

References ccgsl_pointer, and count.

◆ spline() [4/5]

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

The copy constructor.

This creates a new reference to the workspace.

Parameters
vThe spline to copy.

Definition at line 79 of file spline.hpp.

References ccgsl_pointer, and count.

◆ ~spline()

gsl::spline::~spline ( )
inline

The destructor only deletes the pointers if count reaches zero.

Definition at line 98 of file spline.hpp.

References ccgsl_pointer, and count.

◆ spline() [5/5]

gsl::spline::spline ( spline &&  v)
inline

Move constructor.

Parameters
vThe spline to move.

Definition at line 110 of file spline.hpp.

References count.

Member Function Documentation

◆ empty()

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

Find if the spline is empty.

Returns
true if has size zero; otherwise false

Definition at line 187 of file spline.hpp.

References ccgsl_pointer.

◆ eval()

double gsl::spline::eval ( double  x,
interp::accel a 
) const
inline

C++ version of gsl_spline_eval().

Parameters
xa given value of x
aan accelerator
Returns
the interpolated value of y at x

Definition at line 293 of file spline.hpp.

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

◆ eval_deriv()

double gsl::spline::eval_deriv ( double  x,
interp::accel a 
) const
inline

C++ version of gsl_spline_eval_deriv().

Parameters
xa given value of x
aan accelerator
Returns
the derivative of the interpolated value at x

Definition at line 321 of file spline.hpp.

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

◆ eval_deriv2()

double gsl::spline::eval_deriv2 ( double  x,
interp::accel a 
) const
inline

C++ version of gsl_spline_eval_deriv2().

Parameters
xa given value of x
aan accelerator
Returns
the second derivative of the interpolated value at x

Definition at line 349 of file spline.hpp.

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

◆ eval_deriv2_e() [1/2]

int gsl::spline::eval_deriv2_e ( double  x,
interp::accel a,
double &  y 
) const
inline

C++ version of gsl_spline_eval_deriv2_e().

Parameters
xa given value of x
aan accelerator
ythe second derivative of the interpolated value at x (return value)
Returns
Error code on failure

Definition at line 340 of file spline.hpp.

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

◆ eval_deriv2_e() [2/2]

int gsl::spline::eval_deriv2_e ( double  x,
interp::accel a,
double *  y 
) const
inline

C++ version of gsl_spline_eval_deriv2_e().

Parameters
xa given value of x
aan accelerator
ythe second derivative of the interpolated value at x (return value)
Returns
Error code on failure

Definition at line 331 of file spline.hpp.

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

◆ eval_deriv_e() [1/2]

int gsl::spline::eval_deriv_e ( double  x,
interp::accel a,
double &  y 
) const
inline

C++ version of gsl_spline_eval_deriv_e().

Parameters
xa given value of x
aan accelerator
ythe derivative of the interpolated value at x (return value)
Returns
Error code on failure

Definition at line 312 of file spline.hpp.

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

◆ eval_deriv_e() [2/2]

int gsl::spline::eval_deriv_e ( double  x,
interp::accel a,
double *  y 
) const
inline

C++ version of gsl_spline_eval_deriv_e().

Parameters
xa given value of x
aan accelerator
ythe derivative of the interpolated value at x (return value)
Returns
Error code on failure

Definition at line 303 of file spline.hpp.

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

◆ eval_e() [1/2]

int gsl::spline::eval_e ( double  x,
interp::accel a,
double &  y 
) const
inline

C++ version of gsl_spline_eval_e().

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

Definition at line 284 of file spline.hpp.

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

◆ eval_e() [2/2]

int gsl::spline::eval_e ( double  x,
interp::accel a,
double *  y 
) const
inline

C++ version of gsl_spline_eval_e().

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

Definition at line 275 of file spline.hpp.

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

◆ eval_integ()

double gsl::spline::eval_integ ( double  a,
double  b,
interp::accel acc 
) const
inline

C++ version of gsl_spline_eval_integ().

Parameters
alower limit of integration
bupper limit of integration
accan accelerator
Returns
interpolated integral between a and b

Definition at line 380 of file spline.hpp.

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

◆ eval_integ_e() [1/2]

int gsl::spline::eval_integ_e ( double  a,
double  b,
interp::accel acc,
double &  y 
) const
inline

C++ version of gsl_spline_eval_integ_e().

Parameters
alower limit of integration
bupper limit of integration
accan accelerator
yinterpolated integral between a and b (return value)
Returns
Error code on failure

Definition at line 370 of file spline.hpp.

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

◆ eval_integ_e() [2/2]

int gsl::spline::eval_integ_e ( double  a,
double  b,
interp::accel acc,
double *  y 
) const
inline

C++ version of gsl_spline_eval_integ_e().

Parameters
alower limit of integration
bupper limit of integration
accan accelerator
yinterpolated integral between a and b (return value)
Returns
Error code on failure

Definition at line 360 of file spline.hpp.

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

◆ get()

gsl_spline * gsl::spline::get ( ) const
inline

Get the gsl_spline.

Returns
the gsl_spline

Definition at line 213 of file spline.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::spline::init ( double const  xa[],
double const  ya[],
size_t  size 
)
inline

C++ version of gsl_spline_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 242 of file spline.hpp.

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

◆ init() [2/2]

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

C++ version of gsl_spline_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 253 of file spline.hpp.

References get().

◆ min_size()

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

C++ version of gsl_spline_min_size().

Returns
the minimum number of points needed for interpolation

Definition at line 266 of file spline.hpp.

References get().

◆ name()

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

C++ version of gsl_spline_name().

Returns
the name of the interpolation method

Definition at line 260 of file spline.hpp.

References get().

◆ operator bool()

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

Allow conversion to bool.

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

Definition at line 233 of file spline.hpp.

References ccgsl_pointer.

◆ operator!=()

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

Two spline are different if their elements are not identical.

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

Definition at line 140 of file spline.hpp.

References operator==().

◆ operator<()

bool gsl::spline::operator< ( spline 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 spline is nonnegative.

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

Definition at line 152 of file spline.hpp.

References ccgsl_pointer.

◆ operator<=()

bool gsl::spline::operator<= ( spline 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 spline is nonnegative.

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

Definition at line 172 of file spline.hpp.

References ccgsl_pointer.

◆ operator=() [1/2]

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

Move operator.

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

Definition at line 119 of file spline.hpp.

References spline().

◆ operator=() [2/2]

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

The assignment operator.

This copies elementwise.

Parameters
vThe spline to copy

Definition at line 86 of file spline.hpp.

References ccgsl_pointer, and count.

◆ operator==()

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

Two spline are identically equal if their elements are identical.

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

Definition at line 132 of file spline.hpp.

References ccgsl_pointer.

Referenced by operator!=().

◆ operator>()

bool gsl::spline::operator> ( spline 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 spline is nonnegative.

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

Definition at line 162 of file spline.hpp.

References ccgsl_pointer.

◆ operator>=()

bool gsl::spline::operator>= ( spline 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 spline is nonnegative.

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

Definition at line 182 of file spline.hpp.

References ccgsl_pointer.

◆ swap()

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

Swap two spline objects.

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

Parameters
vThe spline to swap with this.

Definition at line 194 of file spline.hpp.

References ccgsl_pointer, and count.

◆ unique()

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

Find if this is the only object sharing the gsl_spline.

Returns
true or falses according as this is the only spline object sharing the gsl_spline.

Definition at line 219 of file spline.hpp.

References count.

◆ use_count()

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

Find how many spline objects share this pointer.

Returns
the number of spline objects that share this pointer.

Definition at line 224 of file spline.hpp.

References count.

Member Data Documentation

◆ ccgsl_pointer

gsl_spline* gsl::spline::ccgsl_pointer
private

The shared pointer.

Definition at line 202 of file spline.hpp.

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

◆ count

size_t* gsl::spline::count
private

The shared reference count.

Definition at line 206 of file spline.hpp.

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


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