7#ifndef IMPCORE_COSINE_H
8#define IMPCORE_COSINE_H
10#include <IMP/core/core_config.h>
12#include <cereal/access.hpp>
13#include <cereal/types/base_class.hpp>
14#include <cereal/types/polymorphic.hpp>
16IMPCORE_BEGIN_NAMESPACE
25class IMPCOREEXPORT
Cosine :
public UnaryFunction {
33 : force_constant_(force_constant),
34 periodicity_(periodicity),
40 double feature)
const override;
42 virtual double evaluate(
double feature)
const override;
44 Float get_force_constant()
const {
return force_constant_; }
45 int get_periodicity()
const {
return periodicity_; }
46 Float get_phase()
const {
return phase_; }
50 void do_show(std::ostream &out)
const;
53 Float force_constant_;
57 friend class cereal::access;
59 template<
class Archive>
void serialize(Archive &ar) {
60 ar(cereal::base_class<UnaryFunction>(
this),
61 force_constant_, periodicity_, phase_);
Single variable function.
Cosine(Float force_constant, int periodicity, Float phase)
Constructor.
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.
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.
#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.