Public Types | Public Member Functions | Protected Attributes | Private Member Functions | List of all members
o2scl::interp_monotonic< vec_t, vec2_t > Class Template Reference

Monotonicity-preserving interpolation. More...

#include <interp.h>

Inheritance diagram for o2scl::interp_monotonic< vec_t, vec2_t >:
o2scl::interp_base< vec_t, vec2_t >

Public Types

typedef boost::numeric::ublas::vector< double > ubvector
 

Public Member Functions

virtual void set (size_t size, const vec_t &x, const vec2_t &y)
 Initialize interpolation routine.
 
virtual double eval (double x0) const
 Give the value of the function $ y(x=x_0) $ .
 
virtual double deriv (double x0) const
 Give the value of the derivative $ y^{\prime}(x=x_0) $ .
 
virtual double deriv2 (double x0) const
 Give the value of the second derivative $ y^{\prime \prime}(x=x_0) $.
 
virtual double integ (double a, double b) const
 Give the value of the integral $ \int_a^{b}y(x)~dx $ .
 
virtual const char * type () const
 Return the type, "interp_monotonic".
 
- Public Member Functions inherited from o2scl::interp_base< vec_t, vec2_t >
virtual double operator() (double x0) const
 Give the value of the function $ y(x=x_0) $ .
 

Protected Attributes

ubvector m
 Slopes.
 
ubvector Delta
 Finite differences.
 
ubvector alpha
 Ratio.
 
ubvector beta
 Staggered ratio.
 
- Protected Attributes inherited from o2scl::interp_base< vec_t, vec2_t >
search_vec< const vec_t > svx
 To perform binary searches. More...
 
const vec_t * px
 Independent vector.
 
const vec2_t * py
 Dependent vector.
 
size_t sz
 Vector size.
 

Private Member Functions

 interp_monotonic (const interp_monotonic< vec_t, vec2_t > &)
 
interp_monotonic< vec_t, vec2_t > & operator= (const interp_monotonic< vec_t, vec2_t > &)
 

Additional Inherited Members

- Public Attributes inherited from o2scl::interp_base< vec_t, vec2_t >
size_t min_size
 The minimum size of the vectors to interpolate between. More...
 
- Protected Member Functions inherited from o2scl::interp_base< vec_t, vec2_t >
double integ_eval (double ai, double bi, double ci, double di, double xi, double a, double b) const
 An internal function to assist in computing the integral for both the cspline and Akima types.
 

Detailed Description

template<class vec_t, class vec2_t = vec_t>
class o2scl::interp_monotonic< vec_t, vec2_t >

Warning
This class is experimental. Integrals don't work yet.

This class uses a method based on cubic Hermite interpolation, modifying the slopes to guarantee monotonicity. In the notation of Fritsch80, if

\[ \alpha_i^2+\beta_i^2 \geq 9 \]

then $ \alpha $ and $ \beta $ are decreased by the factor $ \tau $ as described at the end of section 4.

Note
The results of the interpolation will only be monotonic in the regions where the original data set is also monotonic. Also, this interpolation routine does not enforce strict monotonicity, and the results of the interpolation will be flat where the data is also flat.

Based on Fritsch80 .

Idea for Future:
Convert into fewer loops over the data

Definition at line 1303 of file interp.h.


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

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).