Bsoft 2.1.4
Bernard's software package
Bsimplex Class Reference

Structure used in the downhill simplex method. More...

#include <simplex.h>

Public Member Functions

 Bsimplex ()
 
 Bsimplex (long nv, long np, long nc, long n, vector< double > &ax, vector< double > &ay)
 Initializes a Bsimplex structure. More...
 
long variables ()
 
long constants ()
 
double constant (long i)
 
void constant (long i, double p)
 
void constants (long n, vector< double > &p)
 
long points ()
 
long parameters ()
 
void parameters (long n, vector< double > &p)
 
vector< double > parameter_vector ()
 
void parameter (long i, double p)
 
double parameter (long i)
 
void limit_low (long i, double v)
 
double limit_low (long i)
 
void limit_high (long i, double v)
 
double limit_high (long i)
 
void limits (long i, double vlo, double vhi)
 
void limits_low (long n, vector< double > &p)
 
void limits_high (long n, vector< double > &p)
 
vector< double > & independent_values ()
 
vector< double > & dependent_values ()
 
double dependent_variance ()
 
double R (double(funk)(Bsimplex &))
 
double run (long maxcycles, double tolerance, double(funk)(Bsimplex &), long report=0)
 
double amotry (vector< double > &mp, vector< double > &R, long ihi, double fac, double(funk)(Bsimplex &))
 
void show ()
 

Detailed Description

Structure used in the downhill simplex method.

Nelder and Mead downhill simplex method for generalized parameter fitting
Adapted from Numerical Recipes, 2nd edition, Press et al. 1992
The structure is set up to accommodate any number of variables, parameters,
constants and points.
The structure is very flexible in the sense that only some fields
are absolutely required and with a fixed meaning for the simplex method.
The required fields are:
    nparam, param, lo, hi
The other fields may be recast and used as desired in the user function.
Intended sizes:
    param       nparam.
    lo          nparam.
    hi          nparam.
    c           nconstant.
    x           npoint*nvar.
    fx          npoint.

Constructor & Destructor Documentation

◆ Bsimplex() [1/2]

Bsimplex::Bsimplex ( )
inline

◆ Bsimplex() [2/2]

Bsimplex::Bsimplex ( long  nv,
long  np,
long  nc,
long  n,
vector< double > &  ax,
vector< double > &  ay 
)

Initializes a Bsimplex structure.

Parameters
nvnumber of independent variables.
npnumber of parameters to determine.
ncnumber of constants.
nnumber of points or function values.
&axarray of independent variables (nv*n).
&ayarray of dependent variables (n).
The minimum setup of the simplex structure requires a number of
parameters greater than 0
Reference: Press W.H. et al (1992) Numerical Recipes in C.

Member Function Documentation

◆ amotry()

double Bsimplex::amotry ( vector< double > &  mp,
vector< double > &  R,
long  ihi,
double  fac,
double(funk)(Bsimplex &)   
)

◆ constant() [1/2]

double Bsimplex::constant ( long  i)
inline

◆ constant() [2/2]

void Bsimplex::constant ( long  i,
double  p 
)
inline

◆ constants() [1/2]

long Bsimplex::constants ( )
inline

◆ constants() [2/2]

void Bsimplex::constants ( long  n,
vector< double > &  p 
)
inline

◆ dependent_values()

vector< double > & Bsimplex::dependent_values ( )
inline

◆ dependent_variance()

double Bsimplex::dependent_variance ( )
inline

◆ independent_values()

vector< double > & Bsimplex::independent_values ( )
inline

◆ limit_high() [1/2]

double Bsimplex::limit_high ( long  i)
inline

◆ limit_high() [2/2]

void Bsimplex::limit_high ( long  i,
double  v 
)
inline

◆ limit_low() [1/2]

double Bsimplex::limit_low ( long  i)
inline

◆ limit_low() [2/2]

void Bsimplex::limit_low ( long  i,
double  v 
)
inline

◆ limits()

void Bsimplex::limits ( long  i,
double  vlo,
double  vhi 
)
inline

◆ limits_high()

void Bsimplex::limits_high ( long  n,
vector< double > &  p 
)
inline

◆ limits_low()

void Bsimplex::limits_low ( long  n,
vector< double > &  p 
)
inline

◆ parameter() [1/2]

double Bsimplex::parameter ( long  i)
inline

◆ parameter() [2/2]

void Bsimplex::parameter ( long  i,
double  p 
)
inline

◆ parameter_vector()

vector< double > Bsimplex::parameter_vector ( )
inline

◆ parameters() [1/2]

long Bsimplex::parameters ( )
inline

◆ parameters() [2/2]

void Bsimplex::parameters ( long  n,
vector< double > &  p 
)
inline

◆ points()

long Bsimplex::points ( )
inline

◆ R()

double Bsimplex::R ( double(funk)(Bsimplex &)  )
inline

◆ run()

double Bsimplex::run ( long  maxcycles,
double  tolerance,
double(funk)(Bsimplex &)  ,
long  report = 0 
)

◆ show()

void Bsimplex::show ( )
inline

◆ variables()

long Bsimplex::variables ( )
inline

The documentation for this class was generated from the following files: