1 #if defined(__STDC__) || defined(ANSI) || defined(NRANSI)	/* ANSI */
2 
3 #include <stdio.h>
4 #include <stddef.h>
5 #include <stdlib.h>
6 #define NR_END 1
7 #define FREE_ARG char*
8 
9 
10 
nrerror(const char * error_text)11 void nrerror(const char *error_text)
12 /* Numerical Recipes standard error handler */
13 {
14   fprintf(stderr, "Numerical Recipes run-time error...\n");
15   fprintf(stderr, "%s\n", error_text);
16   fprintf(stderr, "...now exiting to system...\n");
17   exit(1);
18 }
19 
20 // allocate a float vector with subscript range v[nl..nh]
fvector(long nl,long nh)21 float *fvector(long nl, long nh)
22 {
23   float *v;
24   v = (float *) malloc((size_t) ((nh - nl + 1 + NR_END) * sizeof(float)));
25   if (!v) nrerror("allocation failure in vector()");
26   return v - nl + NR_END;
27 }
28 
29 // allocate an int vector with subscript range v[nl..nh]
ivector(long nl,long nh)30 int *ivector(long nl, long nh)
31 {
32   int *v;
33   v = (int *) malloc((size_t) ((nh - nl + 1 + NR_END) * sizeof(int)));
34   if (!v)
35     nrerror("allocation failure in ivector()");
36   return v - nl + NR_END;
37 }
38 
39 // allocate an unsigned char vector with subscript range v[nl..nh]
cvector(long nl,long nh)40 unsigned char *cvector(long nl, long nh)
41 {
42   unsigned char *v;
43   v = (unsigned char *) malloc((size_t) ((nh - nl + 1 + NR_END) * sizeof(unsigned char)));
44   if (!v) nrerror("allocation failure in cvector()");
45   return v - nl + NR_END;
46 }
47 
48 // allocate an unsigned long vector with subscript range v[nl..nh]
lvector(long nl,long nh)49 unsigned long *lvector(long nl, long nh)
50 {
51   unsigned long *v;
52   v = (unsigned long *)  malloc((size_t) ((nh - nl + 1 + NR_END) * sizeof(long)));
53   if (!v) nrerror("allocation failure in lvector()");
54   return v - nl + NR_END;
55 }
56 
57 // allocate a double vector with subscript range v[nl..nh]
dvector(long nl,long nh)58 double *dvector(long nl, long nh)
59 {
60   double *v;
61   v = (double *) malloc((size_t) ((nh - nl + 1 + NR_END) * sizeof(double)));
62   if (!v) nrerror("allocation failure in dvector()");
63   return v - nl + NR_END;
64 }
65 
66 // allocate a float matrix with subscript range m[nrl..nrh][ncl..nch]
matrix(long nrl,long nrh,long ncl,long nch)67 float **matrix(long nrl, long nrh, long ncl, long nch)
68 {
69   long i, nrow = nrh - nrl + 1, ncol = nch - ncl + 1;
70   float **m;
71   /* allocate pointers to rows */
72   m = (float **) malloc((size_t) ((nrow + NR_END) * sizeof(float *)));
73   if (!m) nrerror("allocation failure 1 in matrix()");
74   m += NR_END;
75   m -= nrl;
76 
77   /* allocate rows and set pointers to them */
78   m[nrl] = (float *) malloc((size_t) ((nrow * ncol + NR_END) * sizeof(float)));
79   if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
80   m[nrl] += NR_END;
81   m[nrl] -= ncl;
82   for (i = nrl + 1; i <= nrh; i++) m[i] = m[i - 1] + ncol;
83   /* return pointer to array of pointers to rows */
84   return m;
85 }
86 
87 // allocate a double matrix with subscript range m[nrl..nrh][ncl..nch]
dmatrix(long nrl,long nrh,long ncl,long nch)88 double **dmatrix(long nrl, long nrh, long ncl, long nch)
89 {
90   long i, nrow = nrh - nrl + 1, ncol = nch - ncl + 1;
91   double **m;
92   /* allocate pointers to rows */
93   m = (double **) malloc((size_t) ((nrow + NR_END) * sizeof(double *)));
94   if (!m)
95     nrerror("allocation failure 1 in matrix()");
96   m += NR_END;
97   m -= nrl;
98 
99   /* allocate rows and set pointers to them */
100   m[nrl] =
101     (double *) malloc((size_t) ((nrow * ncol + NR_END) * sizeof(double)));
102   if (!m[nrl])
103     nrerror("allocation failure 2 in matrix()");
104   m[nrl] += NR_END;
105   m[nrl] -= ncl;
106   for (i = nrl + 1; i <= nrh; i++)
107     m[i] = m[i - 1] + ncol;
108 
109   /* return pointer to array of pointers to rows */
110   return m;
111 }
112 
113 
114 // allocate a int matrix with subscript range m[nrl..nrh][ncl..nch]
imatrix(long nrl,long nrh,long ncl,long nch)115 int **imatrix(long nrl, long nrh, long ncl, long nch)
116 {
117   long i, nrow = nrh - nrl + 1, ncol = nch - ncl + 1;
118   int **m;
119 
120 
121   /* allocate pointers to rows */
122   m = (int **) malloc((size_t) ((nrow + NR_END) * sizeof(int *)));
123   if (!m)
124     nrerror("allocation failure 1 in matrix()");
125   m += NR_END;
126   m -= nrl;
127 
128   /* allocate rows and set pointers to them */
129   m[nrl] = (int *) malloc((size_t) ((nrow * ncol + NR_END) * sizeof(int)));
130   if (!m[nrl])
131     nrerror("allocation failure 2 in matrix()");
132   m[nrl] += NR_END;
133   m[nrl] -= ncl;
134   for (i = nrl + 1; i <= nrh; i++)
135     m[i] = m[i - 1] + ncol;
136 
137   /* return pointer to array of pointers to rows */
138   return m;
139 }
submatrix(float ** a,long oldrl,long oldrh,long oldcl,long,long newrl,long newcl)140 float **submatrix(float **a, long oldrl, long oldrh, long oldcl, long ,long newrl, long newcl)
141 /* point a submatrix [newrl..][newcl..] to a[oldrl..oldrh][oldcl..oldch] */
142 {
143   long i, j, nrow = oldrh - oldrl + 1, ncol = oldcl - newcl;
144   float **m;
145 
146   /* allocate array of pointers to rows */
147   m = (float **) malloc((size_t) ((nrow + NR_END) * sizeof(float *)));
148   if (!m)
149     nrerror("allocation failure in submatrix()");
150   m += NR_END;
151   m -= newrl;
152 
153   /* set pointers to rows */
154   for (i = oldrl, j = newrl; i <= oldrh; i++, j++)
155     m[j] = a[i] + ncol;
156 
157   /* return pointer to array of pointers to rows */
158   return m;
159 }
convert_matrix(float * a,long nrl,long nrh,long ncl,long nch)160 float **convert_matrix(float *a, long nrl, long nrh, long ncl, long nch)
161 /* allocate a float matrix m[nrl..nrh][ncl..nch] that points to the matrix
162 declared in the standard C manner as a[nrow][ncol], where nrow=nrh-nrl+1
163 and ncol=nch-ncl+1. The routine should be called with the address
164 &a[0][0] as the first argument. */
165 {
166   long i, j, nrow = nrh - nrl + 1, ncol = nch - ncl + 1;
167   float **m;
168 
169 
170   /* allocate pointers to rows */
171   m = (float **) malloc((size_t) ((nrow + NR_END) * sizeof(float *)));
172   if (!m)
173     nrerror("allocation failure in convert_matrix()");
174   m += NR_END;
175   m -= nrl;
176 
177   /* set pointers to rows */
178   m[nrl] = a - ncl;
179   for (i = 1, j = nrl + 1; i < nrow; i++, j++)
180     m[j] = m[j - 1] + ncol;
181 
182   /* return pointer to array of pointers to rows */
183   return m;
184 }
f3tensor(long nrl,long nrh,long ncl,long nch,long ndl,long ndh)185 float ***f3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh)
186 /* allocate a float 3tensor with range t[nrl..nrh][ncl..nch][ndl..ndh] */
187 {
188   long i, j, nrow = nrh - nrl + 1, ncol = nch - ncl + 1, ndep = ndh - ndl + 1;
189   float ***t;
190 
191 
192   /* allocate pointers to pointers to rows */
193   t = (float ***) malloc((size_t) ((nrow + NR_END) * sizeof(float **)));
194   if (!t)
195     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] =
201     (float **) malloc((size_t) ((nrow * ncol + NR_END) * sizeof(float *)));
202   if (!t[nrl])
203     nrerror("allocation failure 2 in f3tensor()");
204   t[nrl] += NR_END;
205   t[nrl] -= ncl;
206 
207   /* allocate rows and set pointers to them */
208   t[nrl][ncl] =
209     (float *)
210     malloc((size_t) ((nrow * ncol * ndep + NR_END) * sizeof(float)));
211   if (!t[nrl][ncl])
212     nrerror("allocation failure 3 in f3tensor()");
213   t[nrl][ncl] += NR_END;
214   t[nrl][ncl] -= ndl;
215   for (j = ncl + 1; j <= nch; j++)
216     t[nrl][j] = t[nrl][j - 1] + ndep;
217   for (i = nrl + 1; i <= nrh; i++)
218     {
219       t[i] = t[i - 1] + ncol;
220       t[i][ncl] = t[i - 1][ncl] + ncol * ndep;
221       for (j = ncl + 1; j <= nch; j++)
222 	t[i][j] = t[i][j - 1] + ndep;
223     }
224 
225   /* return pointer to array of pointers to rows */
226   return t;
227 }
free_fvector(float * v,long nl,long)228 void free_fvector(float *v, long nl, long )
229 /* free a float vector allocated with vector() */
230 {
231   free((FREE_ARG) (v + nl - NR_END));
232 }
233 
free_ivector(int * v,long nl,long)234 void free_ivector(int *v, long nl, long )
235 /* free an int vector allocated with ivector() */
236 {
237   free((FREE_ARG) (v + nl - NR_END));
238 }
free_cvector(unsigned char * v,long nl,long)239 void free_cvector(unsigned char *v, long nl, long )
240 /* free an unsigned char vector allocated with cvector() */
241 {
242   free((FREE_ARG) (v + nl - NR_END));
243 }
244 
free_lvector(unsigned long * v,long nl,long)245 void free_lvector(unsigned long *v, long nl, long )
246 /* free an unsigned long vector allocated with lvector() */
247 {
248   free((FREE_ARG) (v + nl - NR_END));
249 }
250 
free_dvector(double * v,long nl,long)251 void free_dvector(double *v, long nl, long )
252 /* free a double vector allocated with dvector() */
253 {
254   free((FREE_ARG) (v + nl - NR_END));
255 }
256 
free_matrix(float ** m,long nrl,long,long ncl,long)257 void free_matrix(float **m, long nrl, long , long ncl, long )
258 /* free a float matrix allocated by matrix() */
259 {
260   free((FREE_ARG) (m[nrl] + ncl - NR_END));
261   free((FREE_ARG) (m + nrl - NR_END));
262 }
263 
free_dmatrix(double ** m,long nrl,long,long ncl,long)264 void free_dmatrix(double **m, long nrl, long , long ncl, long )
265 /* free a double matrix allocated by dmatrix() */
266 {
267   free((FREE_ARG) (m[nrl] + ncl - NR_END));
268   free((FREE_ARG) (m + nrl - NR_END));
269 }
270 
free_imatrix(int ** m,long nrl,long,long ncl,long)271 void free_imatrix(int **m, long nrl, long , long ncl, long )
272 /* free an int matrix allocated by imatrix() */
273 {
274   free((FREE_ARG) (m[nrl] + ncl - NR_END));
275   free((FREE_ARG) (m + nrl - NR_END));
276 }
277 
free_submatrix(float ** b,long nrl,long,long,long)278 void free_submatrix(float **b, long nrl, long , long , long )
279 /* free a submatrix allocated by submatrix() */
280 {
281   free((FREE_ARG) (b + nrl - NR_END));
282 }
283 
free_convert_matrix(float ** b,long nrl,long,long,long)284 void free_convert_matrix(float **b, long nrl, long , long , long )
285 /* free a matrix allocated by convert_matrix() */
286 {
287   free((FREE_ARG) (b + nrl - NR_END));
288 }
289 
free_f3tensor(float *** t,long nrl,long,long ncl,long,long ndl,long)290 void free_f3tensor(float ***t, long nrl, long , long ncl, long , long ndl,long )
291 /* free a float f3tensor allocated by f3tensor() */
292 {
293   free((FREE_ARG) (t[nrl][ncl] + ndl - NR_END));
294   free((FREE_ARG) (t[nrl] + ncl - NR_END));
295   free((FREE_ARG) (t + nrl - NR_END));
296 }
297 
298 #else /* ANSI */
299 
300 /* traditional - K&R */
301 
302 #include <stdio.h>
303 #define NR_END 1
304 #define FREE_ARG char*
305 void nrerror(error_text)
306      char error_text[];
307 
308 
309 
310 /* Numerical Recipes standard error handler */
311 {
312   void exit();
313 
314   fprintf(stderr, "Numerical Recipes run-time error...\n");
315   fprintf(stderr, "%s\n", error_text);
316   fprintf(stderr, "...now exiting to system...\n");
317   exit(1);
318 } float *vector(nl, nh)
319      long nh, nl;
320 
321 
322 
323 /* allocate a float vector with subscript range v[nl..nh] */
324 {
325   float *v;
326   v =
327     (float *) malloc((unsigned int) ((nh - nl + 1 + NR_END) * sizeof(float)));
328   if (!v)
329     nrerror("allocation failure in vector()");
330   return v - nl + NR_END;
331 }
332 
333 int *ivector(nl, nh)
334      long nh, nl;
335 
336 
337 
338 /* allocate an int vector with subscript range v[nl..nh] */
339 {
340   int *v;
341   v = (int *) malloc((unsigned int) ((nh - nl + 1 + NR_END) * sizeof(int)));
342   if (!v)
343     nrerror("allocation failure in ivector()");
344   return v - nl + NR_END;
345 }
346 unsigned char *cvector(nl, nh)
347      long nh, nl;
348 
349 
350 
351 /* allocate an unsigned char vector with subscript range v[nl..nh] */
352 {
353   unsigned char *v;
354   v =
355     (unsigned char *)
356     malloc((unsigned int) ((nh - nl + 1 + NR_END) * sizeof(unsigned char)));
357   if (!v)
358     nrerror("allocation failure in cvector()");
359   return v - nl + NR_END;
360 }
361 unsigned long *lvector(nl, nh)
362      long nh, nl;
363 
364 
365 
366 /* allocate an unsigned long vector with subscript range v[nl..nh] */
367 {
368   unsigned long *v;
369   v =
370     (unsigned long *)
371     malloc((unsigned int) ((nh - nl + 1 + NR_END) * sizeof(long)));
372   if (!v)
373     nrerror("allocation failure in lvector()");
374   return v - nl + NR_END;
375 }
376 
377 double *dvector(nl, nh)
378      long nh, nl;
379 
380 
381 
382 /* allocate a double vector with subscript range v[nl..nh] */
383 {
384   double *v;
385   v =
386     (double *)
387     malloc((unsigned int) ((nh - nl + 1 + NR_END) * sizeof(double)));
388   if (!v)
389     nrerror("allocation failure in dvector()");
390   return v - nl + NR_END;
391 }
392 
393 float **matrix(nrl, nrh, ncl, nch)
394      long nch, ncl, nrh, nrl;
395 
396 
397 
398 /* allocate a float matrix with subscript range m[nrl..nrh][ncl..nch] */
399 {
400   long i, nrow = nrh - nrl + 1, ncol = nch - ncl + 1;
401   float **m;
402 
403 
404   /* allocate pointers to rows */
405   m = (float **) malloc((unsigned int) ((nrow + NR_END) * sizeof(float *)));
406   if (!m)
407     nrerror("allocation failure 1 in matrix()");
408   m += NR_END;
409   m -= nrl;
410 
411   /* allocate rows and set pointers to them */
412   m[nrl] =
413     (float *) malloc((unsigned int) ((nrow * ncol + NR_END) * sizeof(float)));
414   if (!m[nrl])
415     nrerror("allocation failure 2 in matrix()");
416   m[nrl] += NR_END;
417   m[nrl] -= ncl;
418   for (i = nrl + 1; i <= nrh; i++)
419     m[i] = m[i - 1] + ncol;
420 
421   /* return pointer to array of pointers to rows */
422   return m;
423 }
424 
425 double **dmatrix(nrl, nrh, ncl, nch)
426      long nch, ncl, nrh, nrl;
427 
428 
429 
430 /* allocate a double matrix with subscript range m[nrl..nrh][ncl..nch] */
431 {
432   long i, nrow = nrh - nrl + 1, ncol = nch - ncl + 1;
433   double **m;
434 
435 
436   /* allocate pointers to rows */
437   m = (double **) malloc((unsigned int) ((nrow + NR_END) * sizeof(double *)));
438   if (!m)
439     nrerror("allocation failure 1 in matrix()");
440   m += NR_END;
441   m -= nrl;
442 
443   /* allocate rows and set pointers to them */
444   m[nrl] =
445     (double *)
446     malloc((unsigned int) ((nrow * ncol + NR_END) * sizeof(double)));
447   if (!m[nrl])
448     nrerror("allocation failure 2 in matrix()");
449   m[nrl] += NR_END;
450   m[nrl] -= ncl;
451   for (i = nrl + 1; i <= nrh; i++)
452     m[i] = m[i - 1] + ncol;
453 
454   /* return pointer to array of pointers to rows */
455   return m;
456 }
457 
458 int **imatrix(nrl, nrh, ncl, nch)
459      long nch, ncl, nrh, nrl;
460 
461 
462 
463 /* allocate a int matrix with subscript range m[nrl..nrh][ncl..nch] */
464 {
465   long i, nrow = nrh - nrl + 1, ncol = nch - ncl + 1;
466   int **m;
467 
468 
469   /* allocate pointers to rows */
470   m = (int **) malloc((unsigned int) ((nrow + NR_END) * sizeof(int *)));
471   if (!m)
472     nrerror("allocation failure 1 in matrix()");
473   m += NR_END;
474   m -= nrl;
475 
476   /* allocate rows and set pointers to them */
477   m[nrl] =
478     (int *) malloc((unsigned int) ((nrow * ncol + NR_END) * sizeof(int)));
479   if (!m[nrl])
480     nrerror("allocation failure 2 in matrix()");
481   m[nrl] += NR_END;
482   m[nrl] -= ncl;
483   for (i = nrl + 1; i <= nrh; i++)
484     m[i] = m[i - 1] + ncol;
485 
486   /* return pointer to array of pointers to rows */
487   return m;
488 }
489 
490 float **submatrix(a, oldrl, oldrh, oldcl, oldch, newrl, newcl)
491      float **a;
492      long newcl, newrl, oldch, oldcl, oldrh, oldrl;
493 
494 
495 
496 /* point a submatrix [newrl..][newcl..] to a[oldrl..oldrh][oldcl..oldch] */
497 {
498   long i, j, nrow = oldrh - oldrl + 1, ncol = oldcl - newcl;
499   float **m;
500 
501 
502   /* allocate array of pointers to rows */
503   m = (float **) malloc((unsigned int) ((nrow + NR_END) * sizeof(float *)));
504   if (!m)
505     nrerror("allocation failure in submatrix()");
506   m += NR_END;
507   m -= newrl;
508 
509   /* set pointers to rows */
510   for (i = oldrl, j = newrl; i <= oldrh; i++, j++)
511     m[j] = a[i] + ncol;
512 
513   /* return pointer to array of pointers to rows */
514   return m;
515 }
516 
517 float **convert_matrix(a, nrl, nrh, ncl, nch)
518      float *a;
519      long nch, ncl, nrh, nrl;
520 
521 
522 
523 /* allocate a float matrix m[nrl..nrh][ncl..nch] that points to the matrix
524 declared in the standard C manner as a[nrow][ncol], where nrow=nrh-nrl+1
525 and ncol=nch-ncl+1. The routine should be called with the address
526 &a[0][0] as the first argument. */
527 {
528   long i, j, nrow = nrh - nrl + 1, ncol = nch - ncl + 1;
529   float **m;
530 
531 
532   /* allocate pointers to rows */
533   m = (float **) malloc((unsigned int) ((nrow + NR_END) * sizeof(float *)));
534   if (!m)
535     nrerror("allocation failure in convert_matrix()");
536   m += NR_END;
537   m -= nrl;
538 
539   /* set pointers to rows */
540   m[nrl] = a - ncl;
541   for (i = 1, j = nrl + 1; i < nrow; i++, j++)
542     m[j] = m[j - 1] + ncol;
543 
544   /* return pointer to array of pointers to rows */
545   return m;
546 }
547 
548 float ***f3tensor(nrl, nrh, ncl, nch, ndl, ndh)
549      long nch, ncl, ndh, ndl, nrh, nrl;
550 
551 
552 
553 /* allocate a float 3tensor with range t[nrl..nrh][ncl..nch][ndl..ndh] */
554 {
555   long i, j, nrow = nrh - nrl + 1, ncol = nch - ncl + 1, ndep = ndh - ndl + 1;
556   float ***t;
557 
558 
559   /* allocate pointers to pointers to rows */
560   t = (float ***) malloc((unsigned int) ((nrow + NR_END) * sizeof(float **)));
561   if (!t)
562     nrerror("allocation failure 1 in f3tensor()");
563   t += NR_END;
564   t -= nrl;
565 
566   /* allocate pointers to rows and set pointers to them */
567   t[nrl] =
568     (float **)
569     malloc((unsigned int) ((nrow * ncol + NR_END) * sizeof(float *)));
570   if (!t[nrl])
571     nrerror("allocation failure 2 in f3tensor()");
572   t[nrl] += NR_END;
573   t[nrl] -= ncl;
574 
575   /* allocate rows and set pointers to them */
576   t[nrl][ncl] =
577     (float *)
578     malloc((unsigned int) ((nrow * ncol * ndep + NR_END) * sizeof(float)));
579   if (!t[nrl][ncl])
580     nrerror("allocation failure 3 in f3tensor()");
581   t[nrl][ncl] += NR_END;
582   t[nrl][ncl] -= ndl;
583   for (j = ncl + 1; j <= nch; j++)
584     t[nrl][j] = t[nrl][j - 1] + ndep;
585   for (i = nrl + 1; i <= nrh; i++)
586     {
587       t[i] = t[i - 1] + ncol;
588       t[i][ncl] = t[i - 1][ncl] + ncol * ndep;
589       for (j = ncl + 1; j <= nch; j++)
590 	t[i][j] = t[i][j - 1] + ndep;
591     }
592 
593   /* return pointer to array of pointers to rows */
594   return t;
595 }
596 
597 void free_vector(v, nl, nh)
598      float *v;
599      long nh, nl;
600 
601 
602 
603 /* free a float vector allocated with vector() */
604 {
605   free((FREE_ARG) (v + nl - NR_END));
606 } void free_ivector(v, nl, nh)
607      int *v;
608      long nh, nl;
609 
610 
611 
612 /* free an int vector allocated with ivector() */
613 {
614   free((FREE_ARG) (v + nl - NR_END));
615 } void free_cvector(v, nl, nh)
616      long nh, nl;
617      unsigned char *v;
618 
619 
620 
621 /* free an unsigned char vector allocated with cvector() */
622 {
623   free((FREE_ARG) (v + nl - NR_END));
624 } void free_lvector(v, nl, nh)
625      long nh, nl;
626      unsigned long *v;
627 
628 
629 
630 /* free an unsigned long vector allocated with lvector() */
631 {
632   free((FREE_ARG) (v + nl - NR_END));
633 } void free_dvector(v, nl, nh)
634      double *v;
635      long nh, nl;
636 
637 
638 
639 /* free a double vector allocated with dvector() */
640 {
641   free((FREE_ARG) (v + nl - NR_END));
642 } void free_matrix(m, nrl, nrh, ncl, nch)
643      float **m;
644      long nch, ncl, nrh, nrl;
645 
646 
647 
648 /* free a float matrix allocated by matrix() */
649 {
650   free((FREE_ARG) (m[nrl] + ncl - NR_END));
651   free((FREE_ARG) (m + nrl - NR_END));
652 } void free_dmatrix(m, nrl, nrh, ncl, nch)
653      double **m;
654      long nch, ncl, nrh, nrl;
655 
656 
657 
658 /* free a double matrix allocated by dmatrix() */
659 {
660   free((FREE_ARG) (m[nrl] + ncl - NR_END));
661   free((FREE_ARG) (m + nrl - NR_END));
662 } void free_imatrix(m, nrl, nrh, ncl, nch)
663      int **m;
664      long nch, ncl, nrh, nrl;
665 
666 
667 
668 /* free an int matrix allocated by imatrix() */
669 {
670   free((FREE_ARG) (m[nrl] + ncl - NR_END));
671   free((FREE_ARG) (m + nrl - NR_END));
672 } void free_submatrix(b, nrl, nrh, ncl, nch)
673      float **b;
674      long nch, ncl, nrh, nrl;
675 
676 
677 
678 /* free a submatrix allocated by submatrix() */
679 {
680   free((FREE_ARG) (b + nrl - NR_END));
681 } void free_convert_matrix(b, nrl, nrh, ncl, nch)
682      float **b;
683      long nch, ncl, nrh, nrl;
684 
685 
686 
687 /* free a matrix allocated by convert_matrix() */
688 {
689   free((FREE_ARG) (b + nrl - NR_END));
690 } void free_f3tensor(t, nrl, nrh, ncl, nch, ndl, ndh)
691      float ***t;
692      long nch, ncl, ndh, ndl, nrh, nrl;
693 
694 
695 
696 /* free a float f3tensor allocated by f3tensor() */
697 {
698   free((FREE_ARG) (t[nrl][ncl] + ndl - NR_END));
699   free((FREE_ARG) (t[nrl] + ncl - NR_END));
700   free((FREE_ARG) (t + nrl - NR_END));
701 }
702 #endif /* ANSI */
703