UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Ymath.h
1 #if !defined(__N_Ymath_H_)
2 #define __N_Ymath_H_
3 
4 #include <xg_def.h>
5 
6 #ifndef MIN_MAX_
7 #define MIN_MAX_
8 #define MIN_(x,a) if(x > (a)) x = a
9 #define MAX_(x,a) if(x < (a)) x = a
10 #define Swap(x,y) (x ^= (y ^= (x ^= y)))
11 #define FtoI(a) ((a < 0) ? a-0.5 : a+0.5)
12 #define Zabs(a) ((a < 0) ? -a : a)
13 #define Sign(a) ((a < 0) ? -1 : 1)
14 #define max(a,b) (((a) > (b)) ? (a) : (b))
15 #define min(a,b) (((a) < (b)) ? (a) : (b))
16 #endif
17 #ifndef MEMCPDEF
18 #define MEMCPDEF
19 #define memcpy_(a,b,c) memcpy((char *)(a),(char *)(b),c)
20 #define memcmp_(a,b,c) memcmp((char *)(a),(char *)(b),c)
21 #define memset_(a,b,c) memset((char *)(a),b,c)
22 #endif
23 
24 #ifndef SHORT_DATA
25 #define SHORT_DATA 1
26 #define LONG_DATA 2
27 #define INT_DATA 2
28 #define REAL_DATA 3
29 #define FLOAT_DATA 3
30 #define DOUBLE_DATA 4
31 #define CHAR_DATA 5
32 #define NOT_IMAGE 0x10
33 #endif
34 typedef union {
35  int *i;
36  float *f;
37  short *s;
38  double *d;
39  } UN_DATA;
40 typedef struct {
41  double re,im;
42  } COMP_D;
43 typedef struct {
44  float re,im;
45  } COMP_F;
46 typedef struct {
47  int format; /* FLOAT, or DOUBLE_DATA */
48  short n2,BackFlag; /* BackFlag = (1 or 0) */
49  int n,NN; /* NN = 1<<n2; */
50  double coef;
51  COMP_F* Oz; /* Output Real Image data */
52  COMP_D* Ez;
53  } F_TRANSFORM;
54 
55 /***********************************************************************/
56 #ifdef _NO_PROTO_
57 
58 int InterpolFI();
59 double InterpolIF();
60 double InterpolFF();
61 int InterpolII();
62 int MultIntFloat();
63 int DivIntFloat();
64 void SwapShort();
65 void SwapInt();
66 int MiddleShort();
67 int mul_div();
68 int imul_div();
69 int SearchMaxShort();
70 char* FloatToStr();
71 double RoundFloat();
72 int FloatToInt();
73 int SearchMiddle();
74 int SearchMiddleB();
75 char* strUp();
76 char* GetDirName();
77 double DoubleSearchMiddle();
78 double ExactMiddle();
79 char* GetFileName();
80 char* GetArg();
81 char* strn_cpy();
82 #else
83 /*......................................................................*/
84 int InterpolFI(double x1,double x2,double x,int ind1,int ind2);
85 double InterpolIF(int x1,int x2,int x,double ind1,double ind2);
86 double InterpolFF(double x1,double x2,double x,double ind1,double ind2);
87 int InterpolII(int x1,int x2,int x,int ind1,int ind2);
88 int MultIntFloat(int i,double f);
89 int DivIntFloat(int i, double f);
90 void SwapShort(short* a,short* b);
91 void SwapInt(int* a,int* b);
92 int MiddleShort(short* m,int mi,int ma);
93 void ExtremumShort(short* zn,short* zmin,short* zmax,int n);
94 int mul_div(int a,int b,int c);
95 int imul_div(int a,int b,int c);
96 int SearchMaxShort(short* dat,int j1,int j2);
97 char* FloatToStr(double f,int n);
98 double RoundFloat(double f);
99 int FloatToInt(double f);
100 int SearchMiddle(short* arr,int x,int n1,int n2);
101 int SearchMiddleB(short* arr,int x,int* n1,int *n2,int *mm);
102 char* strUp(char* s);
103 char* GetDirName(char* name);
104 double DoubleSearchMiddle(void);
105 double ExactMiddle(double yl,double yu,double y);
106 int ExactMiddleInt(int yl,int yu,int y);
107 char* GetFileName(char*);
108 char* GetArg(char** args,int argc,char* name,int n);
109 char* strn_cpy(char* a,char* b,int len);
110 
111 #endif /* _NO_PROTO_ */
112 /************************************************************************/
113 extern double InterpolFloat;
114 #define DIRLENTH_ 128
115 #define FILELENTH_ 40
116 #define EXTLENTH_ 40
117 #define MAXLENTH_ (DIRLENTH_+FILELENTH_)
118 extern char DirName[];
119 extern char FileName[];
120 extern char ExtName[];
121 
122 #endif
Definition: Ymath.h:40
Definition: Ymath.h:43
Definition: Ymath.h:34
Definition: Ymath.h:46