-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib.h
80 lines (63 loc) · 2.39 KB
/
lib.h
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
* The definition module
* lib.h
* for the library function common for all C programs.
*/
// Standard ANSI-C++ include files
#ifndef LIB_H
#define LIB_H
#include <iostream>
#include <new>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
using namespace std;
#define NULL_PTR (void *) 0
#define ZERO 1.0E-10
//#define INFINITY 1.0E15
#define UL unsigned long
/* a macro used in function pythag() */
static float sqrarg;
#define SQR(a) ((sqrarg = (a)) == 0.0 ? 0.0 : sqrarg * sqrarg)
/* Macro definitions for integer arguments only */
#define SIGN(a,b) ((b)<0 ? -fabs(a) : fabs(a))
// ****** data declaration *******
typedef struct { // structure definition for execution time
unsigned long long int
tick,
sec,
min,
hour;
} TID;
// Function declarations
TID time_step(int num);
void **matrix(int, int, int);
void free_matrix(void **);
void rk4(double *, double *, int, double, double, double *,
void (*derivs)(double, double *, double *));
void ludcmp(double **, int, int *, double*);
void lubksb(double **, int, int *, double *);
void tqli(double *, double *, int, double **);
void tred2(double **, int, double *, double *);
double pythag(double, double);
void gauleg(double, double, double *, double *, int);
void jacobi(double** a, double* d, double** v, int n, int& nrot);
double rectangle_rule(double, double, int, double (*func)(double));
double trapezoidal_rule(double, double, int, double (*func)(double));
void spline(double *, double *, int, double, double, double *);
void splint(double *, double *, double *, int, double, double *);
void polint(double *, double *, int, double, double *, double *);
double rtbis(double(*func)(double), double, double, double);
double rtsec(double( *func)(double), double, double, double);
double rtnewt(void ( *funcd)(double, double *, double *), double, double, double);
double zbrent(double( *func)(double), double, double, double);
double ran0(long *);
double ran1(long *);
double ran2(long *);
double ran3(long *);
double gaussian_deviate(long *);
inline double ** new_matrix(int nx, int ny){
return (double **) matrix(nx, ny, sizeof(double));
}
#endif /* LIB_H */