EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
egutils.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file egutils.h
1 /* common.h */
2 /* Common subroutines that operate on vectors, matrices and other basic
3  data types: Find the minimum or maximum place or value, find
4  the mean, calculate the mean difference, save to or load from
5  an external file etc. */
6 
7 #ifndef _COMMON_H_
8 #define _COMMON_H_
9 
10 typedef double Real;
11 #define Rvector dvector
12 #define Ivector ivector
13 #define Rmatrix dmatrix
14 #define Imatrix imatrix
15 #define free_Rvector free_dvector
16 #define free_Ivector free_ivector
17 #define free_Rmatrix free_dmatrix
18 #define free_Imatrix free_imatrix
19 #define TRUE 1
20 #define FALSE 0
21 
22 
23 /* Numerical Recipes' uncopyrighted vector and matrix allocation
24  and deallocation routines. */
25 int MemoryUsage();
26 void nrerror(const char error_text[]);
27 
28 float *vector(int,int);
29 int *ivector(int,int);
30 unsigned char *cvector(int,int);
31 unsigned long *lvector(int,int);
32 double *dvector(int,int);
33 
34 float **matrix(int,int,int,int);
35 double **dmatrix(int,int,int,int);
36 int **imatrix(int,int,int,int);
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 
48 void bigerror(const char error_text[]);
49 void smallerror(const char error_text[]);
50 int FileExists(char *filename);
51 Real Minimum(Real *vector,int first,int last);
52 int Minimi(Real *vector,int first,int last);
53 Real Maximum(Real *vector,int first,int last);
54 int Maximi(Real *vector,int first,int last);
55 void AddExtension(const char *fname1,char *fname2,const char *newext);
56 int StringToStrings(const char *buf,char argv[10][10],int argc,char separator);
57 int StringToReal(const char *buf,Real *dest,int maxcnt,char separator);
58 int StringToInteger(const char *buf,int *dest,int maxcnt,char separator);
59 int next_int(char **start);
60 Real next_real(char **start);
61 void SortIndex(int n,double *arr,int *indx);
62 #endif