Commit 98eb831d52472bc0c92cfb417fb7029a5804c05e

Authored by Jürgen Knödlseder
1 parent 8b4d4c5a

Add optimizer function Python interface.

pyext/GOptimizerFunction.i 0 → 100644
  1 +/***************************************************************************
  2 + * GOptimizerFunction.i - Optimizer function abstract base class *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2014 by Juergen Knoedlseder *
  5 + * ----------------------------------------------------------------------- *
  6 + * *
  7 + * This program is free software: you can redistribute it and/or modify *
  8 + * it under the terms of the GNU General Public License as published by *
  9 + * the Free Software Foundation, either version 3 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + * This program is distributed in the hope that it will be useful, *
  13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  15 + * GNU General Public License for more details. *
  16 + * *
  17 + * You should have received a copy of the GNU General Public License *
  18 + * along with this program. If not, see <http://www.gnu.org/licenses/>. *
  19 + * *
  20 + ***************************************************************************/
  21 +/**
  22 + * @file GOptimizerFunction.i
  23 + * @brief Optimizer function abstract base class
  24 + * @author Juergen Knoedlseder
  25 + */
  26 +%{
  27 +/* Put headers and other declarations here that are needed for compilation */
  28 +#include "GOptimizerFunction.hpp"
  29 +#include "GTools.hpp"
  30 +%}
  31 +
  32 +
  33 +/***********************************************************************//**
  34 + * @class GOptimizerFunction
  35 + *
  36 + * @brief Optimizer function abstract base class
  37 + ***************************************************************************/
  38 +class GOptimizerFunction {
  39 +public:
  40 + // Constructors and destructors
  41 + GOptimizerFunction(void);
  42 + GOptimizerFunction(const GOptimizerFunction& fct);
  43 + virtual ~GOptimizerFunction(void);
  44 +
  45 + // Virtual methods
  46 + virtual void eval(const GOptimizerPars& pars) = 0;
  47 + virtual double value(void) = 0;
  48 + virtual GVector* gradient(void) = 0;
  49 + virtual GMatrixSparse* curvature(void) = 0;
  50 +};
  51 +
  52 +
  53 +/***********************************************************************//**
  54 + * @brief GOptimizerFunction class extension
  55 + ***************************************************************************/
  56 +%extend GOptimizerFunction {
  57 +};
... ...
pyext/gammalib/opt.i
... ... @@ -51,4 +51,4 @@
51 51 %include "GOptimizerLM.i"
52 52 %include "GOptimizerPar.i"
53 53 %include "GOptimizerPars.i"
54   -//%include "GOptimizerFunction.i"
  54 +%include "GOptimizerFunction.i"
... ...