ReFRACtor
gsl_mdm.cc
Go to the documentation of this file.
1 #include <stdlib.h>
2 #include <fp_gsl_matrix.h>
3 #include <gsl/gsl_vector.h>
4 #include <gsl/gsl_multimin.h>
5 
6 #include <cost_func.h>
7 
8 using namespace FullPhysics;
9 
10 
11 double gsl_mdm_c(const gsl_vector *x, void *data)
12 {
14  blitz::Array<double, 1> b_x(GslVector(const_cast<gsl_vector*>(x), false).blitz_array());
15  double c = cost->cost_x(b_x);
16  if( std::isnan(c) )
17  return GSL_NAN;
18  return c;
19 }
20 
21 gsl_multimin_function gsl_get_mdm(const FullPhysics::CostFunc *cost)
22 {
23  gsl_multimin_function f;
24  f.n = cost->expected_parameter_size();
25  f.f = &gsl_mdm_c;
26  f.params = (void *) cost;
27  return f;
28 }
The base class for all problem classes that implement a cost function.
Definition: cost_func.h:20
gsl_multimin_function gsl_get_mdm(const FullPhysics::CostFunc *cost)
Definition: gsl_mdm.cc:21
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
This provides thin wrapper around the GNU Scientific Library gsl_vector.
Definition: fp_gsl_matrix.h:96
double gsl_mdm_c(const gsl_vector *x, void *data)
Definition: gsl_mdm.cc:11
virtual int expected_parameter_size() const
Returns the expected size of the parameters.
virtual double cost_x(const blitz::Array< double, 1 > &x)
The cost function with parameters.
Definition: cost_func.h:89

Copyright © 2017, California Institute of Technology.
ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
Generated Fri Aug 24 2018 15:44:08