00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef UTILS_H_
00011 #define UTILS_H_
00012
00013 using namespace std;
00014
00015 namespace utils {
00016
00017
00018 void readDoubleMatrix(const char * filename, double **mat, int rows, int cols);
00019 void readIntMatrix(char * filename, int **mat, int rows, int cols);
00020
00021
00022 void readDoubleArray(const char * filename, double *col, int size);
00023 void readIntArray(const char * filename, int *col, int size);
00024
00025
00026 void printDoubleMatrix(double** mat, int rows, int cols);
00027
00028
00029 void printIntArray(int * A, int size);
00030 void printDoubleArray(double * A, int size);
00031
00032
00033 void allocateDoubleRows(double **mat, int rows, int cols);
00034 void allocateIntRows(int **mat, int rows, int cols);
00035
00036
00037 void clearDoubleArray(double * A, int size);
00038 void clearIntArray(int * A, int size);
00039
00040
00041 void copyDoubleArray(double * A, double * B, int size);
00042
00043
00044 void indexSort(double * X, int * inds, int N);
00045
00046
00047 void indexSelect(double * X, int * inds, int N, int k);
00048
00049
00050 void sortInts(int * X, int N);
00051
00052
00053 int * indexArray(int size);
00054
00055
00056 int arrayMin(double * A, int size);
00057
00058 }
00059
00060 #endif