numTools.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00030
00034
00035
00037
00038
00039
00040 #ifndef __NUM_TOOLS_H_
00041 #define __NUM_TOOLS_H_
00042
00043 #ifdef MIP_HOST_APPLE
00044 #include </usr/include/time.h>
00045 #include <ctime>
00046 #endif
00047
00048 #include <stdio.h>
00049 #include <math.h>
00050 #include <vector>
00051 #include <iostream>
00052 #include <string>
00053 #include <sstream>
00054 #include <sys/time.h>
00055 #include <sys/select.h>
00056 #include <assert.h>
00057 #include <pthread.h>
00058 #include <fstream>
00059 #include <MIPMatrix.h>
00060 #include <Types.h>
00061
00062 #include <stdio.h>
00063 #include <stdlib.h>
00064 #include <time.h>
00065
00066 using namespace std;
00067 using namespace MipBaselib;
00068
00072 class DubInt{
00073 protected:
00074 int _i;
00075 int _j;
00076
00077 public:
00079 DubInt();
00080
00082 DubInt(int a, int b);
00083
00084
00085
00087 DubInt(const DubInt &db);
00088
00090 int i() const;
00091
00093 int j() const;
00094
00096 string print();
00097
00099 void setFirst(int a);
00100
00102 void setSecond(int a);
00103
00105 bool operator==( DubInt other ) const ;
00106
00108 bool operator!=( DubInt other ) const ;
00109
00111 DubInt operator+( DubInt other ) const;
00112
00114 void operator=(const DubInt& other);
00115 };
00116
00117
00118
00123 class DecimalUtilities{
00124 private:
00125
00126 static bool _initialized;
00127
00128 static void _randInit(void);
00129
00130 public:
00136 static bool equal(Decimal a, Decimal b, Decimal threshold);
00137
00139 static int sign(Decimal num);
00140
00142 static Decimal randUniform(Decimal a, Decimal b);
00143
00145 static Decimal randGaussian(Decimal m,Decimal sigma,Decimal extr_inf,Decimal extr_sup);
00146
00148 static Decimal randMultiGaussian(MIPMatrix &x, MIPMatrix &m, MIPMatrix &cov);
00149 };
00150
00151
00152 #endif
00153
00154
00155
00156
00157
00158