]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | CMakeLists.txt | 2 ++ |
2 | itpp/base/algebra/eigen.cpp | 1 + | |
3 | itpp/base/algebra/ls_solve.cpp | 2 +- | |
4 | itpp/base/algebra/qr.cpp | 1 + | |
5 | itpp/base/algebra/svd.cpp | 2 +- | |
6 | itpp/base/bessel/gamma.cpp | 5 +++++ | |
7 | itpp/base/itcompat.cpp | 11 ++++++++++- | |
8 | itpp/base/itcompat.h | 14 ++++++++++++-- | |
9 | itpp/base/matfunc.h | 1 + | |
10 | itpp/base/svec.h | 1 + | |
11 | itpp/comm/siso_dem.cpp | 6 ++++++ | |
12 | itpp/comm/siso_eq.cpp | 6 ++++++ | |
13 | itpp/comm/siso_mud.cpp | 7 +++++++ | |
14 | itpp/comm/siso_nsc.cpp | 6 ++++++ | |
15 | itpp/comm/siso_rsc.cpp | 7 +++++++ | |
16 | 15 files changed, 67 insertions(+), 5 deletions(-) | |
17 | ||
18 | diff --git a/CMakeLists.txt b/CMakeLists.txt | |
19 | index 9f6a9a6..2360f86 100644 | |
20 | --- a/CMakeLists.txt | |
21 | +++ b/CMakeLists.txt | |
22 | @@ -122,7 +122,9 @@ CHECK_CXX_SYMBOL_EXISTS ( isnan "cmath" HAVE_DECL_ISNAN ) | |
23 | CHECK_CXX_SYMBOL_EXISTS ( signgam "cmath" HAVE_DECL_SIGNGAM ) | |
24 | ||
25 | #check for functions | |
26 | +if( NOT MSVC ) | |
27 | set(CMAKE_REQUIRED_LIBRARIES m) | |
28 | +endif() | |
29 | include (CheckFunctionExists) | |
30 | CHECK_FUNCTION_EXISTS ( acosh HAVE_ACOSH ) | |
31 | CHECK_FUNCTION_EXISTS ( asinh HAVE_ASINH ) | |
32 | diff --git a/itpp/base/algebra/eigen.cpp b/itpp/base/algebra/eigen.cpp | |
33 | index 8c0c36b..54ae3e1 100644 | |
34 | --- a/itpp/base/algebra/eigen.cpp | |
35 | +++ b/itpp/base/algebra/eigen.cpp | |
36 | @@ -39,6 +39,7 @@ | |
37 | #include <itpp/base/algebra/eigen.h> | |
38 | #include <itpp/base/converters.h> | |
39 | ||
40 | +#include <algorithm> | |
41 | ||
42 | namespace itpp | |
43 | { | |
44 | diff --git a/itpp/base/algebra/ls_solve.cpp b/itpp/base/algebra/ls_solve.cpp | |
45 | index dae38fc..95abf0a 100644 | |
46 | --- a/itpp/base/algebra/ls_solve.cpp | |
47 | +++ b/itpp/base/algebra/ls_solve.cpp | |
48 | @@ -37,7 +37,7 @@ | |
49 | #endif | |
50 | ||
51 | #include <itpp/base/algebra/ls_solve.h> | |
52 | - | |
53 | +#include <algorithm> | |
54 | ||
55 | namespace itpp | |
56 | { | |
57 | diff --git a/itpp/base/algebra/qr.cpp b/itpp/base/algebra/qr.cpp | |
58 | index 91dfb2b..0b47294 100644 | |
59 | --- a/itpp/base/algebra/qr.cpp | |
60 | +++ b/itpp/base/algebra/qr.cpp | |
61 | @@ -39,6 +39,7 @@ | |
62 | #include <itpp/base/algebra/qr.h> | |
63 | #include <itpp/base/specmat.h> | |
64 | ||
65 | +#include <algorithm> | |
66 | ||
67 | namespace itpp | |
68 | { | |
69 | diff --git a/itpp/base/algebra/svd.cpp b/itpp/base/algebra/svd.cpp | |
70 | index aa21e36..b2e499c 100644 | |
71 | --- a/itpp/base/algebra/svd.cpp | |
72 | +++ b/itpp/base/algebra/svd.cpp | |
73 | @@ -37,7 +37,7 @@ | |
74 | #endif | |
75 | ||
76 | #include <itpp/base/algebra/svd.h> | |
77 | - | |
78 | +#include <algorithm> | |
79 | ||
80 | namespace itpp | |
81 | { | |
82 | diff --git a/itpp/base/bessel/gamma.cpp b/itpp/base/bessel/gamma.cpp | |
83 | index 162c4ae..9405507 100644 | |
84 | --- a/itpp/base/bessel/gamma.cpp | |
85 | +++ b/itpp/base/bessel/gamma.cpp | |
86 | @@ -34,6 +34,11 @@ | |
87 | #include <itpp/base/itcompat.h> | |
88 | #include <itpp/base/math/misc.h> | |
89 | ||
90 | +#if _MSC_VER | |
91 | +//suppress warnings regarding the use infinity in fp arithmetic | |
92 | +#pragma warning(disable: 4056) | |
93 | +#pragma warning(disable: 4756) | |
94 | +#endif | |
95 | ||
96 | /* | |
97 | * Gamma function | |
98 | diff --git a/itpp/base/itcompat.cpp b/itpp/base/itcompat.cpp | |
99 | index f99ec81..aa34b28 100644 | |
100 | --- a/itpp/base/itcompat.cpp | |
101 | +++ b/itpp/base/itcompat.cpp | |
102 | @@ -47,12 +47,21 @@ double tgamma(double x) | |
103 | } | |
104 | #endif | |
105 | ||
106 | -#if !defined(HAVE_LGAMMA) || (HAVE_DECL_SIGNGAM != 1) | |
107 | +#if !defined(HAVE_LGAMMA) && (HAVE_DECL_SIGNGAM != 1) | |
108 | // The sign of the Gamma function is returned in the external integer | |
109 | // signgam declared in <math.h>. It is 1 when the Gamma function is positive | |
110 | // or zero, -1 when it is negative. However, MinGW definition of lgamma() | |
111 | // function does not use the global signgam variable. | |
112 | +//May 3rd 2015 (Andy Panov): | |
113 | +//Nonetheless, I guess it would be smarter not to break the ODR rule and not to provide our own definition of lgamma | |
114 | +//function when HAVE_LGAMMA is defined. If we still provide the definition, two definitions | |
115 | +//of the same function will exist in the program (this is undefined behaviour, as C++ standard says), | |
116 | +//so we can not ensure linker will choose our definition and user's code will work as expected. | |
117 | +//I guess, error message from linker regarding the unresolved symbol is much better option, | |
118 | +//since it clearly points to the math library limitations. Otherwise user can get a malfunctioning program | |
119 | +//with really subtle error. | |
120 | int signgam; | |
121 | + | |
122 | // Logarithm of an absolute value of gamma function | |
123 | double lgamma(double x) | |
124 | { | |
125 | diff --git a/itpp/base/itcompat.h b/itpp/base/itcompat.h | |
126 | index e6be223..dcf2ed7 100644 | |
127 | --- a/itpp/base/itcompat.h | |
128 | +++ b/itpp/base/itcompat.h | |
129 | @@ -41,8 +41,12 @@ | |
130 | #if defined(_MSC_VER) | |
131 | # include <cfloat> | |
132 | # define finite(x) _finite(x) | |
133 | +#ifndef HAVE_STD_ISFINITE | |
134 | # define isfinite(x) _finite(x) | |
135 | +#endif | |
136 | +#ifndef HAVE_STD_ISNAN | |
137 | # define isnan(x) _isnan(x) | |
138 | +#endif | |
139 | # define fpclass(x) _fpclass(x) | |
140 | # define FP_NINF _FPCLASS_NINF | |
141 | # define FP_PINF _FPCLASS_PINF | |
142 | @@ -119,13 +123,19 @@ inline bool isfinite(double x) | |
143 | double tgamma(double x); | |
144 | #endif | |
145 | ||
146 | -#if !defined(HAVE_LGAMMA) || (HAVE_DECL_SIGNGAM != 1) | |
147 | +#if !defined(HAVE_LGAMMA) && (HAVE_DECL_SIGNGAM != 1) | |
148 | +//Provide own definitions if both conditions are met: | |
149 | +//-lgammma is not defined | |
150 | +//-signgam was not found | |
151 | +//See ODR desicussion in itcompat.cpp | |
152 | + | |
153 | //! Lograrithm of an absolute gamma function | |
154 | double lgamma(double x); | |
155 | //! Global variable needed by \c lgamma function | |
156 | extern int signgam; | |
157 | #endif | |
158 | ||
159 | + | |
160 | #ifndef HAVE_CBRT | |
161 | //! Cubic root | |
162 | double cbrt(double x); | |
163 | @@ -141,7 +151,7 @@ inline double log1p(double x) { return std::log(1.0 + x); } | |
164 | //! Base-2 logarithm | |
165 | inline double log2(double x) | |
166 | { | |
167 | - static const double one_over_log2 = 1.0 / std::log(2.0); | |
168 | + const double one_over_log2 = 1.0 / std::log(2.0); | |
169 | return std::log(x) * one_over_log2; | |
170 | } | |
171 | #endif | |
172 | diff --git a/itpp/base/matfunc.h b/itpp/base/matfunc.h | |
173 | index 8ae683e..60cf95f 100644 | |
174 | --- a/itpp/base/matfunc.h | |
175 | +++ b/itpp/base/matfunc.h | |
176 | @@ -36,6 +36,7 @@ | |
177 | #include <itpp/base/algebra/inv.h> | |
178 | #include <itpp/base/algebra/svd.h> | |
179 | #include <itpp/itexports.h> | |
180 | +#include <algorithm> | |
181 | ||
182 | namespace itpp | |
183 | { | |
184 | diff --git a/itpp/base/svec.h b/itpp/base/svec.h | |
185 | index d105b2f..3a2c15b 100644 | |
186 | --- a/itpp/base/svec.h | |
187 | +++ b/itpp/base/svec.h | |
188 | @@ -33,6 +33,7 @@ | |
189 | #include <itpp/base/math/min_max.h> | |
190 | #include <cstdlib> | |
191 | #include <itpp/itexports.h> | |
192 | +#include <algorithm> | |
193 | ||
194 | namespace itpp | |
195 | { | |
196 | diff --git a/itpp/comm/siso_dem.cpp b/itpp/comm/siso_dem.cpp | |
197 | index 666f38c..4fa03fd 100644 | |
198 | --- a/itpp/comm/siso_dem.cpp | |
199 | +++ b/itpp/comm/siso_dem.cpp | |
200 | @@ -32,6 +32,12 @@ | |
201 | #define INFINITY std::numeric_limits<double>::infinity() | |
202 | #endif | |
203 | ||
204 | +#if _MSC_VER | |
205 | +//suppress warnings regarding the use infinity in fp arithmetic | |
206 | +#pragma warning(disable: 4056) | |
207 | +#endif | |
208 | + | |
209 | + | |
210 | namespace itpp | |
211 | { | |
212 | void SISO::find_half_const(int &select_half, itpp::vec &re_part, itpp::bmat &re_bin_part, itpp::vec &im_part, itpp::bmat &im_bin_part) | |
213 | diff --git a/itpp/comm/siso_eq.cpp b/itpp/comm/siso_eq.cpp | |
214 | index 856c01a..6553b33 100644 | |
215 | --- a/itpp/comm/siso_eq.cpp | |
216 | +++ b/itpp/comm/siso_eq.cpp | |
217 | @@ -32,6 +32,12 @@ | |
218 | #define INFINITY std::numeric_limits<double>::infinity() | |
219 | #endif | |
220 | ||
221 | +#if _MSC_VER | |
222 | +//suppress warnings regarding the use infinity in fp arithmetic | |
223 | +#pragma warning(disable: 4056) | |
224 | +#pragma warning(disable: 4756) | |
225 | +#endif | |
226 | + | |
227 | namespace itpp | |
228 | { | |
229 | void SISO::gen_chtrellis(void) | |
230 | diff --git a/itpp/comm/siso_mud.cpp b/itpp/comm/siso_mud.cpp | |
231 | index 60aa6d3..a7ff735 100644 | |
232 | --- a/itpp/comm/siso_mud.cpp | |
233 | +++ b/itpp/comm/siso_mud.cpp | |
234 | @@ -32,6 +32,13 @@ | |
235 | #define INFINITY std::numeric_limits<double>::infinity() | |
236 | #endif | |
237 | ||
238 | +#if _MSC_VER | |
239 | +//suppress warnings regarding the use infinity in fp arithmetic | |
240 | +#pragma warning(disable: 4056) | |
241 | +#pragma warning(disable: 4756) | |
242 | +#endif | |
243 | + | |
244 | + | |
245 | namespace itpp | |
246 | { | |
247 | void SISO::descrambler(itpp::vec &extrinsic_coded, itpp::vec &extrinsic_data, const itpp::vec &intrinsic_coded, const itpp::vec &apriori_data) | |
248 | diff --git a/itpp/comm/siso_nsc.cpp b/itpp/comm/siso_nsc.cpp | |
249 | index ca7d19a..12ca62a 100644 | |
250 | --- a/itpp/comm/siso_nsc.cpp | |
251 | +++ b/itpp/comm/siso_nsc.cpp | |
252 | @@ -33,6 +33,12 @@ | |
253 | #define INFINITY std::numeric_limits<double>::infinity() | |
254 | #endif | |
255 | ||
256 | +#if _MSC_VER | |
257 | +//suppress warnings regarding the use infinity in fp arithmetic | |
258 | +#pragma warning(disable: 4056) | |
259 | +#pragma warning(disable: 4756) | |
260 | +#endif | |
261 | + | |
262 | namespace itpp | |
263 | { | |
264 | void SISO::gen_nsctrellis(void) | |
265 | diff --git a/itpp/comm/siso_rsc.cpp b/itpp/comm/siso_rsc.cpp | |
266 | index e5003c7..9e3eea1 100644 | |
267 | --- a/itpp/comm/siso_rsc.cpp | |
268 | +++ b/itpp/comm/siso_rsc.cpp | |
269 | @@ -29,6 +29,13 @@ | |
270 | #include <itpp/comm/siso.h> | |
271 | #include <itpp/base/itcompat.h> | |
272 | #include <limits> | |
273 | + | |
274 | +#if _MSC_VER | |
275 | +//suppress warnings regarding the use infinity in fp arithmetic | |
276 | +#pragma warning(disable: 4056) | |
277 | +#pragma warning(disable: 4756) | |
278 | +#endif | |
279 | + | |
280 | #ifndef INFINITY | |
281 | #define INFINITY std::numeric_limits<double>::infinity() | |
282 | #endif | |
283 | ||
284 | #Remove this patch if the source has fixed these issues. |