IMP logo
IMP Reference Guide  2.6.1
The Integrative Modeling Platform
core/HarmonicLowerBound.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/HarmonicLowerBound.h \brief Harmonic lower bound function.
3  *
4  * Copyright 2007-2016 IMP Inventors. All rights reserved.
5  */
6 
7 #ifndef IMPCORE_HARMONIC_LOWER_BOUND_H
8 #define IMPCORE_HARMONIC_LOWER_BOUND_H
9 
10 #include <IMP/core/core_config.h>
11 #include "Harmonic.h"
12 
13 IMPCORE_BEGIN_NAMESPACE
14 
15 //! Lower bound harmonic function (non-zero when feature < mean)
16 /** \see Harmonic
17  \see HarmonicUpperBound
18  \see TruncatedHarmonicLowerBound
19 */
20 class HarmonicLowerBound : public Harmonic {
21  public:
22  /** Create with the given mean and the spring constant k */
23  HarmonicLowerBound(Float mean, Float k) : Harmonic(mean, k) {}
24  virtual double evaluate(double feature) const IMP_OVERRIDE {
25  return feature >= Harmonic::get_mean() ? 0.0 : Harmonic::evaluate(feature);
26  }
27  virtual DerivativePair evaluate_with_derivative(double feature) const
28  IMP_OVERRIDE {
29  return feature >= Harmonic::get_mean()
30  ? DerivativePair(0.0, 0.0)
31  : Harmonic::evaluate_with_derivative(feature);
32  }
34 };
35 
36 IMPCORE_END_NAMESPACE
37 
38 #endif /* IMPCORE_HARMONIC_LOWER_BOUND_H */
Lower bound harmonic function (non-zero when feature < mean)
double get_mean(const cv::Mat &mat, const cvIntMat &mask)
Harmonic function.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
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.
std::pair< double, double > DerivativePair
A pair representing a function value with its first derivative.
Definition: types.h:23
double Float
Basic floating-point value (could be float, double...)
Definition: types.h:20
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
Harmonic function (symmetric about the mean)
Definition: core/Harmonic.h:24