IMP  2.0.0
The Integrative Modeling Platform
core/HarmonicUpperBound.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/HarmonicUpperBound.h \brief Harmonic upper bound function.
3  *
4  * Copyright 2007-2013 IMP Inventors. All rights reserved.
5  */
6 
7 #ifndef IMPCORE_HARMONIC_UPPER_BOUND_H
8 #define IMPCORE_HARMONIC_UPPER_BOUND_H
9 
10 #include <IMP/core/core_config.h>
11 #include "Harmonic.h"
12 
13 IMPCORE_BEGIN_NAMESPACE
14 
15 //! Upper bound harmonic function (non-zero when feature > mean)
16 /** \see Harmonic
17  \see HarmonicLowerBound
18  \see TruncatedHarmonicUpperBound
19  */
21 {
22 public:
23  /** Create with the given mean and the spring constant k */
24  HarmonicUpperBound(Float mean, Float k) : Harmonic(mean, k) {}
26  feature <= Harmonic::get_mean() ?
27  0.0: Harmonic::evaluate(feature),
28  feature <= Harmonic::get_mean() ?
29  0.0:
30  Harmonic::evaluate_with_derivative(feature).second,
31  "HarmonicUB: " << Harmonic::get_mean()
32  << " and " << Harmonic::get_k() << std::endl);
33 };
34 
35 IMPCORE_END_NAMESPACE
36 
37 #endif /* IMPCORE_HARMONIC_UPPER_BOUND_H */