| Bsoft 2.0.3 Bernard's software package

simplex2.h
Go to the documentation of this file.
1
14 #include <vector>
15
16 using namespace std;
17
41 #ifndef _Bsimplex2_
42 class Bsimplex2 {
43 public:
44 long nvar; // Number of variables
45 long nparam; // Number of parameters
46 long nconstant; // Number of constants
47 long npoint; // Number of function values
48 vector<double> param; // Parameter values
49 vector<double> lo; // Lower limits on parameter values
50 vector<double> hi; // Upper limits on parameter values
51 vector<double> c; // Constant values
52 vector<double> x; // Independent variables: npoint*nvar array
53 vector<double> fx; // Function values
54 public:
55 Bsimplex2() { }
56 Bsimplex2(long nv, long np, long nc, long n, vector<double>& ax, vector<double>& ay);
57 void parameters(long n, vector<double>& p) {
58 for ( int i=0; i<nparam && i<n; i++ ) param[i] = p[i];
59 }
60 void parameter(long i, double p) { param[i] = p; }
61 double parameter(long i) { return param[i]; }
62 void limits(long i, double vlo, double vhi) { lo[i] = vlo; hi[i] = vhi; }
63 void limits_low(long n, vector<double>& p) {
64 for ( long i=0; i<nparam && i<n; i++ ) lo[i] = p[i];
65 }
66 void limits_high(long n, vector<double>& p) {
67 for ( int i=0; i<nparam && i<n; i++ ) hi[i] = p[i];
68 }
69 void constant(long i, double p) { c[i] = p; }
70 double constant(long i) { return c[i]; }
71 void constants(long n, vector<double>& p) {
72 for ( long i=0; i<nconstant && i<n; i++ ) c[i] = p[i];
73 }
74 double run(long maxcycles, double tolerance, double (funk)(Bsimplex2&));
75 double amotry(vector<double>& mp, vector<double>& R, long ihi, double fac,
76 double (funk)(Bsimplex2&));
77 } ;
78 #define _Bsimplex2_
79 #endif
80
Bsimplex2::nvar
long nvar
Definition: simplex2.h:44
Bsimplex2::nconstant
long nconstant
Definition: simplex2.h:46
Bsimplex2::hi
vector< double > hi
Definition: simplex2.h:50
Bsimplex2::constant
void constant(long i, double p)
Definition: simplex2.h:69
Bsimplex2::parameters
void parameters(long n, vector< double > &p)
Definition: simplex2.h:57
Bsimplex2::limits_low
void limits_low(long n, vector< double > &p)
Definition: simplex2.h:63
Bsimplex2::nparam
long nparam
Definition: simplex2.h:45
std
Bsimplex2::fx
vector< double > fx
Definition: simplex2.h:53
Bsimplex2::limits_high
void limits_high(long n, vector< double > &p)
Definition: simplex2.h:66
Bsimplex2::x
vector< double > x
Definition: simplex2.h:52
Bsimplex2
Structure used in the downhill simplex method.
Definition: simplex2.h:42
Bsimplex2::c
vector< double > c
Definition: simplex2.h:51
Bsimplex2::parameter
void parameter(long i, double p)
Definition: simplex2.h:60
Bsimplex2::limits
void limits(long i, double vlo, double vhi)
Definition: simplex2.h:62
Bsimplex2::constants
void constants(long n, vector< double > &p)
Definition: simplex2.h:71
Bsimplex2::constant
double constant(long i)
Definition: simplex2.h:70
Bsimplex2::parameter
double parameter(long i)
Definition: simplex2.h:61
Bsimplex2::Bsimplex2
Bsimplex2()
Definition: simplex2.h:55
Bsimplex2::param
vector< double > param
Definition: simplex2.h:48
Bsimplex2::npoint
long npoint
Definition: simplex2.h:47
Bsimplex2::lo
vector< double > lo
Definition: simplex2.h:49