9#ifndef IMPKERNEL_DERIVATIVE_ACCUMULATOR_H
10#define IMPKERNEL_DERIVATIVE_ACCUMULATOR_H
12#include <IMP/kernel_config.h>
20IMPKERNEL_BEGIN_NAMESPACE
25class IMPKERNELEXPORT DerivativeAccumulator {
27 IMP_CXX11_DEFAULT_COPY_CONSTRUCTOR(DerivativeAccumulator);
33 : weight_(copy.weight_ * weight) {}
40 return value * weight_;
47 return Vector3D(
operator()(std::get<0>(value)),
48 operator()(std::get<1>(value)),
49 operator()(std::get<2>(value)));
56 return Vector4D(
operator()(std::get<0>(value)),
57 operator()(std::get<1>(value)),
58 operator()(std::get<2>(value)),
59 operator()(std::get<3>(value)));
62 double get_weight()
const {
return weight_; }
71IMPKERNEL_END_NAMESPACE
Helper macros for throwing and handling exceptions.
#define IMP_INTERNAL_CHECK(expr, message)
An assertion to check for internal errors in IMP. An IMP::ErrorException will be thrown.
Class for adding derivatives from restraints to the model.
DerivativeAccumulator(double weight=1.0)
the weight is one by default
DerivativeAccumulator(const DerivativeAccumulator ©, double weight)
The weight is multiplied by the new weight.
double operator()(const double value) const
Scale a float value appropriately.
Vector3D operator()(const Vector3D &value) const
Scale a Vector3D value appropriately.
Vector4D operator()(const Vector4D &value) const
Scale a Vector4D value appropriately.
Exception definitions and assertions.
Helper functions to check for NaN or infinity.
bool isnan(const T &a)
Return true if a number is NaN.
IMP::Vector< DerivativeAccumulator > DerivativeAccumulators
Macros to help with objects that can be printed to a stream.
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
Macros to help in implementing Value objects.
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.