00001 /** 00002 * \file UnaryFunction.h \brief Single variable function. 00003 * 00004 * Copyright 2007-2010 IMP Inventors. All rights reserved. 00005 */ 00006 00007 #ifndef IMP_UNARY_FUNCTION_H 00008 #define IMP_UNARY_FUNCTION_H 00009 00010 #include "kernel_config.h" 00011 #include "base_types.h" 00012 #include "RefCounted.h" 00013 #include "Pointer.h" 00014 00015 IMP_BEGIN_NAMESPACE 00016 00017 //! Abstract single variable functor class for score functions. 00018 /** These functors take a single feature value, and return a corresponding 00019 score (and optionally also the first derivative). 00020 00021 Implementers should check out IMP_UNARY_FUNCTION() and 00022 IMP_UNARY_FUNCTION_INLINE(). 00023 */ 00024 class IMPEXPORT UnaryFunction : public Object 00025 { 00026 public: 00027 UnaryFunction(); 00028 00029 //! Calculate score with respect to the given feature. 00030 /** \param[in] feature Value of feature being tested. 00031 \return Score 00032 */ 00033 virtual double evaluate(double feature) const=0; 00034 00035 //! Calculate score and derivative with respect to the given feature. 00036 /** \param[in] feature Value of feature being tested. 00037 \return a FloatPair containing the score and its partial derivative 00038 with respect to the given feaure. 00039 */ 00040 virtual DerivativePair evaluate_with_derivative(double feature) const = 0; 00041 00042 IMP_REF_COUNTED_DESTRUCTOR(UnaryFunction); 00043 }; 00044 00045 IMP_OBJECTS(UnaryFunction); 00046 00047 IMP_END_NAMESPACE 00048 00049 #endif /* IMP_UNARY_FUNCTION_H */