|
1 | 1 | #include <functional> |
2 | 2 | #include <limits> |
3 | | - |
| 3 | +#include <math.h> |
4 | 4 |
|
5 | 5 | #include "_transforms.h" |
6 | 6 | #include "mplutils.h" |
7 | 7 | #include "MPL_isnan.h" |
8 | 8 |
|
9 | | -#ifdef NUMARRAY |
10 | | -# include "numarray/arrayobject.h" |
11 | | -#else |
12 | | -# ifdef NUMERIC |
13 | | -# include "Numeric/arrayobject.h" |
14 | | -# else |
15 | | -# define PY_ARRAY_TYPES_PREFIX NumPy |
16 | | -# include "numpy/arrayobject.h" |
17 | | -# endif |
18 | | -#endif |
| 9 | + |
| 10 | +#include "numpy/arrayobject.h" |
| 11 | +#include "numpy/ufuncobject.h" |
| 12 | + |
| 13 | + |
| 14 | +bool skip_float(double x) { |
| 15 | + return !MPL_isnan64(x) && !isinf(x); |
| 16 | +} |
19 | 17 |
|
20 | 18 | Value::~Value() { |
21 | 19 | _VERBOSE("Value::~Value"); |
@@ -169,16 +167,17 @@ Interval::update(const Py::Tuple &args) { |
169 | 167 | double minx = _val1->val(); |
170 | 168 | double maxx = _val2->val(); |
171 | 169 |
|
| 170 | + |
| 171 | + |
172 | 172 | double thisval; |
173 | | - if (ignore) { |
174 | | - thisval = Py::Float(vals[0]); |
| 173 | + thisval = Py::Float(vals[0]); |
| 174 | + if (ignore) { |
175 | 175 | minx = thisval; |
176 | 176 | maxx = thisval; |
177 | 177 | } |
178 | 178 |
|
179 | 179 |
|
180 | 180 | for (size_t i=0; i<Nval; ++i) { |
181 | | - thisval = Py::Float(vals[i]); |
182 | 181 | if (thisval<minx) minx = thisval; |
183 | 182 | if (thisval>maxx) maxx = thisval; |
184 | 183 | _minpos->update(thisval); |
@@ -2403,28 +2402,11 @@ NonseparableTransformation::init_type() |
2403 | 2402 |
|
2404 | 2403 | extern "C" |
2405 | 2404 | DL_EXPORT(void) |
2406 | | -#ifdef NUMARRAY |
2407 | | - init_na_transforms(void) |
2408 | | -#else |
2409 | | -# ifdef NUMERIC |
2410 | | - init_nc_transforms(void) |
2411 | | -# else |
2412 | | - init_ns_transforms(void) |
2413 | | -# endif |
2414 | | -#endif |
| 2405 | +init_ns_transforms(void) |
2415 | 2406 | { |
2416 | 2407 | static _transforms_module* _transforms = new _transforms_module; |
2417 | 2408 |
|
2418 | | -#ifdef NUMARRAY |
2419 | | - _VERBOSE("init_na_transforms"); |
2420 | | -#else |
2421 | | -# ifdef NUMERIC |
2422 | | - _VERBOSE("init_nc_transforms"); |
2423 | | -# else |
2424 | 2409 | _VERBOSE("init_ns_transforms"); |
2425 | | -# endif |
2426 | | -#endif |
2427 | | - |
2428 | 2410 | import_array(); |
2429 | 2411 |
|
2430 | 2412 | Py::Dict d = _transforms->moduleDictionary(); |
|
0 commit comments