Commit 31f18bfcf0ea22e0f8b183d4fa90c07ae7a98d9b

Authored by Jürgen Knödlseder
1 parent 1a8db675

The value() method now returns a value instead of a pointer.

include/GOptimizerFunction.hpp
1 1 /***************************************************************************
2   - * GOptimizerFunction.hpp - Optimizer function abstract base class *
  2 + * GOptimizerFunction.hpp - Optimizer function abstract base class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2009-2011 by Jurgen Knodlseder *
  4 + * copyright (C) 2009-2013 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file GOptimizerFunction.hpp
23 23 * @brief Optimizer function abstract base class
24   - * @author J. Knodlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26  
27 27 #ifndef GOPTIMIZERFUNCTION_HPP
... ... @@ -40,24 +40,27 @@
40 40 *
41 41 * This class provides an abstract interface for the function that is used
42 42 * by the GOptimizer optimization class.
43   - * The method eval() returns the function value at a given set of parameters
  43 + *
  44 + * The eval() method returns the function value at a given set of parameters
44 45 * that is defined by an instance of the optimizer parameter container class
45   - * GOptimizerPars.
  46 + * GOptimizerPars. The value() method returns the actual function value at
  47 + * these parameters, and the gradient() and covar() methods return pointers
  48 + * on the gradient vector and the covariance matrix at the parameter values.
46 49 ***************************************************************************/
47 50 class GOptimizerFunction {
48 51  
49 52 public:
50 53 // Constructors and destructors
51   - GOptimizerFunction();
  54 + GOptimizerFunction(void);
52 55 GOptimizerFunction(const GOptimizerFunction& fct);
53   - virtual ~GOptimizerFunction();
  56 + virtual ~GOptimizerFunction(void);
54 57  
55 58 // Operators
56 59 virtual GOptimizerFunction& operator= (const GOptimizerFunction& fct);
57 60  
58 61 // Virtual methods
59 62 virtual void eval(const GOptimizerPars& pars) = 0;
60   - virtual double* value(void) = 0;
  63 + virtual double value(void) = 0;
61 64 virtual GVector* gradient(void) = 0;
62 65 virtual GSparseMatrix* covar(void) = 0;
63 66  
... ... @@ -66,7 +69,6 @@ protected:
66 69 void init_members(void);
67 70 void copy_members(const GOptimizerFunction& fct);
68 71 void free_members(void);
69   -
70 72 };
71 73  
72 74 #endif /* GOPTIMIZERFUNCTION_HPP */
... ...
src/opt/GOptimizerFunction.cpp
1 1 /***************************************************************************
2   - * GOptimizerFunction.cpp - Optimizer function abstract base class *
  2 + * GOptimizerFunction.cpp - Optimizer function abstract base class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2009-2011 by Jurgen Knodlseder *
  4 + * copyright (C) 2009-2013 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -21,12 +21,10 @@
21 21 /**
22 22 * @file GOptimizerFunction.cpp
23 23 * @brief Optimizer function abstract base class implementation
24   - * @author J. Knodlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26  
27 27 /* __ Includes ___________________________________________________________ */
28   -#include <iostream>
29   -#include "GException.hpp"
30 28 #include "GOptimizerFunction.hpp"
31 29  
32 30 /* __ Method name definitions ____________________________________________ */
... ... @@ -98,8 +96,9 @@ GOptimizerFunction::~GOptimizerFunction()
98 96 * @brief Assignment operator
99 97 *
100 98 * @param[in] fct Optimizer function.
  99 + * @return Optimizer function.
101 100 ***************************************************************************/
102   -GOptimizerFunction& GOptimizerFunction::operator= (const GOptimizerFunction& fct)
  101 +GOptimizerFunction& GOptimizerFunction::operator=(const GOptimizerFunction& fct)
103 102 {
104 103 // Execute only if object is not identical
105 104 if (this != &fct) {
... ... @@ -162,10 +161,3 @@ void GOptimizerFunction::free_members(void)
162 161 // Return
163 162 return;
164 163 }
165   -
166   -
167   -/*==========================================================================
168   - = =
169   - = Friends =
170   - = =
171   - ==========================================================================*/
... ...