Bsoft  2.1.0
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)
 
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 run (long maxcycles, double tolerance, double(funk)(Bsimplex &))
 
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.
x or fx can be recast as a different pointer, as long as it is handled
by the user before calling kill_simplex.

Definition at line 44 of file simplex.h.

Constructor & Destructor Documentation

◆ Bsimplex() [1/2]

Bsimplex::Bsimplex ( )
inline

Definition at line 57 of file simplex.h.

◆ 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.

Definition at line 33 of file simplex.cpp.

Member Function Documentation

◆ amotry()

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

Definition at line 226 of file simplex.cpp.

◆ constant() [1/2]

double Bsimplex::constant ( long  i)
inline

Definition at line 61 of file simplex.h.

◆ constant() [2/2]

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

Definition at line 62 of file simplex.h.

◆ constants() [1/2]

long Bsimplex::constants ( )
inline

Definition at line 60 of file simplex.h.

◆ constants() [2/2]

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

Definition at line 63 of file simplex.h.

◆ dependent_values()

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

Definition at line 85 of file simplex.h.

◆ independent_values()

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

Definition at line 84 of file simplex.h.

◆ limit_high() [1/2]

double Bsimplex::limit_high ( long  i)
inline

Definition at line 76 of file simplex.h.

◆ limit_high() [2/2]

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

Definition at line 75 of file simplex.h.

◆ limit_low() [1/2]

double Bsimplex::limit_low ( long  i)
inline

Definition at line 74 of file simplex.h.

◆ limit_low() [2/2]

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

Definition at line 73 of file simplex.h.

◆ limits()

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

Definition at line 77 of file simplex.h.

◆ limits_high()

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

Definition at line 81 of file simplex.h.

◆ limits_low()

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

Definition at line 78 of file simplex.h.

◆ parameter() [1/2]

double Bsimplex::parameter ( long  i)
inline

Definition at line 72 of file simplex.h.

◆ parameter() [2/2]

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

Definition at line 71 of file simplex.h.

◆ parameters() [1/2]

long Bsimplex::parameters ( )
inline

Definition at line 67 of file simplex.h.

◆ parameters() [2/2]

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

Definition at line 68 of file simplex.h.

◆ points()

long Bsimplex::points ( )
inline

Definition at line 66 of file simplex.h.

◆ run()

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

Definition at line 76 of file simplex.cpp.

◆ show()

void Bsimplex::show ( )
inline

Definition at line 89 of file simplex.h.

◆ variables()

long Bsimplex::variables ( )
inline

Definition at line 59 of file simplex.h.


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