From 31f18bfcf0ea22e0f8b183d4fa90c07ae7a98d9b Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Thu, 21 Feb 2013 00:04:55 +0100 Subject: [PATCH] The value() method now returns a value instead of a pointer. --- include/GOptimizerFunction.hpp | 20 +++++++++++--------- src/opt/GOptimizerFunction.cpp | 18 +++++------------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/include/GOptimizerFunction.hpp b/include/GOptimizerFunction.hpp index c1e635f..8159ce6 100644 --- a/include/GOptimizerFunction.hpp +++ b/include/GOptimizerFunction.hpp @@ -1,7 +1,7 @@ /*************************************************************************** - * GOptimizerFunction.hpp - Optimizer function abstract base class * + * GOptimizerFunction.hpp - Optimizer function abstract base class * * ----------------------------------------------------------------------- * - * copyright (C) 2009-2011 by Jurgen Knodlseder * + * copyright (C) 2009-2013 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -21,7 +21,7 @@ /** * @file GOptimizerFunction.hpp * @brief Optimizer function abstract base class - * @author J. Knodlseder + * @author Juergen Knoedlseder */ #ifndef GOPTIMIZERFUNCTION_HPP @@ -40,24 +40,27 @@ * * This class provides an abstract interface for the function that is used * by the GOptimizer optimization class. - * The method eval() returns the function value at a given set of parameters + * + * The eval() method returns the function value at a given set of parameters * that is defined by an instance of the optimizer parameter container class - * GOptimizerPars. + * GOptimizerPars. The value() method returns the actual function value at + * these parameters, and the gradient() and covar() methods return pointers + * on the gradient vector and the covariance matrix at the parameter values. ***************************************************************************/ class GOptimizerFunction { public: // Constructors and destructors - GOptimizerFunction(); + GOptimizerFunction(void); GOptimizerFunction(const GOptimizerFunction& fct); - virtual ~GOptimizerFunction(); + virtual ~GOptimizerFunction(void); // Operators virtual GOptimizerFunction& operator= (const GOptimizerFunction& fct); // Virtual methods virtual void eval(const GOptimizerPars& pars) = 0; - virtual double* value(void) = 0; + virtual double value(void) = 0; virtual GVector* gradient(void) = 0; virtual GSparseMatrix* covar(void) = 0; @@ -66,7 +69,6 @@ protected: void init_members(void); void copy_members(const GOptimizerFunction& fct); void free_members(void); - }; #endif /* GOPTIMIZERFUNCTION_HPP */ diff --git a/src/opt/GOptimizerFunction.cpp b/src/opt/GOptimizerFunction.cpp index 0fd1f18..fc3dd2e 100644 --- a/src/opt/GOptimizerFunction.cpp +++ b/src/opt/GOptimizerFunction.cpp @@ -1,7 +1,7 @@ /*************************************************************************** - * GOptimizerFunction.cpp - Optimizer function abstract base class * + * GOptimizerFunction.cpp - Optimizer function abstract base class * * ----------------------------------------------------------------------- * - * copyright (C) 2009-2011 by Jurgen Knodlseder * + * copyright (C) 2009-2013 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -21,12 +21,10 @@ /** * @file GOptimizerFunction.cpp * @brief Optimizer function abstract base class implementation - * @author J. Knodlseder + * @author Juergen Knoedlseder */ /* __ Includes ___________________________________________________________ */ -#include -#include "GException.hpp" #include "GOptimizerFunction.hpp" /* __ Method name definitions ____________________________________________ */ @@ -98,8 +96,9 @@ GOptimizerFunction::~GOptimizerFunction() * @brief Assignment operator * * @param[in] fct Optimizer function. + * @return Optimizer function. ***************************************************************************/ -GOptimizerFunction& GOptimizerFunction::operator= (const GOptimizerFunction& fct) +GOptimizerFunction& GOptimizerFunction::operator=(const GOptimizerFunction& fct) { // Execute only if object is not identical if (this != &fct) { @@ -162,10 +161,3 @@ void GOptimizerFunction::free_members(void) // Return return; } - - -/*========================================================================== - = = - = Friends = - = = - ==========================================================================*/ -- libgit2 0.21.4