IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
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-2023 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#include <cereal/access.hpp>
13#include <cereal/types/base_class.hpp>
14
15IMPCORE_BEGIN_NAMESPACE
16
17//! Upper bound harmonic function (non-zero when feature > mean)
18/** \see Harmonic
19 \see HarmonicLowerBound
20 \see TruncatedHarmonicUpperBound
21 */
23 friend class cereal::access;
24 template<class Archive> void serialize(Archive &ar) {
25 ar(cereal::base_class<Harmonic>(this));
26 }
28 public:
29 /** Create with the given mean and the spring constant k */
30 HarmonicUpperBound(Float mean, Float k) : Harmonic(mean, k) {}
32 virtual double evaluate(double feature) const override {
33 return feature <= Harmonic::get_mean() ? 0.0 : Harmonic::evaluate(feature);
34 }
35 virtual DerivativePair evaluate_with_derivative(double feature) const
36 override {
37 return feature <= Harmonic::get_mean()
38 ? DerivativePair(0.0, 0.0)
40 }
42};
43
44IMPCORE_END_NAMESPACE
45
46#endif /* IMPCORE_HARMONIC_UPPER_BOUND_H */
Upper bound harmonic function (non-zero when feature > mean).
virtual double evaluate(double feature) const override
Calculate score with respect to the given feature.
virtual DerivativePair evaluate_with_derivative(double feature) const override
Calculate score and derivative with respect to the given feature.
Float get_mean() const
Return the mean of this function.
Harmonic(Float mean, Float k)
virtual double evaluate(double feature) const override
Calculate score with respect to the given feature.
virtual DerivativePair evaluate_with_derivative(double feature) const override
Calculate score and derivative with respect to the given feature.
Harmonic function.
double Float
Basic floating-point value (could be float, double...).
Definition types.h:19
std::pair< double, double > DerivativePair
A pair representing a function value with its first derivative.
Definition types.h:22
#define IMP_OBJECT_SERIALIZE_DECL(Name)
Declare methods needed for serialization of Object pointers.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.