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"
16IMPCORE_BEGIN_NAMESPACE
56template <
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_;
Single variable function.
A function that is harmonic over an bounded interval.
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
TruncatedHarmonic(Float center, Float k, Float threshold)
TruncatedHarmonic(Float center, Float k, Float threshold, Float limit)
TruncatedHarmonic< LOWER > TruncatedHarmonicLowerBound
TruncatedHarmonic< UPPER > TruncatedHarmonicUpperBound
TruncatedHarmonic< BOTH > TruncatedHarmonicBound
double Float
Basic floating-point value (could be float, double...).
std::pair< double, double > DerivativePair
A pair representing a function value with its first derivative.
Helper macros for implementing IMP Objects.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Various general useful functions for IMP.