-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutilities.h
More file actions
32 lines (27 loc) · 1.05 KB
/
utilities.h
File metadata and controls
32 lines (27 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef UTILITIES_H
#define UTILITIES_H
#define INF 9e999
#define assure(expr,message) \
if (expr) ; \
else error("at line %d of '%s': %s",__LINE__,__FILE__,message);
#define RAND(i) ( (double)(i)*rand() / ((double)RAND_MAX+.01) )
#define IRAND(i) ( (int)RAND(i) )
void error( const char * message, ... );
unsigned int* InitUIVector( long n );
int* InitIVector( long n );
char* InitCVector( long n );
float* InitVector( long n );
double** InitDMatrix( long n, long m );
float** InitMatrix( long n, long j );
void FreeDMatrix( double** m, long n );
unsigned int** InitUIMatrix( long n, long m );
void FreeUIMatrix( unsigned int** m, long n );
int** InitIMatrix( long n, long m );
void FreeIMatrix( int** m, long n );
char** InitCMatrix( long n, long m );
void FreeCMatrix( char** m, long n );
void FreeMatrix( float** m, long n );
void ResetCMatrix( char** m, long n, long j );
void ResetDMatrix( double** m, long n, long j );
void DSortIndex( int n, double* a, unsigned int* j );
#endif