1 /* nrutil.h + common.h -> egutils.h */ 2 3 4 #ifndef _EGUTILS_H_ 5 #define _EGUTILS_H_ 6 7 8 typedef double Real; 9 #define Rvector dvector 10 #define Ivector ivector 11 #define Rmatrix dmatrix 12 #define Imatrix imatrix 13 #define free_Rvector free_dvector 14 #define free_Ivector free_ivector 15 #define free_Rmatrix free_dmatrix 16 #define free_Imatrix free_imatrix 17 #define TRUE 1 18 #define FALSE 0 19 20 /* Numerical Recipes' uncopyrighted vector and matrix allocation 21 and deallocation routines. */ 22 int MemoryUsage(); 23 24 void nrerror(const char error_text[]); 25 26 float *vector(int,int); 27 int *ivector(int,int); 28 unsigned char *cvector(int,int); 29 unsigned long *lvector(int,int); 30 double *dvector(int,int); 31 32 float **matrix(int,int,int,int); 33 double **dmatrix(int,int,int,int); 34 int **imatrix(int,int,int,int); 35 float **submatrix(float **,int,int,int,int,int,int); 36 double ***f3tensor(int nrl,int nrh,int ncl,int nch,int ndl,int ndh); 37 38 void free_vector(float *,int,int); 39 void free_ivector(int *,int,int); 40 void free_cvector(unsigned char *,int,int); 41 void free_lvector(unsigned long *,int,int); 42 void free_dvector(double *,int,int); 43 44 void free_matrix(float **,int,int,int,int); 45 void free_dmatrix(double **,int,int,int,int); 46 void free_imatrix(int **,int,int,int,int); 47 void free_submatrix(float **,int,int,int,int); 48 void free_f3tensor(double ***t,int nrl,int nrh,int ncl,int nch,int ndl,int ndh); 49 50 /* Common subroutines that operate on vectors, matrices and other basic 51 data types: Find the minimum or maximum place or value, find 52 the mean, calculate the mean difference, save to or load from 53 an external file etc. */ 54 55 void timer_init(); 56 void timer_activate(const char *prefix); 57 void timer_show(); 58 59 void bigerror(const char error_text[]); 60 void smallerror(const char error_text[]); 61 int FileExists(char *filename); 62 Real Minimum(Real *vector,int first,int last); 63 int Minimi(Real *vector,int first,int last); 64 Real Maximum(Real *vector,int first,int last); 65 int Maximi(Real *vector,int first,int last); 66 void AddExtension(const char *fname1,char *fname2,const char *newext); 67 int StringToStrings(const char *buf,char argv[10][15],int argc,char separator); 68 int StringToReal(const char *buf,Real *dest,int maxcnt,char separator); 69 int StringToInteger(const char *buf,int *dest,int maxcnt,char separator); 70 int StringToIntegerNoZero(const char *buf,int *dest,int maxcnt,char separator); 71 int next_int(char **start); 72 int next_int_n(char **start, int n); 73 Real next_real(char **start); 74 void SortIndex( int N, double *Key, int *Ord ); 75 #endif 76