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 - center)) {}
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 IMP_OVERRIDE {
69 return ((DIRECTION == LOWER && (feature > d_.c_)) ||
70 (DIRECTION == UPPER && (feature < d_.c_)))
72 : d_.evaluate(feature);
77 internal::TruncatedHarmonicData d_;
A function that is harmonic over an interval.
TruncatedHarmonic(Float center, Float k, Float threshold, Float limit)
TruncatedHarmonic(Float center, Float k, Float threshold)
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.
virtual double evaluate(double feature) const
Calculate score with respect to the given feature.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Import IMP/kernel/utility.h in the namespace.
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...)
Various general useful macros for IMP.
TruncatedHarmonic< BOTH > TruncatedHarmonicBound
A specialization.
TruncatedHarmonic< UPPER > TruncatedHarmonicUpperBound
A specialization for the upper bound.
TruncatedHarmonic< LOWER > TruncatedHarmonicLowerBound
A specialization for the lower bound.