7 #ifndef IMPCORE_TRUNCATED_HARMONIC_H
8 #define IMPCORE_TRUNCATED_HARMONIC_H
10 #include <IMP/core/core_config.h>
11 #include "internal/truncated_harmonic.h"
16 IMPCORE_BEGIN_NAMESPACE
42 template <
int DIRECTION>
56 : d_(center, k, threshold, limit) {}
59 : d_(center, k, threshold, k * square(threshold)) {}
63 ((DIRECTION == LOWER && (feature > d_.c_)) ||
64 (DIRECTION == UPPER && (feature < d_.c_)))
66 : d_.evaluate_with_derivative(feature).second);
68 virtual double evaluate(
double feature)
const override {
69 return ((DIRECTION == LOWER && (feature > d_.c_)) ||
70 (DIRECTION == UPPER && (feature < d_.c_)))
72 : d_.evaluate(feature);
77 internal::TruncatedHarmonicData d_;
Helper macros for implementing IMP Objects.
A function that is harmonic over an interval.
TruncatedHarmonic(Float center, Float k, Float threshold, Float limit)
TruncatedHarmonic(Float center, Float k, Float threshold)
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.
virtual DerivativePair evaluate_with_derivative(double feature) const override
Calculate score and derivative with respect to the given feature.
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...)
TruncatedHarmonic< BOTH > TruncatedHarmonicBound
TruncatedHarmonic< UPPER > TruncatedHarmonicUpperBound
Abstract single variable functor class for score functions.
TruncatedHarmonic< LOWER > TruncatedHarmonicLowerBound