nrutil.h

Go to the documentation of this file.
00001 #ifndef _NR_UTILS_H_
00002 #define _NR_UTILS_H_
00003 
00004 static inline float SQR(float a)
00005 {
00006   return (a == 0.0 ? 0.0 : a*a);
00007 }
00008 
00009 static inline double DSQR(double a)
00010 {
00011   return (a == 0.0 ? 0.0 : a*a);
00012 }
00013 
00014 static inline double DMAX(double a,  double b)
00015 {
00016   return (a > b ? a : b);
00017 }
00018 
00019 static inline double DMIN(double a,  double b)
00020 {
00021   return (a < b ? a : b);
00022 }
00023 
00024 static inline float FMAX(float a, float b)
00025 {
00026   return (a > b ? a : b);
00027 }
00028 
00029 static inline float FMIN(float a, float b)
00030 {
00031   return (a < b ? a : b);
00032 }
00033 
00034 static inline long LMAX(long a, long b)
00035 {
00036   return (a > b ? a : b);
00037 }
00038 
00039 static inline long LMIN(long a, long b)
00040 {
00041   return (a < b ? a : b);
00042 }
00043 
00044 static inline int IMAX(int a, int b)
00045 {
00046   return (a > b ? a : b);
00047 }
00048 
00049 static inline int IMIN(int a, int b)
00050 {
00051   return (a < b ? a : b);
00052 }
00053 
00054 #define SIGN(a,b) ((b) >= 0.0 ? fabs(a) : -fabs(a))
00055 
00056 #if defined(__STDC__) || defined(ANSI) || defined(NRANSI) /* ANSI */
00057 
00058 void nrerror(char error_text[]);
00059 float *vector(long nl, long nh);
00060 int *ivector(long nl, long nh);
00061 unsigned char *cvector(long nl, long nh);
00062 unsigned long *lvector(long nl, long nh);
00063 double *dvector(long nl, long nh);
00064 float **matrix(long nrl, long nrh, long ncl, long nch);
00065 double **dmatrix(long nrl, long nrh, long ncl, long nch);
00066 int **imatrix(long nrl, long nrh, long ncl, long nch);
00067 float **submatrix(float **a, long oldrl, long oldrh, long oldcl, long oldch,
00068         long newrl, long newcl);
00069 float **convert_matrix(float *a, long nrl, long nrh, long ncl, long nch);
00070 float ***f3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh);
00071 void free_vector(float *v, long nl, long nh);
00072 void free_ivector(int *v, long nl, long nh);
00073 void free_cvector(unsigned char *v, long nl, long nh);
00074 void free_lvector(unsigned long *v, long nl, long nh);
00075 void free_dvector(double *v, long nl, long nh);
00076 void free_matrix(float **m, long nrl, long nrh, long ncl, long nch);
00077 void free_dmatrix(double **m, long nrl, long nrh, long ncl, long nch);
00078 void free_imatrix(int **m, long nrl, long nrh, long ncl, long nch);
00079 void free_submatrix(float **b, long nrl, long nrh, long ncl, long nch);
00080 void free_convert_matrix(float **b, long nrl, long nrh, long ncl, long nch);
00081 void free_f3tensor(float ***t, long nrl, long nrh, long ncl, long nch,
00082         long ndl, long ndh);
00083 
00084 #else /* ANSI */
00085 /* traditional - K&R */
00086 
00087 void nrerror();
00088 float *vector();
00089 float **matrix();
00090 float **submatrix();
00091 float **convert_matrix();
00092 float ***f3tensor();
00093 double *dvector();
00094 double **dmatrix();
00095 int *ivector();
00096 int **imatrix();
00097 unsigned char *cvector();
00098 unsigned long *lvector();
00099 void free_vector();
00100 void free_dvector();
00101 void free_ivector();
00102 void free_cvector();
00103 void free_lvector();
00104 void free_matrix();
00105 void free_submatrix();
00106 void free_convert_matrix();
00107 void free_dmatrix();
00108 void free_imatrix();
00109 void free_f3tensor();
00110 
00111 #endif /* ANSI */
00112 
00113 #endif /* _NR_UTILS_H_ */

Generated on Mon Jun 5 15:35:17 2006 for WsaTools by  doxygen 1.4.5