'ElMo-Knock'

util.h

Go to the documentation of this file.
00001 #ifndef UTIL_H
00002 #define UTIL_H
00003 
00004 #include <iostream>
00005 #include <fstream>   // file I/O
00006 #include <sstream>
00007 #include <stdlib.h>
00008 #include <iomanip>
00009 #include <algorithm>
00010 #include <deque>
00011 #include <list>
00012 #include <queue>
00013 #include <set>
00014 #include <time.h>
00015 #include <stdint.h>
00016 #ifdef PARALLEL
00017         #include <mpi.h>
00018 #endif
00019 
00020 #define t_UnsignedInt uint64_t  
00021 #define t_uint uint64_t 
00022 #define t_MPI_UNSIGNED_INT MPI_UNSIGNED_LONG
00023 #define minval(a,b) (((a)>(b)) ? (b) : (a))
00024 
00025 #define maxval(a,b) (((a)<(b)) ? (b) : (a))
00026 
00027 using namespace std;
00028 
00029 
00030 namespace util {
00031 
00032 bool   strcmp_ignore_case(string first, string second);
00033 int    current_time(double *t);
00034 string get_time_str();
00035 int    get_proc_id_nump(int &proc_id,int &nump);
00036 void   fast_gcd(double *a, t_UnsignedInt len, double *gcd);
00037 double infnormvec(vector< vector<double> > A);
00038 //int right_nullspace_integer(vector< vector<double> > &A, vector<t_UnsignedInt> prior_cols, t_UnsignedInt int_calc, vector< vector<double> > &K,  vector<t_UnsignedInt> & unused);
00039 int    right_nullspace_integer(vector< vector<double> > &A, vector< vector<double> > &K);
00040 int    right_nullspace_nonint(vector< vector<double> > &A,  vector< vector<double> > &K);
00041 int    swap_rows(vector< vector<double> > &mat, t_UnsignedInt row1, t_UnsignedInt row2);
00042 int    swap_columns(vector< vector<double> > &mat, t_UnsignedInt col1, t_UnsignedInt col2);
00043 t_UnsignedInt row_echelon(vector< vector<double> > mat, t_UnsignedInt reduced, vector<t_UnsignedInt> rowmap, vector<t_UnsignedInt> colmap);
00044 int nullspace(vector< vector<double> > mat,  vector< vector<double> > &kernel);
00045 inline string trim_right(const string &source , const string& t = " ")
00046 {
00047         string str = source;
00048         return str.erase( str.find_last_not_of(t) + 1);
00049 }
00050 
00051 inline string trim_left( const string& source, const string& t = " ")
00052 {
00053         string str = source;
00054         return str.erase(0 , source.find_first_not_of(t) );
00055 }
00056 
00057 inline string trim(const string& source, const string& t = " ")
00058 {
00059         string str = source;
00060         return trim_left( trim_right( str , t) , t );
00061 }
00062 
00063  bool file_exists(const string &fname );
00064 }
00065 
00066 enum direct_enum_score { MIN_METAB_FUNC, ROBUST_DESIGN};
00067 
00068 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines