9 #ifndef IMPEXAMPLE_EXAMPLE_UNARY_FUNCTION_H
10 #define IMPEXAMPLE_EXAMPLE_UNARY_FUNCTION_H
12 #include <IMP/example/example_config.h>
17 IMPEXAMPLE_BEGIN_NAMESPACE
41 return DerivativePair(evaluate(feature), k_ * (feature - center_));
43 virtual double evaluate(
double feature)
const IMP_OVERRIDE {
44 return .5 * k_ * algebra::get_squared(feature - center_);
49 IMPEXAMPLE_END_NAMESPACE
ExampleUnaryFunction(Float center, Float k)
Import IMP/kernel/UnaryFunction.h in the namespace.
virtual DerivativePair evaluate_with_derivative(double feature) const
Calculate score and derivative with respect to the given feature.
Abstract single variable functor class for score functions.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
#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/utility.h in the namespace.
std::pair< double, double > DerivativePair
A pair representing a function value with its first derivative.
Import IMP/kernel/unary_function_macros.h in the namespace.
double Float
Basic floating-point value (could be float, double...)