Program Listing for File InterpolatingFunctionALGLIB.h¶
↰ Return to documentation for file (/home/kpenev/projects/git/poet/poet_src/Core/InterpolatingFunctionALGLIB.h)
#ifndef __INTERPOLATING_FUNCTION_ALGLIB_H
#define __INTERPOLATING_FUNCTION_ALGLIB_H
#include "../Core/SharedLibraryExportMacros.h"
#include "Functions.h"
#include "SerializableSpline1dInterpolant.h"
#include "InterpSolutionIterator.h"
namespace Core {
class LIB_LOCAL InterpolatingFunctionALGLIB :
public OneArgumentDiffFunction {
private:
#ifndef NO_SERIALIZE
friend class boost::serialization::access;
//The second parameter should eventually be version
template<class Archive>
void serialize(Archive & ar, const unsigned int) {
ar & boost::serialization::base_object<OneArgumentDiffFunction>(
*this
);
ar & __spline;
ar & __min_x & __max_x;
}
#endif
SerializableSpline1dInterpolant __spline;
double __min_x,
__max_x;
public:
InterpolatingFunctionALGLIB() {};
InterpolatingFunctionALGLIB(
const std::valarray<double> &x,
const std::valarray<double> &y,
const std::valarray<double> &yprime=
std::valarray<double>(),
double smoothing=NaN,
int degrees_of_freedom=-1
)
: InterpolatingFunctionALGLIB(
&(x[0]),
&(y[0]),
x.size(),
(yprime.size() ? &(yprime[0]) : NULL),
smoothing,
degrees_of_freedom
)
{
assert(x.size() == y.size());
assert(yprime.size() == 0 || yprime.size() == x.size());
}
InterpolatingFunctionALGLIB(
const double *x,
const double *y,
size_t num_points,
const double *yprime = NULL,
double smoothing=NaN,
int degrees_of_freedom=-1);
inline double operator()(double x) const
{return alglib::spline1dcalc(__spline, x);}
inline const CubicSplineDerivatives *deriv(double x) const
{
double v, dv, d2v;
alglib::spline1ddiff(__spline, x, v, dv, d2v);
return new CubicSplineDerivatives(v, dv, d2v);
}
inline double range_high() const {return __max_x;}
inline double range_low() const {return __min_x;}
InterpSolutionIterator crossings(double y=0) const;
}; //End InterpolatingFunctionALGLIB class
//BOOST_CLASS_EXPORT_GUID(OneArgumentDiffFunction,
// "OneArgumentDiffFunction")
} //End Core namespace
#ifndef NO_SERIALIZE
BOOST_CLASS_EXPORT_KEY(Core::InterpolatingFunctionALGLIB)
BOOST_CLASS_EXPORT_KEY(Core::ZeroFunction)
#endif
//BOOST_CLASS_EXPORT_GUID(Core::InterpolatingFunctionALGLIB,
// "InterpolatingFunctionALGLIB")
#endif