Introduction
Introduction Statistics Contact Development Disclaimer Help
tfunctions.h - numeric - C++ library with numerical algorithms
git clone git://src.adamsgaard.dk/numeric
Log
Files
Refs
LICENSE
---
tfunctions.h (521B)
---
1 #include <functional>
2 #include <armadillo>
3 using namespace arma;
4 using namespace std;
5
6 int ncalls = 0;
7
8
9 // Rosenbrock's function
10 function<double(vec)> rosenbrock = [&ncalls] (vec p) {
11 ++ncalls;
12 double x = p[0], y = p[1];
13 return (1.0f - x) * (1.0f - x)
14 + 100.f * (y - x*x) * (y - x*x);
15 };
16
17 // Himmelblau's function
18 function<double(vec)> himmelblau = [&ncalls] (vec p) {
19 ++ncalls;
20 double x = p[0], y = p[1];
21 return (x*x + y - 11.0f) * (x*x + y - 11.0f)
22 + (x + y*y - 7.0f) * (x + y*y - 7.0f);
23 };
24
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.