IMP  2.0.1
The Integrative Modeling Platform
ClosedCubicSpline.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/ClosedCubicSpline.h \brief Closed cubic spline function.
3  *
4  * Copyright 2007-2013 IMP Inventors. All rights reserved.
5  */
6 
7 #ifndef IMPCORE_CLOSED_CUBIC_SPLINE_H
8 #define IMPCORE_CLOSED_CUBIC_SPLINE_H
9 
10 #include <IMP/core/core_config.h>
11 #include <IMP/UnaryFunction.h>
13 
14 IMPCORE_BEGIN_NAMESPACE
15 
16 //! Closed cubic spline function.
17 /** This function is a cubic spline interpolating a set of values.
18  The function is periodic, so the score will also have the same value at
19  minrange + spacing * values.size(). See OpenCubicSpline for a
20  non-periodic spline.
21  \see OpenCubicSpline
22  */
23 class IMPCOREEXPORT ClosedCubicSpline : public UnaryFunction
24 {
25 public:
26  /** \param[in] values Score value at each spline point.
27  \param[in] minrange Feature value at first spline point.
28  \param[in] spacing Distance (in feature space) between points
29  */
30  ClosedCubicSpline(const Floats &values, double minrange,
31  double spacing);
32 
33  virtual DerivativePair evaluate_with_derivative(double feature) const;
34 
35  virtual double evaluate(double feature) const;
36 
38 
39  void do_show(std::ostream &out) const;
40 
41  private:
42  Floats values_;
43  Floats second_derivs_;
44  Float minrange_;
45  Float maxrange_;
46  Float spacing_;
47 };
48 
49 IMPCORE_END_NAMESPACE
50 
51 #endif /* IMPCORE_CLOSED_CUBIC_SPLINE_H */