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
56 template <
int DIRECTION>
70 : d_(center, k, threshold, limit) {}
73 : d_(center, k, threshold, k * square(threshold)) {}
77 ((DIRECTION == LOWER && (feature > d_.c_)) ||
78 (DIRECTION == UPPER && (feature < d_.c_)))
80 : d_.evaluate_with_derivative(feature).second);
82 virtual double evaluate(
double feature)
const override {
83 return ((DIRECTION == LOWER && (feature > d_.c_)) ||
84 (DIRECTION == UPPER && (feature < d_.c_)))
86 : d_.evaluate(feature);
91 internal::TruncatedHarmonicData d_;
106 IMPCORE_END_NAMESPACE
Helper macros for implementing IMP Objects.
A function that is harmonic over an bounded 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.
Various general useful functions for IMP.
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