amoeba.hh
来自「COPE the first practical network coding 」· HH 代码 · 共 40 行
HH
40 行
#ifndef CLICK_amoeba_hh#define CLICK_amoeba_hhCLICK_DECLS/* * A function minimizer. * * If you override fn(a[n]) with a function that takes n * arguments, then call minimize(pt[n]), you'll get a * point that minimizes the function value in pt[]. * * From Numerical Recipes in C (1st edition), Chapter 10, * page 307, Downhill Simplex Method in Multimensions * for minimization. */class Amoeba {public: Amoeba(int dimensions); virtual double fn(double a[]) = 0; // Override this. a[] is 0-origin. void minimize(double pt[]); // Call this, yields pt[dimensions]. 0-origin. int dimensions() { return(_dimensions); }private: int _dimensions; double *vector(int nl, int nh); void free_vector(double *, int, int); void nrerror(const char *); void amoeba1(double **p, double y[], double ftol, int *nfunk); double amotry(double **p, double y[], double psum[], int ihi, double fac);};CLICK_ENDDECLS#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?