|
1 | 1 | # cython: profile=False
|
2 | 2 | # cython: boundscheck=False, wraparound=False, cdivision=True
|
3 | 3 |
|
4 |
| -from numpy cimport * |
| 4 | +from cython cimport Py_ssize_t |
| 5 | + |
5 | 6 | cimport numpy as np
|
6 | 7 | import numpy as np
|
7 | 8 |
|
8 | 9 | cimport cython
|
9 | 10 |
|
10 |
| -import_array() |
| 11 | +np.import_array() |
11 | 12 |
|
12 | 13 | cimport util
|
13 | 14 |
|
14 | 15 | from libc.stdlib cimport malloc, free
|
15 | 16 |
|
16 |
| -from numpy cimport NPY_INT8 as NPY_int8 |
17 |
| -from numpy cimport NPY_INT16 as NPY_int16 |
18 |
| -from numpy cimport NPY_INT32 as NPY_int32 |
19 |
| -from numpy cimport NPY_INT64 as NPY_int64 |
20 |
| -from numpy cimport NPY_FLOAT16 as NPY_float16 |
21 |
| -from numpy cimport NPY_FLOAT32 as NPY_float32 |
22 |
| -from numpy cimport NPY_FLOAT64 as NPY_float64 |
23 |
| - |
24 |
| -from numpy cimport (int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, |
25 |
| - uint32_t, uint64_t, float16_t, float32_t, float64_t) |
26 |
| - |
27 |
| -int8 = np.dtype(np.int8) |
28 |
| -int16 = np.dtype(np.int16) |
29 |
| -int32 = np.dtype(np.int32) |
30 |
| -int64 = np.dtype(np.int64) |
31 |
| -float16 = np.dtype(np.float16) |
32 |
| -float32 = np.dtype(np.float32) |
33 |
| -float64 = np.dtype(np.float64) |
34 |
| - |
35 |
| -cdef np.int8_t MINint8 = np.iinfo(np.int8).min |
36 |
| -cdef np.int16_t MINint16 = np.iinfo(np.int16).min |
37 |
| -cdef np.int32_t MINint32 = np.iinfo(np.int32).min |
38 |
| -cdef np.int64_t MINint64 = np.iinfo(np.int64).min |
39 |
| -cdef np.float16_t MINfloat16 = np.NINF |
| 17 | + |
| 18 | +from numpy cimport ndarray, double_t, int64_t, float64_t |
| 19 | + |
40 | 20 | cdef np.float32_t MINfloat32 = np.NINF
|
41 | 21 | cdef np.float64_t MINfloat64 = np.NINF
|
42 | 22 |
|
43 |
| -cdef np.int8_t MAXint8 = np.iinfo(np.int8).max |
44 |
| -cdef np.int16_t MAXint16 = np.iinfo(np.int16).max |
45 |
| -cdef np.int32_t MAXint32 = np.iinfo(np.int32).max |
46 |
| -cdef np.int64_t MAXint64 = np.iinfo(np.int64).max |
47 |
| -cdef np.float16_t MAXfloat16 = np.inf |
48 | 23 | cdef np.float32_t MAXfloat32 = np.inf
|
49 | 24 | cdef np.float64_t MAXfloat64 = np.inf
|
50 | 25 |
|
51 | 26 | cdef double NaN = <double> np.NaN
|
52 |
| -cdef double nan = NaN |
53 | 27 |
|
54 | 28 | cdef inline int int_max(int a, int b): return a if a >= b else b
|
55 | 29 | cdef inline int int_min(int a, int b): return a if a <= b else b
|
|
0 commit comments