numTools.h

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 //
00003 // $Id$
00004 //
00005 // Copyright 2008, 2009, 2010, 2011, 2012  Antonio Franchi and Paolo Stegagno    
00006 //
00007 // This file is part of MIP.
00008 //
00009 // MIP is free software: you can redistribute it and/or modify
00010 // it under the terms of the GNU General Public License as published by
00011 // the Free Software Foundation, either version 3 of the License, or
00012 // (at your option) any later version.
00013 //
00014 // MIP is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with MIP. If not, see <http://www.gnu.org/licenses/>.
00021 //
00022 // Contact info: antonio.franchi@tuebingen.mpg.de stegagno@diag.uniroma1.it
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 

Generated on Mon Feb 20 07:01:07 2017 for MIP by  doxygen 1.5.6