Garfield++ 4.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
NR.h
Go to the documentation of this file.
1#ifndef _NR_UTILS_H_
2#define _NR_UTILS_H_
3
4#ifdef DEFINE_NRGLOBAL
5#define NRGLOBAL
6#else
7#define NRGLOBAL extern
8#endif
9
10#ifdef __cplusplus
11namespace neBEM {
12#endif
13
14/*
15static float sqrarg;
16#define SQR(a) ((sqrarg=(a)) ==0.0 ? 0.0 : sqrarg*sqrarg)
17
18static double dsqrarg;
19#define DSQR(a) ((dsqrarg=(a)) == 0.0 ? 0.0 : dsqrarg*dsqrarg)
20
21static double dmaxarg1,dmaxarg2;
22#define DMAX(a,b) (dmaxarg1=(a),dmaxarg2=(b),(dmaxarg1)>(dmaxarg2) ?\
23 (dmaxarg1):(dmaxarg2))
24
25static double dminarg1,dminarg2;
26#define DMIN(a,b) (dminarg1=(a),dminarg2=(b),(dminarg1)>(dminarg2) ?\
27 (dminarg1):(dminarg2))
28
29static float maxarg1,maxarg2;
30#define FMAX(a,b) (maxarg1=(a),maxarg2=(b),(maxarg1)>(maxarg2) ?\
31 (maxarg1):(maxarg2))
32
33static float minarg1,minarg2;
34#define FMIN(a,b) (minarg1=(a),minarg2=(b),(minarg1)>(minarg2) ?\
35 (minarg1):(minarg2))
36
37static long lmaxarg1,lmaxarg2;
38#define LMAX(a,b)(lmaxarg1=(a),lmaxarg2=(b),(lmaxarg1)>(lmaxarg2) ?\
39 (lmaxarg1):(lmaxarg2))
40
41static long lminarg1,lminarg2;
42#define LMIN(a,b)(lminarg1=(a),lminarg2=(b),(lminarg1)>(lminarg2) ?\
43(lminarg1):(lminarg2))
44
45static int imaxarg1,imaxarg2;
46#define IMAX(a,b) (imaxarg1=(a),imaxarg2=(b),(imaxarg1)>(imaxarg2) ?\
47 (imaxarg1):(imaxarg2))
48
49static int iminarg1,iminarg2;
50#define IMIN(a,b) (iminarg1=(a),iminarg2=(b),(iminarg1)>(iminarg2) ?\
51 (iminarg1):(iminarg2))
52
53#define SIGN(a,b) ((b)>0.0 ? fabs(a) : -fabs(a))
54*/
55
56#if defined(__STDC__) || defined(ANSI) || defined(NRANSI) /* ANSI */
57
58NRGLOBAL void nrerror(const char error_text[]);
59
60NRGLOBAL float *fvector(long nl, long nh);
61
62NRGLOBAL int *ivector(long nl, long nh);
63
64NRGLOBAL unsigned char *cvector(long nl, long nh);
65
66NRGLOBAL double *dvector(long nl, long nh);
67
68NRGLOBAL float **fmatrix(long nrl, long nrh, long ncl, long nch);
69
70NRGLOBAL double **dmatrix(long nrl, long nrh, long ncl, long nch);
71
72NRGLOBAL int **imatrix(long nrl, long nrh, long ncl, long nch);
73
74NRGLOBAL float **submatrix(float **a, long oldrl, long oldrh, long oldcl,
75 long oldch, long newrl, long newcl);
76
77NRGLOBAL float **convert_matrix(float *a, long nrl, long nrh, long ncl,
78 long nch);
79
80NRGLOBAL int ***i3tensor(long nrl, long nrh, long ncl, long nch, long ndl,
81 long ndh);
82
83NRGLOBAL float ***f3tensor(long nrl, long nrh, long ncl, long nch, long ndl,
84 long ndh);
85
86NRGLOBAL double ***d3tensor(long nrl, long nrh, long ncl, long nch, long ndl,
87 long ndh);
88
89NRGLOBAL double ****d4tensor(long nrl, long nrh, long ncl, long nch, long ndl,
90 long ndh, long nd4l, long nd4h);
91
92NRGLOBAL void free_fvector(float *v, long nl, long nh);
93
94NRGLOBAL void free_ivector(int *v, long nl, long nh);
95
96NRGLOBAL void free_cvector(unsigned char *v, long nl, long nh);
97
98NRGLOBAL void free_lvector(unsigned long *v, long nl, long nh);
99
100NRGLOBAL void free_dvector(double *v, long nl, long nh);
101
102NRGLOBAL void free_fmatrix(float **m, long nrl, long nrh, long ncl, long nch);
103
104NRGLOBAL void free_dmatrix(double **m, long nrl, long nrh, long ncl, long nch);
105
106NRGLOBAL void free_imatrix(int **m, long nrl, long nrh, long ncl, long nch);
107
108NRGLOBAL void free_submatrix(float **b, long nrl, long nrh, long ncl, long nch);
109
110NRGLOBAL void free_convert_matrix(float **b, long nrl, long nrh, long ncl,
111 long nch);
112
113NRGLOBAL void free_i3tensor(int ***t, long nrl, long nrh, long ncl, long nch,
114 long ndl, long ndh);
115
116NRGLOBAL void free_f3tensor(float ***t, long nrl, long nrh, long ncl, long nch,
117 long ndl, long ndh);
118
119NRGLOBAL void free_d3tensor(double ***t, long nrl, long nrh, long ncl, long nch,
120 long ndl, long ndh);
121
122NRGLOBAL void free_d4tensor(double ****t, long nrl, long nrh, long ncl,
123 long nch, long ndl, long ndh, long nd4l, long nd4h);
124
125#else /*ANSI*/
126/* traditional - K&R */
127
130
131#endif /* ANSI */
132
133#ifdef __cplusplus
134} // namespace
135#endif
136
137#endif /* _NR_UTILS_H_ */
138
139#ifndef _NR_H_
140#define _NR_H_
141
142#ifdef __cplusplus
143namespace neBEM {
144#endif
145
146NRGLOBAL void gaussj(double **a, int n, double *b, int m);
147
148NRGLOBAL void ludcmp(double **a, int matsize, int *b, double *c);
149
150NRGLOBAL void lubksb(double **a, int matsize, int *b, double *c);
151
152NRGLOBAL void svdcmp(double **a, int matrow, int matcol, double *w, double **v);
153
154NRGLOBAL void svbksb(double **a, double *w, double **v, int matrow, int matcol,
155 double *V, double *ChDen);
156
157#ifdef __cplusplus
158} // namespace
159#endif
160
161#endif /* NR */
NRGLOBAL void nrerror()
NRGLOBAL void svdcmp(double **a, int matrow, int matcol, double *w, double **v)
Definition: svdcmp.c:27
NRGLOBAL void svbksb(double **a, double *w, double **v, int matrow, int matcol, double *V, double *ChDen)
NRGLOBAL void gaussj(double **a, int n, double *b, int m)
NRGLOBAL float * vector()
#define NRGLOBAL
Definition: NR.h:7
void lubksb(double **a, int n, int *index, double *b)
Definition: luc.c:90
void ludcmp(double **a, int n, int *index, double *d)
Definition: luc.c:12
unsigned char * cvector(long nl, long nh)
Definition: nrutil.c:42
void free_fmatrix(float **m, long nrl, long, long ncl, long)
Definition: nrutil.c:475
float ** convert_matrix(float *a, long nrl, long nrh, long ncl, long nch)
Definition: nrutil.c:165
float ** fmatrix(long nrl, long nrh, long ncl, long nch)
Definition: nrutil.c:73
void free_dmatrix(double **m, long nrl, long, long ncl, long)
Definition: nrutil.c:481
float * fvector(long nl, long nh)
Definition: nrutil.c:22
void free_dvector(double *v, long nl, long)
Definition: nrutil.c:470
void free_convert_matrix(float **b, long nrl, long, long, long)
Definition: nrutil.c:499
void free_f3tensor(float ***t, long nrl, long, long ncl, long, long ndl, long)
Definition: nrutil.c:505
double *** d3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh)
Definition: nrutil.c:222
double **** d4tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh, long nwl, long nwh)
Definition: nrutil.c:260
float *** f3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh)
Definition: nrutil.c:187
void free_d4tensor(double ****t, long nrl, long, long ncl, long, long ndl, long, long nwl, long)
Definition: nrutil.c:522
void free_submatrix(float **b, long nrl, long, long, long)
Definition: nrutil.c:493
int * ivector(long nl, long nh)
Definition: nrutil.c:32
void free_lvector(unsigned long *v, long nl, long)
Definition: nrutil.c:465
double ** dmatrix(long nrl, long nrh, long ncl, long nch)
Definition: nrutil.c:97
int ** imatrix(long nrl, long nrh, long ncl, long nch)
Definition: nrutil.c:121
void free_ivector(int *v, long nl, long)
Definition: nrutil.c:455
double * dvector(long nl, long nh)
Definition: nrutil.c:63
void free_cvector(unsigned char *v, long nl, long)
Definition: nrutil.c:460
void free_d3tensor(double ***t, long nrl, long, long ncl, long, long ndl, long)
Definition: nrutil.c:513
void free_imatrix(int **m, long nrl, long, long ncl, long)
Definition: nrutil.c:487
void free_fvector(float *v, long nl, long)
Definition: nrutil.c:450
float ** submatrix(float **a, long oldrl, long oldrh, long oldcl, long, long newrl, long newcl)
Definition: nrutil.c:145