gsl_multimin.hh
Go to the documentation of this file.
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
* Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MIA; if not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GSLPP_MULTIMIN_HH
#define GSLPP_MULTIMIN_HH
#include <memory>
#include <mia/core/gsl_vector.hh>
#include <gsl/gsl_multimin.h>
#include <mia/core/gsl_defines.hh>
namespace gsl
{
class EXPORT_GSL CFDFMinimizer
{
public:
class Problem
{
public:
Problem(size_t n_params);
static double f(const gsl_vector *x, void *params);
static void df(const gsl_vector *x, void *params, gsl_vector *g);
static void fdf(const gsl_vector *x, void *params, double *f, gsl_vector *g);
operator gsl_multimin_function_fdf *();
size_t size() const;
private:
virtual double do_f(const Vector& x) = 0;
virtual void do_df(const Vector& x, Vector& g) = 0;
virtual double do_fdf(const Vector& x, Vector& g) = 0;
gsl_multimin_function_fdf m_func;
};
typedef std::shared_ptr<Problem> PProblem;
CFDFMinimizer(PProblem p, const gsl_multimin_fdfminimizer_type *ot);
~CFDFMinimizer();
void set_g_tol(double tol);
void set_stop_eps(double tol);
int run(Vector& x);
private:
struct CFDFMinimizerImpl *impl;
};
class EXPORT_GSL CFMinimizer
{
public:
class Problem
{
public:
Problem(size_t n_params);
static double f(const gsl_vector *x, void *params);
operator gsl_multimin_function *();
size_t size() const;
private:
virtual double do_f(const Vector& x) = 0;
gsl_multimin_function m_func;
};
typedef std::shared_ptr<Problem> PProblem;
CFMinimizer(PProblem p, const gsl_multimin_fminimizer_type *ot);
~CFMinimizer();
int run(Vector& x);
private:
struct CFMinimizerImpl *impl;
};
}
#endif
gsl::CFDFMinimizer::Problem::Problem
Problem(size_t n_params)
gsl::CFDFMinimizer::Problem::df
static void df(const gsl_vector *x, void *params, gsl_vector *g)
gsl::CFDFMinimizer::Problem::fdf
static void fdf(const gsl_vector *x, void *params, double *f, gsl_vector *g)
gsl::CFDFMinimizer::Problem::f
static double f(const gsl_vector *x, void *params)
gsl::CFDFMinimizer::Problem::size
size_t size() const
gsl::CFDFMinimizer::CFDFMinimizer
CFDFMinimizer(PProblem p, const gsl_multimin_fdfminimizer_type *ot)
gsl::CFDFMinimizer::set_stop_eps
void set_stop_eps(double tol)
gsl::CFDFMinimizer::run
int run(Vector &x)
gsl::CFDFMinimizer::PProblem
std::shared_ptr< Problem > PProblem
Definition gsl_multimin.hh:80
gsl::CFDFMinimizer::set_g_tol
void set_g_tol(double tol)
gsl::CFDFMinimizer::~CFDFMinimizer
~CFDFMinimizer()
gsl::CFMinimizer::Problem::Problem
Problem(size_t n_params)
gsl::CFMinimizer::Problem::f
static double f(const gsl_vector *x, void *params)
gsl::CFMinimizer::Problem::size
size_t size() const
gsl::CFMinimizer::CFMinimizer
CFMinimizer(PProblem p, const gsl_multimin_fminimizer_type *ot)
gsl::CFMinimizer::~CFMinimizer
~CFMinimizer()
gsl::CFMinimizer::run
int run(Vector &x)
gsl::CFMinimizer::PProblem
std::shared_ptr< Problem > PProblem
Definition gsl_multimin.hh:148
gsl::Vector
Definition gsl_vector.hh:39
gsl_defines.hh
EXPORT_GSL
#define EXPORT_GSL
Definition gsl_defines.hh:38
gsl_vector.hh
gsl
Definition gsl_iterator.hh:29