IMP logo
IMP Reference Guide  develop.abbcc53e0c,2026/02/18
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-2026 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>
12 
13 IMPCORE_BEGIN_NAMESPACE
14 
15 //! Closed cubic spline function.
16 /** This function is a cubic spline interpolating a set of values.
17  The function is periodic, so the score will also have the same value at
18  minrange + spacing * values.size(). See OpenCubicSpline for a
19  non-periodic spline.
20  \see OpenCubicSpline
21  */
22 class IMPCOREEXPORT ClosedCubicSpline : public UnaryFunction {
23  public:
24  /** \param[in] values Score value at each spline point.
25  \param[in] minrange Feature value at first spline point.
26  \param[in] spacing Distance (in feature space) between points
27  */
28  ClosedCubicSpline(const Floats &values, double minrange, double spacing);
29 
31  double feature) const override;
32 
33  virtual double evaluate(double feature) const override;
34 
36 
37  void do_show(std::ostream &out) const;
38 
39  Float get_minrange() const { return minrange_; }
40  Float get_spacing() const { return spacing_; }
41  Floats get_values() const { return values_; }
42 
43  //! Get the calculated second derivatives corresponding to the spline values
44  Floats get_second_derivatives() const { return second_derivs_; }
45 
46  private:
47  Floats values_;
48  Floats second_derivs_;
49  Float minrange_;
50  Float maxrange_;
51  Float spacing_;
52 };
53 
54 IMPCORE_END_NAMESPACE
55 
56 #endif /* IMPCORE_CLOSED_CUBIC_SPLINE_H */
virtual double evaluate(double feature) const
Calculate score with respect to the given feature.
Definition: UnaryFunction.h:35
Floats get_second_derivatives() const
Get the calculated second derivatives corresponding to the spline values.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Single variable function.
std::pair< double, double > DerivativePair
A pair representing a function value with its first derivative.
Definition: types.h:22
virtual DerivativePair evaluate_with_derivative(double feature) const
Calculate score and derivative with respect to the given feature.
Definition: UnaryFunction.h:50
double Float
Basic floating-point value (could be float, double...)
Definition: types.h:19
Abstract single variable functor class for score functions.
Definition: UnaryFunction.h:27
Closed cubic spline function.