Garfield++ 4.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
nrutil.c
Go to the documentation of this file.
1#include <stddef.h>
2#include <stdio.h>
3#include <stdlib.h>
4#include "NR.h"
5
6#define NR_END 1
7#define FREE_ARG char *
8
9#ifdef __cplusplus
10namespace neBEM {
11#endif
12
13void nrerror(const char error_text[])
14/* Numerical Recipes standard error handler */
15{
16 fprintf(stderr, " run_time error......\n");
17 fprintf(stderr, "%s\n", error_text);
18 fprintf(stderr, ".....now exiting to system.....\n");
19 exit(1);
20}
21
22float *fvector(long nl, long nh)
23/* allocate a float vector with subscript range v[nl...nh] */
24{
25 float *v;
26
27 v = (float *)malloc((size_t)((nh - nl + 1 + NR_END) * sizeof(float)));
28 if (!v) nrerror("allocation failure in vector()");
29 return v - nl + NR_END;
30}
31
32int *ivector(long nl, long nh)
33/* allocate a int vector with subscript range v[nl...nh] */
34{
35 int *v;
36
37 v = (int *)malloc((size_t)((nh - nl + 1 + NR_END) * sizeof(int)));
38 if (!v) nrerror("allocation failure in ivector()");
39 return v - nl + NR_END;
40}
41
42unsigned char *cvector(long nl, long nh)
43/* allocate an unsigned char vector with subscript range v[nl...nh] */
44{
45 unsigned char *v;
46
47 v = (unsigned char *)malloc(
48 (size_t)((nh - nl + 1 + NR_END) * sizeof(unsigned char)));
49 if (!v) nrerror("allocation failure in cvector()");
50 return v - nl + NR_END;
51}
52
53unsigned long *lvector(long nl, long nh)
54/* allocate an unsigned long vector with subscript range v[nl...nh] */
55{
56 unsigned long *v;
57
58 v = (unsigned long *)malloc((size_t)((nh - nl + 1 + NR_END) * sizeof(long)));
59 if (!v) nrerror("allocation failure in lvector()");
60 return v - nl + NR_END;
61}
62
63double *dvector(long nl, long nh)
64/* allocate a double vector with subscript range v[nl...nh] */
65{
66 double *v;
67
68 v = (double *)malloc((size_t)((nh - nl + 1 + NR_END) * sizeof(double)));
69 if (!v) nrerror("allocation failure in dvector()");
70 return v - nl + NR_END;
71}
72
73float **fmatrix(long nrl, long nrh, long ncl, long nch)
74/*allocate a float matrix with subscript range m[nrl...nrh][ncl...nch] */
75{
76 long i, nrow = nrh - nrl + 1, ncol = nch - ncl + 1;
77 float **m;
78
79 /* allocate pointers to rows */
80 m = (float **)malloc((size_t)((nrow + NR_END) * sizeof(float *)));
81 if (!m) nrerror("allocation failure 1 in matrix()");
82 m += NR_END;
83 m -= nrl;
84
85 /* allocate rows and set pointers to them */
86 m[nrl] = (float *)malloc((size_t)((nrow * ncol + NR_END) * sizeof(float)));
87 if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
88 m[nrl] += NR_END;
89 m[nrl] -= ncl;
90
91 for (i = nrl + 1; i <= nrh; i++) m[i] = m[i - 1] + ncol;
92
93 /* return pointer to array of pointer to rows */
94 return m;
95}
96
97double **dmatrix(long nrl, long nrh, long ncl, long nch)
98/* allocate a double with subscript range m[nrl..nrh][ncl..nch] */
99{
100 long i, nrow = nrh - nrl + 1, ncol = nch - ncl + 1;
101 double **m;
102
103 /* allocate pointer to row */
104 m = (double **)malloc((size_t)((nrow + NR_END) * sizeof(double *)));
105 if (!m) nrerror("allocation faliore 1 in matrix()");
106 m += NR_END;
107 m -= nrl;
108
109 /* allocate row and set pointer to them */
110 m[nrl] = (double *)malloc((size_t)((nrow * ncol + NR_END) * sizeof(double)));
111 if (!m[nrl]) nrerror("allocation faliore 2 in matrix()");
112 m[nrl] += NR_END;
113 m[nrl] -= ncl;
114
115 for (i = nrl + 1; i <= nrh; i++) m[i] = m[i - 1] + ncol;
116
117 /* return pointer to array of pointer to rows */
118 return m;
119}
120
121int **imatrix(long nrl, long nrh, long ncl, long nch)
122/* allocate an int with subscript range m[nrl..nrh][ncl..nch] */
123{
124 long i, nrow = nrh - nrl + 1, ncol = nch - ncl + 1;
125 int **m;
126
127 /* allocate pointer to row */
128 m = (int **)malloc((size_t)((nrow + NR_END) * sizeof(int *)));
129 if (!m) nrerror("allocation faliore 1 in matrix()");
130 m += NR_END;
131 m -= nrl;
132
133 /* allocate row and set pointer to them */
134 m[nrl] = (int *)malloc((size_t)((nrow * ncol + NR_END) * sizeof(int)));
135 if (!m[nrl]) nrerror("allocation falior 2 in matrix()");
136 m[nrl] += NR_END;
137 m[nrl] -= ncl;
138
139 for (i = nrl + 1; i <= nrh; i++) m[i] = m[i - 1] + ncol;
140
141 /* return pointer to array of pointer to rows */
142 return m;
143}
144
145float **submatrix(float **a, long oldrl, long oldrh, long oldcl, long /*oldch*/,
146 long newrl, long newcl)
147/* point a submatrix [newrl...][newcl...] to a [oldrl...][oldcl...] */
148{
149 long i, j, nrow = oldrh - oldrl + 1, ncol = oldcl - newcl;
150 float **m;
151
152 /* allocate array of pointers to rows */
153 m = (float **)malloc((size_t)((nrow + NR_END) * sizeof(float *)));
154 if (!m) nrerror(" allocation failure in submatrix()");
155 m += NR_END;
156 m -= newrl;
157
158 /*set pointers to rows */
159 for (i = oldrl, j = newrl; i <= oldrh; i++, j++) m[j] = a[i] + ncol;
160
161 /* return pointer to array of pointers to rows */
162 return m;
163}
164
165float **convert_matrix(float *a, long nrl, long nrh, long ncl, long nch)
166/* allocate a float matrix m[nrl..nrh][ncl..nch] that points to the matrix
167 declared in the standard C manner as a[nrow][ncol], where nrh-nrl+1 and
168 ncol=nch-ncl+1. the routine should be called with the address &a[0][0]
169 as the first argument. */
170{
171 long i, j, nrow = nrh - nrl + 1, ncol = nch - ncl + 1;
172 float **m;
173
174 /* allocate pointers to rows */
175 m = (float **)malloc((size_t)((nrow + NR_END) * sizeof(float *)));
176 if (!m) nrerror(" allocation failure in convert_matrix()");
177 m += NR_END;
178 m -= nrl;
179
180 /*set pointers to rows */
181 m[nrl] = a - ncl;
182 for (i = 1, j = nrl + 1; i < nrow; i++, j++) m[j] = m[j - 1] + ncol;
183 /* return pointer to array of pointers to rows */
184 return m;
185}
186
187float ***f3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh)
188/* allocate a float 3tensor with range t[nrl..nrh][ncl..nch][mdl..ndh] */
189{
190 long i, j, nrow = nrh - nrl + 1, ncol = nch - ncl + 1, ndep = ndh - ndl + 1;
191 float ***t;
192
193 /* allocate pointers to pointers to rows */
194 t = (float ***)malloc((size_t)((nrow + NR_END) * sizeof(float **)));
195 if (!t) nrerror("allocation failure 1 in f3tensor()");
196 t += NR_END;
197 t -= nrl;
198
199 /* allocate pointers to rows and set pointers to them */
200 t[nrl] = (float **)malloc((size_t)((nrow * ncol + NR_END) * sizeof(float *)));
201 if (!t[nrl]) nrerror("allocation failure 2 in f3tensor()");
202 t[nrl] += NR_END;
203 t[nrl] -= ncl;
204
205 /* allocate rows and set pointers to them */
206 t[nrl][ncl] =
207 (float *)malloc((size_t)((nrow * ncol * ndep + NR_END) * sizeof(float)));
208 if (!t[nrl][ncl]) nrerror("allocation failure 3 in f3tensor()");
209 t[nrl][ncl] += NR_END;
210 t[nrl][ncl] -= ndl;
211
212 for (j = ncl + 1; j <= nch; j++) t[nrl][j] = t[nrl][j - 1] + ndep;
213 for (i = nrl + 1; i <= nrh; i++) {
214 t[i] = t[i - 1] + ncol;
215 t[i][ncl] = t[i - 1][ncl] + ncol * ndep;
216 for (j = ncl + 1; j <= nch; j++) t[i][j] = t[i][j - 1] + ndep;
217 }
218 /* return pointer to array of pointers to rows */
219 return t;
220}
221
222double ***d3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh)
223
224/* allocate a double 3tensor with range t[nrl..nrh][ncl..nch][mdl..ndh] */
225{
226 long i, j, nrow = nrh - nrl + 1, ncol = nch - ncl + 1, ndep = ndh - ndl + 1;
227 double ***t;
228
229 /* allocate pointers to pointers to rows */
230 t = (double ***)malloc((size_t)((nrow + NR_END) * sizeof(double **)));
231 if (!t) nrerror("allocation failure 1 in d3tensor()");
232 t += NR_END;
233 t -= nrl;
234
235 /* allocate pointers to rows and set pointers to them */
236 t[nrl] =
237 (double **)malloc((size_t)((nrow * ncol + NR_END) * sizeof(double *)));
238 if (!t[nrl]) nrerror("allocation failure 2 in d3tensor()");
239 t[nrl] += NR_END;
240 t[nrl] -= ncl;
241
242 /* allocate rows and set pointers to them */
243 t[nrl][ncl] = (double *)malloc(
244 (size_t)((nrow * ncol * ndep + NR_END) * sizeof(double)));
245 if (!t[nrl][ncl]) nrerror("allocation failure 3 in d3tensor()");
246 t[nrl][ncl] += NR_END;
247 t[nrl][ncl] -= ndl;
248
249 for (j = ncl + 1; j <= nch; j++) t[nrl][j] = t[nrl][j - 1] + ndep;
250 for (i = nrl + 1; i <= nrh; i++) {
251 t[i] = t[i - 1] + ncol;
252 t[i][ncl] = t[i - 1][ncl] + ncol * ndep;
253 for (j = ncl + 1; j <= nch; j++) t[i][j] = t[i][j - 1] + ndep;
254 }
255 /* return pointer to array of pointers to rows */
256 return t;
257}
258
259// from f4tensor.txt
260double ****d4tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh,
261 long nwl, long nwh)
262// allocate a double 4tensor with range
263// t[nrl..nrh][ncl..nch][ndl..ndh][nwl..nwh]
264{
265 long i, j, k, nrow = nrh - nrl + 1, ncol = nch - ncl + 1,
266 ndep = ndh - ndl + 1, nwid = nwh - nwl + 1;
267 double ****t;
268
269 // allocate pointers to pointers to pointers to rows
270 t = (double ****)malloc((size_t)((nrow + NR_END) * sizeof(double ***)));
271 if (!t) nrerror("allocation failure 1 in d4tensor()");
272 t += NR_END;
273 t -= nrl;
274
275 // allocate pointers to pointers to rows and set pointers to them
276 t[nrl] =
277 (double ***)malloc((size_t)((nrow * ncol + NR_END) * sizeof(double **)));
278 if (!t[nrl]) nrerror("allocation failure 2 in d4tensor()");
279 t[nrl] += NR_END;
280 t[nrl] -= ncl;
281
282 // allocate pointers to rows and set pointers to them
283 t[nrl][ncl] = (double **)malloc(
284 (size_t)((nrow * ncol * ndep + NR_END) * sizeof(double *)));
285 if (!t[nrl][ncl]) nrerror("allocation failure 3 in d4tensor()");
286 t[nrl][ncl] += NR_END;
287 t[nrl][ncl] -= ndl;
288
289 // allocate rows and set pointers to them
290 t[nrl][ncl][ndl] = (double *)malloc(
291 (size_t)((nrow * ncol * ndep * nwid + NR_END) * sizeof(double)));
292 if (!t[nrl][ncl][ndl]) nrerror("allocation failure 4 in d4tensor()");
293 t[nrl][ncl][ndl] += NR_END;
294 t[nrl][ncl][ndl] -= nwl;
295
296 for (i = nrl; i <= nrh; i++) {
297 if (i > nrl) {
298 t[i] = t[i - 1] + ncol;
299 t[i][ncl] = t[i - 1][ncl] + ncol * ndep;
300 t[i][ncl][ndl] = t[i - 1][ncl][ndl] + ncol * ndep * nwid;
301 }
302 for (j = ncl; j <= nch; j++) {
303 if (j > ncl) {
304 t[i][j] = t[i][j - 1] + ndep;
305 t[i][j][ndl] = t[i][j - 1][ndl] + ndep * nwid;
306 }
307
308 for (k = ndl; k <= ndh; k++) {
309 if (k > ndl) t[i][j][k] = t[i][j][k - 1] + nwid;
310 }
311 }
312 }
313
314 // return pointer to pointer to array of pointers to rows
315 return t;
316}
317
318/* from f4tensor2.c - inability to start from non-zero index
319double ****d4tensor(int nrl, int nrh, int ncl, int nch, int ndl, int ndh, int
320nsl, int nsh)
321// for example: d4tensor(0,NX-1,0,NY-1,0,NZ-1,0,NS)
322// allocate a double 3tensor with range t[nrl..nrh][ncl..nch][ndl..ndh]
323{
324 int i,j,k,nrow=nrh-nrl+1,ncol=nch-ncl+1,ndep=ndh-ndl+1,nsext=nsh-nsl+1;
325 double ****tt;
326
327 // allocate pointers to pointers to rows
328 tt=(double ****) malloc((size_t)((nrow)*sizeof(double***)));
329 if (!tt) nrerror("allocation failure 1 in d4tensor()");
330 tt -= nrl;
331
332 // allocate pointers to rows and set pointers to them
333 tt[nrl]=(double ***) malloc((size_t)((nrow*ncol)*sizeof(double**)));
334 if (!tt[nrl]) nrerror("allocation failure 2 in d4tensor()");
335 tt[nrl] -= ncl;
336
337 // allocate rows and set pointers to them
338 tt[nrl][ncl]=(double **)
339malloc((size_t)((nrow*ncol*ndep)*sizeof(double*))); if (!tt[nrl][ncl])
340nrerror("allocation failure 3 in d4tensor()"); tt[nrl][ncl] -= ndl;
341
342 // allocate rows and set pointers to them
343 tt[nrl][ncl][ndl]=(double *)
344malloc((size_t)((nrow*ncol*ndep*nsext)*sizeof(double))); if (!tt[nrl][ncl][ndl])
345nrerror("allocation failure 4 in d4tensor()"); tt[nrl][ncl][ndl] -= nsl;
346
347
348 for(i=nrl+1;i<=nrh;i++) tt[i]=tt[i-1]+ncol;
349 //////////////////////////////////////////////////////////////
350 for(j=ncl+1;j<=nch;j++) tt[nrl][j]=tt[nrl][j-1]+ndep;
351 for(i=nrl+1;i<=nrh;i++)
352 {
353 tt[i][ncl]=tt[i-1][ncl]+ncol*ndep;
354 for(j=ncl+1;j<=nch;j++)
355 tt[i][j]=tt[i][j-1]+ndep;
356 }
357 ////////////////////////////////////////////////////////////////
358 for(k=ndl+1;k<=ndh;k++) tt[nrl][ncl][k]=tt[nrl][ncl][k-1]+nsext; //
359(0;0;0~ndh).
360
361 for(i=nrl+1;i<=nrh;i++) // (1~nrh;0;0~ndh).
362 {
363 tt[i][ncl][ndl]=tt[i-1][ncl][ndl]+ncol*ndep*nsext;
364 for(k=ndl+1;k<=ndh;k++)
365 tt[i][ncl][k]=tt[i][ncl][k-1]+nsext;
366 }
367 for(j=ncl+1;j<=nch;j++) // (0;1~nch;0~ndh).
368 {
369 tt[nrl][j][ndl]=tt[nrl][j-1][ndl]+ndep*nsext;
370 for(k=ndl+1;k<=ndh;k++)
371 tt[nrl][j][k]=tt[nrl][j][k-1]+nsext;
372 }
373
374 for(i=nrl+1;i<=nrh;i++) //
375(1~nrh;1~nch;0~ndh).
376 {
377 tt[i][ncl][ndl]=tt[i-1][ncl][ndl]+ncol*ndep*nsext;
378 for(j=ncl+1;j<=nch;j++)
379 {
380 tt[i][j][ndl]=tt[i][j-1][ndl]+ndep*nsext;
381 for(k=ndl+1;k<=ndh;k++)
382 tt[i][j][k]=tt[i][j][k-1]+nsext;
383 }
384 }
385 // return pointer to array of pointers to rows
386 return tt;
387}
388
389
390// original version
391double ****d4tensor(long nrl, long nrh, long ncl, long nch, long ndl, long
392ndh,long nd4l,long nd4h)
393
394// allocate a double d4tensor with range
395t[nrl..nrh][ncl..nch][ndl..ndh][nd4l..nd4h]
396{
397 long i, j, k, nrow=nrh-nrl+1, ncol=nch-ncl+1,
398ndep=ndh-ndl+1,nd4th=nd4h-nd4l+1; double ****t;
399
400 // allocate pointers to pointers to pointers to rows
401 t=(double ****) malloc((size_t)((nrow+NR_END)*sizeof(double***)));
402 if(!t) nrerror("allocation failure 1 in d4tensor()");
403 t += NR_END;
404 t -= nrl;
405
406 // allocate pointers to pointers to rows and set pointers to them
407 t[nrl]=(double ***) malloc((size_t)((nrow*ncol+NR_END)*sizeof(double**)));
408 if(!t[nrl]) nrerror("allocation failure 2 in d4tensor()");
409 t[nrl] += NR_END;
410 t[nrl] -= ncl;
411
412 // allocate pointers to rows and set pointers to them
413 t[nrl][ncl]=(double **)
414malloc((size_t)((nrow*ncol*ndep+NR_END)*sizeof(double*))); if(!t[nrl][ncl])
415nrerror("allocation failure 3 in d4tensor()"); t[nrl][ncl] += NR_END;
416 t[nrl][ncl] -= ndl;
417
418 // allocate rows and set pointers to them
419 t[nrl][ncl][ndl]=(double *)
420malloc((size_t)((nrow*ncol*ndep*nd4th+NR_END)*sizeof(double)));
421 if(!t[nrl][ncl][ndl]) nrerror("allocation failure 4 in d4tensor()");
422 t[nrl][ncl][ndl] += NR_END;
423 t[nrl][ncl][ndl] -= nd4l;
424
425 for(k=ndl+1; k<=ndh; k++) t[nrl][ncl][k]=t[nrl][ncl][k-1]+nd4th;
426 for(j=ncl+1; j<=nch; j++)
427 {
428 t[nrl][j]=t[nrl][j-1]+ndep;
429 t[nrl][j][ndl]=t[nrl][j-1][ndl]+ndep*nd4th;
430 for(k=ndl+1; k<=ndh; k++)t[nrl][j][k]=t[nrl][j][k-1]+nd4th;
431 }
432 for(i=nrl+1; i<=nrh; i++)
433 {
434 t[i]=t[i-1]+ncol;
435 t[i][ncl]=t[i-1][ncl]+ncol*ndep;
436 for(j=ncl+1; j<=nch; j++)
437 {
438 t[i][j]=t[i][j-1]+ndep;
439 t[i][j][ndl]=t[i][j-1][ndl]+ndep*nd4th;
440 for(k=ndl+1; k<=ndh; k++)t[i][j][k]=t[i][j][k-1]+nd4th;
441 }
442
443 }
444 // return pointer to array of pointers to rows
445 return t;
446}
447*/
448
449/* free a float vector allocated with vector() */
450void free_fvector(float *v, long nl, long /*nh*/) {
451 free((FREE_ARG)(v + nl - NR_END));
452}
453
454/* free an int vector allocated with vector() */
455void free_ivector(int *v, long nl, long /*nh*/) {
456 free((FREE_ARG)(v + nl - NR_END));
457}
458
459/* free an unsigned char vector allocated with vector() */
460void free_cvector(unsigned char *v, long nl, long /*nh*/) {
461 free((FREE_ARG)(v + nl - NR_END));
462}
463
464/* free an unsigned long vector allocated with vector() */
465void free_lvector(unsigned long *v, long nl, long /*nh*/) {
466 free((FREE_ARG)(v + nl - NR_END));
467}
468
469/* free a double vector allocated with vector() */
470void free_dvector(double *v, long nl, long /*nh*/) {
471 free((FREE_ARG)(v + nl - NR_END));
472}
473
474/* free a float matrix allocated by matrix() */
475void free_fmatrix(float **m, long nrl, long /*nrh*/, long ncl, long /*nch*/) {
476 free((FREE_ARG)(m[nrl] + ncl - NR_END));
477 free((FREE_ARG)(m + nrl - NR_END));
478}
479
480/* free a double matrix allocated by dmatrix() */
481void free_dmatrix(double **m, long nrl, long /*nrh*/, long ncl, long /*nch*/) {
482 free((FREE_ARG)(m[nrl] + ncl - NR_END));
483 free((FREE_ARG)(m + nrl - NR_END));
484}
485
486/* free an int matrix allocated by imatrix() */
487void free_imatrix(int **m, long nrl, long /*nrh*/, long ncl, long /*nch*/) {
488 free((FREE_ARG)(m[nrl] + ncl - NR_END));
489 free((FREE_ARG)(m + nrl - NR_END));
490}
491
492/* free a submatrix allocated by submatrix() */
493void free_submatrix(float **b, long nrl, long /*nrh*/, long /*ncl*/,
494 long /*nch*/) {
495 free((FREE_ARG)(b + nrl - NR_END));
496}
497
498/* free a matrix allocated by convert_matrix() */
499void free_convert_matrix(float **b, long nrl, long /*nrh*/, long /*ncl*/,
500 long /*nch*/) {
501 free((FREE_ARG)(b + nrl - NR_END));
502}
503
504/* free a f3tensor allocated by f3tensor() */
505void free_f3tensor(float ***t, long nrl, long /*nrh*/, long ncl, long /*nch*/,
506 long ndl, long /*ndh*/) {
507 free((FREE_ARG)(t[nrl][ncl] + ndl - NR_END));
508 free((FREE_ARG)(t[nrl] + ncl - NR_END));
509 free((FREE_ARG)(t + nrl - NR_END));
510}
511
512/* free a d3tensor allocated by d3tensor() */
513void free_d3tensor(double ***t, long nrl, long /*nrh*/, long ncl, long /*nch*/,
514 long ndl, long /*ndh*/) {
515 free((FREE_ARG)(t[nrl][ncl] + ndl - NR_END));
516 free((FREE_ARG)(t[nrl] + ncl - NR_END));
517 free((FREE_ARG)(t + nrl - NR_END));
518}
519
520// from f4tensor.txt
521/* free a double d4tensor allocated by d4tensor() */
522void free_d4tensor(double ****t, long nrl, long /*nrh*/, long ncl, long /*nch*/,
523 long ndl, long /*ndh*/, long nwl, long /*nwh*/) {
524 free((FREE_ARG)(t[nrl][ncl][ndl] + nwl - NR_END));
525 free((FREE_ARG)(t[nrl][ncl] + ndl - NR_END));
526 free((FREE_ARG)(t[nrl] + ncl - NR_END));
527 free((FREE_ARG)(t + nrl - NR_END));
528}
529
530/* from f4tensor2.c - inability to start from non-zero index
531void free_d4tensor(double ****tt, int nrl, int nrh, int ncl, int nch,
532 int ndl, int ndh, int nsl, int nsh)
533// free a double d4tensor allocated by d4tensor()
534{
535 free((FREE_ARG) (tt[nrl][ncl][ndl]+nsl));
536 free((FREE_ARG) (tt[nrl][ncl]+ndl));
537 free((FREE_ARG) (tt[nrl]+ncl));
538 free((FREE_ARG) (tt+nrl));
539}
540
541// original version
542void free_d4tensor(double ****t,long nrl, long nrh, long ncl, long nch,
543 long ndl, long ndh, long nd4l, long nd4h)
544// free a d4tensor allocated by d4tensor()
545{
546 free((FREE_ARG) (t[nrl][ncl][ndl]+nd4l-NR_END));
547 free((FREE_ARG) (t[nrl][ncl]+ndl-NR_END));
548 free((FREE_ARG) (t[nrl]+ncl-NR_END));
549 free((FREE_ARG) (t+nrl-NR_END));
550}
551*/
552
553#ifdef __cplusplus
554} // namespace
555#endif
NRGLOBAL void nrerror()
unsigned long * lvector(long nl, long nh)
Definition: nrutil.c:53
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
#define NR_END
Definition: nrutil.c:6
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
#define FREE_ARG
Definition: nrutil.c:7
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