7 #ifndef IMPCORE_LINEAR_H
8 #define IMPCORE_LINEAR_H
10 #include <IMP/core/core_config.h>
13 IMPCORE_BEGIN_NAMESPACE
22 Linear(
double offset,
double slope) : slope_(slope), offset_(offset) {}
24 void set_slope(
double f) { slope_ = f; }
26 void set_offset(
double f) { offset_ = f; }
29 return (feature - offset_) * slope_;
40 double slope_, offset_;
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
virtual double evaluate(double feature) const
Calculate score with respect to the given feature.
Import IMP/kernel/UnaryFunction.h in the namespace.
Abstract single variable functor class for score functions.
virtual DerivativePair evaluate_with_derivative(double feature) const
Calculate score and derivative with respect to the given feature.
std::pair< double, double > DerivativePair
A pair representing a function value with its first derivative.
Linear(double offset, double slope)
Create with the given offset and slope.
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.