Bsoft  2.0.3
Bernard's software package
Bsimplex2 Class Reference

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

#include <simplex2.h>

Public Member Functions

 Bsimplex2 ()
 
 Bsimplex2 (long nv, long np, long nc, long n, vector< double > &ax, vector< double > &ay)
 Initializes a Bsimplex2 structure. More...
 
void parameters (long n, vector< double > &p)
 
void parameter (long i, double p)
 
double parameter (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)
 
void constant (long i, double p)
 
double constant (long i)
 
void constants (long n, vector< double > &p)
 
double run (long maxcycles, double tolerance, double(funk)(Bsimplex2 &))
 
double amotry (vector< double > &mp, vector< double > &R, long ihi, double fac, double(funk)(Bsimplex2 &))
 

Public Attributes

long nvar
 
long nparam
 
long nconstant
 
long npoint
 
vector< double > param
 
vector< double > lo
 
vector< double > hi
 
vector< double > c
 
vector< double > x
 
vector< double > fx
 

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 42 of file simplex2.h.

Constructor & Destructor Documentation

◆ Bsimplex2() [1/2]

Bsimplex2::Bsimplex2 ( )
inline

Definition at line 55 of file simplex2.h.

◆ Bsimplex2() [2/2]

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

Initializes a Bsimplex2 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 simplex2.cpp.

Member Function Documentation

◆ amotry()

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

Definition at line 229 of file simplex2.cpp.

◆ constant() [1/2]

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

Definition at line 69 of file simplex2.h.

◆ constant() [2/2]

double Bsimplex2::constant ( long  i)
inline

Definition at line 70 of file simplex2.h.

◆ constants()

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

Definition at line 71 of file simplex2.h.

◆ limits()

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

Definition at line 62 of file simplex2.h.

◆ limits_high()

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

Definition at line 66 of file simplex2.h.

◆ limits_low()

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

Definition at line 63 of file simplex2.h.

◆ parameter() [1/2]

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

Definition at line 60 of file simplex2.h.

◆ parameter() [2/2]

double Bsimplex2::parameter ( long  i)
inline

Definition at line 61 of file simplex2.h.

◆ parameters()

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

Definition at line 57 of file simplex2.h.

◆ run()

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

Definition at line 76 of file simplex2.cpp.

Member Data Documentation

◆ c

vector<double> Bsimplex2::c

Definition at line 51 of file simplex2.h.

◆ fx

vector<double> Bsimplex2::fx

Definition at line 53 of file simplex2.h.

◆ hi

vector<double> Bsimplex2::hi

Definition at line 50 of file simplex2.h.

◆ lo

vector<double> Bsimplex2::lo

Definition at line 49 of file simplex2.h.

◆ nconstant

long Bsimplex2::nconstant

Definition at line 46 of file simplex2.h.

◆ nparam

long Bsimplex2::nparam

Definition at line 45 of file simplex2.h.

◆ npoint

long Bsimplex2::npoint

Definition at line 47 of file simplex2.h.

◆ nvar

long Bsimplex2::nvar

Definition at line 44 of file simplex2.h.

◆ param

vector<double> Bsimplex2::param

Definition at line 48 of file simplex2.h.

◆ x

vector<double> Bsimplex2::x

Definition at line 52 of file simplex2.h.


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