00001 #ifndef GLOBAL_H
00002 #define GLOBAL_H
00003
00004 #include <stdio.h>
00005 #include <fstream>
00006 #include <iostream.h>
00007 #include <math.h>
00008 #include <stdlib.h>
00009 #include <time.h>
00010
00011 #include "NLF.h"
00012 #include "OptQNewton.h"
00013 #include "NLP.h"
00014
00015 #define REAL double
00016 #define PROGRESSBAR cout << ".";cout.flush()
00017
00021 struct Point
00022 {
00023 REAL x,y,z;
00027 Point(REAL _x=0.,REAL _y=0.,REAL _z=0.) {x=_x;y=_y;z=_z;};
00028
00032 friend ostream & operator<<(ostream &Str, const Point &p)
00033 {
00034 Str << "[" << p.x << "," << p.y << "," << p.z << "]";
00035 return Str;
00036 };
00037
00038 };
00039
00043 inline std::string trim(const std::string& s) {
00044 if(s.length() == 0)
00045 return s;
00046 int b = s.find_first_not_of(" \t");
00047 int e = s.find_last_not_of(" \t");
00048 if(b == -1)
00049 return "";
00050 return std::string(s, b, e - b + 1);
00051 }
00052
00056 class CClock
00057 {
00058 clock_t stime,etime;
00059 double diff;
00060 public:
00064 void Start() {stime=clock();};
00068 void End()
00069 {
00070 etime=clock();
00071 diff = (double) ( etime - stime ) / (CLOCKS_PER_SEC) ;
00072 };
00076 double GetTime() { return diff; };
00077 };
00078
00079 typedef REAL Matrix3x3[3][3];
00080
00081
00082
00083 #endif