9 #ifndef IMPEXAMPLE_EXAMPLE_UNARY_FUNCTION_H
10 #define IMPEXAMPLE_EXAMPLE_UNARY_FUNCTION_H
12 #include <IMP/example/example_config.h>
16 IMPEXAMPLE_BEGIN_NAMESPACE
40 return DerivativePair(evaluate(feature), k_ * (feature - center_));
42 virtual double evaluate(
double feature)
const override {
43 return .5 * k_ * algebra::get_squared(feature - center_);
48 IMPEXAMPLE_END_NAMESPACE
ExampleUnaryFunction(Float center, Float k)
virtual DerivativePair evaluate_with_derivative(double feature) const override
Calculate score and derivative with respect to the given feature.
virtual double evaluate(double feature) const override
Calculate score with respect to the given feature.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Single variable function.
For backwards compatibility.
std::pair< double, double > DerivativePair
A pair representing a function value with its first derivative.
double Float
Basic floating-point value (could be float, double...)
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Abstract single variable functor class for score functions.