General Purpose Geodetic Library
SgMathSupport.h
Go to the documentation of this file.
1 /*
2  *
3  * This file is a part of Space Geodetic Library. The library is used by
4  * nuSolve, a part of CALC/SOLVE system, and designed to make analysis of
5  * geodetic VLBI observations.
6  * Copyright (C) 2010-2020 Sergei Bolotin.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef SG_MATH_DEFINITIONS_H
24 #define SG_MATH_DEFINITIONS_H
25 
26 
27 #include <math.h>
28 
29 
31 #ifndef RAD2DEG
32 #define RAD2DEG (180.0/M_PI)
33 #endif
35 #ifndef RAD2HR
36 #define RAD2HR (12.0 /M_PI)
37 #endif
39 #ifndef DEG2RAD
40 #define DEG2RAD (M_PI/180.0)
41 #endif
43 #ifndef HR2RAD
44 #define HR2RAD (M_PI/ 12.0)
45 #endif
47 #ifndef SEC2RAD
48 #define SEC2RAD (DEG2RAD/3600.0)
49 #endif
51 #ifndef RAD2SEC
52 #define RAD2SEC (RAD2DEG*3600.0)
53 #endif
55 #ifndef DAY2SEC
56 #define DAY2SEC (86400.0)
57 #endif
59 #ifndef RAD2MAS
60 #define RAD2MAS (RAD2SEC*1000.0)
61 #endif
63 #ifndef RAD2MS
64 #define RAD2MS (RAD2HR*3600.0*1000.0)
65 #endif
66 
67 
68 enum DIRECTION {X_AXIS=0, VERTICAL=0, Y_AXIS=1, EAST=1, Z_AXIS=2, NORTH=2};
69 
70 
71 inline double signum(const double x) {return x<0.0 ? -1.0 : 1.0;};
72 inline double cpsign(const double a1, const double a2) {return fabs(a1)*signum(a2);};// copysign(a1, a2)?
73 inline void swap(double &a1, double &a2) {double tmp=a1; a1=a2; a2=tmp;};
74 
75 
76 class Sg3dVector;
77 class Sg3dMatrix;
78 
79 
80 // these constants are defined in GPGeoMath3dVector.cpp:
81 extern const Sg3dVector v3Zero;
82 extern const Sg3dVector v3Unit;
83 
84 // these constants are defined in GPGeoMath3dMatrix.cpp:
85 extern const Sg3dMatrix m3E;
86 extern const Sg3dMatrix m3Zero;
87 
88 
89 // Fast Fourier transformation:
90 void fft(double *x, double *y, int n, int dir);
91 
92 
93 
94 
95 
96 
97 #endif //SG_MATH_DEFINITIONS_H
const Sg3dMatrix m3E
void swap(double &a1, double &a2)
Definition: SgMathSupport.h:73
const Sg3dMatrix m3Zero
double signum(const double x)
Definition: SgMathSupport.h:71
const Sg3dVector v3Unit
const Sg3dVector v3Zero
DIRECTION
Definition: SgMathSupport.h:68
@ VERTICAL
Definition: SgMathSupport.h:68
@ Z_AXIS
Definition: SgMathSupport.h:68
@ X_AXIS
Definition: SgMathSupport.h:68
@ Y_AXIS
Definition: SgMathSupport.h:68
@ EAST
Definition: SgMathSupport.h:68
@ NORTH
Definition: SgMathSupport.h:68
double cpsign(const double a1, const double a2)
Definition: SgMathSupport.h:72
void fft(double *x, double *y, int n, int dir)