Files Classes Functions Hierarchy
#include <iostream>#include <vector>#include <minmonte.h>#include <random.h>
Go to the source code of this file.
Functions | |
| template<typename T > | |
| void | print (vector< T > const &v) |
| void | test01 () |
| void | test02 () |
| int | main (int argc, char **argv) |
| int main | ( | int | argc, | |
| char ** | argv | |||
| ) |
| void print | ( | vector< T > const & | v | ) | [inline] |
Definition at line 23 of file main.cpp.
00024 { 00025 cout << "["; 00026 if (v.size()==0) 00027 { 00028 cout << "]"; 00029 return; 00030 } 00031 00032 cout << v[0]; 00033 00034 if (v.size()==1) 00035 { 00036 cout << "]"; 00037 return; 00038 } 00039 00040 for (unsigned int i=1; i<v.size(); ++i) 00041 cout << "," << v[i]; 00042 00043 cout << "]"; 00044 }
| void test01 | ( | ) |
Definition at line 47 of file main.cpp.
References minmonte< F, R, T, Arraysz, Dim >::getresult(), minmonte< F, R, T, Arraysz, Dim >::printab(), and minmonte< F, R, T, Arraysz, Dim >::setboundingbox().
00048 { 00049 minmonte< f1, random11<double> , double, 80, 2 > m; 00050 00051 double a0[2] = {1.0,1.0}; 00052 double b0[2] = {8.0,8.0}; 00053 00054 m.setboundingbox(a0,b0); 00055 00056 /* 00057 cout << "Testing getboundingbox(a,b)" << endl; 00058 vector<double> a1(2), b1(2); 00059 m.getboundingbox(a1,b1); 00060 00061 cout << "a="; 00062 print(a1); 00063 cout << endl; 00064 00065 cout << "b="; 00066 print(b1); 00067 cout << endl; 00068 */ 00069 00070 m.printab(); 00071 for (unsigned int k=0; k<5; ++k) 00072 { 00073 m(5); 00074 m.printab(); 00075 } 00076 00077 cout << "Testing getresult" << endl; 00078 00079 double v[2]; 00080 double val; 00081 m.getresult(val,v,0); 00082 cout << "val=" << val << " v[0]=" << v[0] << " v[1]=" << v[1] << endl; 00083 00084 }
| void test02 | ( | ) |
Definition at line 86 of file main.cpp.
00087 { 00088 cout << "Pointer matrix revision." << endl; 00089 00090 const unsigned int a(2); 00091 const unsigned int b(3); 00092 int v[a][b]; 00093 00094 unsigned int k=0; 00095 for (unsigned int i=0; i<a; ++i ) 00096 { 00097 for (unsigned int j=0; j<b; ++j) 00098 v[i][j] = k++; 00099 }; 00100 00101 k=0; 00102 00103 int* p2; 00104 p2 = (int*)v; 00105 for ( ; k<a*b; ++k, ++p2 ) 00106 { 00107 cout << "k=" << k << "#"; 00108 cout << *p2 << "#" << endl; 00109 } 00110 00111 00112 }
1.5.8