numpy
2.0.0
|
00001 #ifndef _NPY_COMMON_H_ 00002 #define _NPY_COMMON_H_ 00003 00004 /* numpconfig.h is auto-generated */ 00005 #include "numpyconfig.h" 00006 #ifdef HAVE_NPY_CONFIG_H 00007 #include <npy_config.h> 00008 #endif 00009 00010 /* need Python.h for npy_intp, npy_uintp */ 00011 #include <Python.h> 00012 00013 /* 00014 * gcc does not unroll even with -O3 00015 * use with care, unrolling on modern cpus rarely speeds things up 00016 */ 00017 #ifdef HAVE_ATTRIBUTE_OPTIMIZE_UNROLL_LOOPS 00018 #define NPY_GCC_UNROLL_LOOPS \ 00019 __attribute__((optimize("unroll-loops"))) 00020 #else 00021 #define NPY_GCC_UNROLL_LOOPS 00022 #endif 00023 00024 /* highest gcc optimization level, enabled autovectorizer */ 00025 #ifdef HAVE_ATTRIBUTE_OPTIMIZE_OPT_3 00026 #define NPY_GCC_OPT_3 __attribute__((optimize("O3"))) 00027 #else 00028 #define NPY_GCC_OPT_3 00029 #endif 00030 00031 /* compile target attributes */ 00032 #if defined HAVE_ATTRIBUTE_TARGET_AVX && defined HAVE_LINK_AVX 00033 #define NPY_GCC_TARGET_AVX __attribute__((target("avx"))) 00034 #else 00035 #define NPY_GCC_TARGET_AVX 00036 #endif 00037 #if defined HAVE_ATTRIBUTE_TARGET_AVX2 && defined HAVE_LINK_AVX2 00038 #define NPY_GCC_TARGET_AVX2 __attribute__((target("avx2"))) 00039 #else 00040 #define NPY_GCC_TARGET_AVX2 00041 #endif 00042 00043 /* 00044 * mark an argument (starting from 1) that must not be NULL and is not checked 00045 * DO NOT USE IF FUNCTION CHECKS FOR NULL!! the compiler will remove the check 00046 */ 00047 #ifdef HAVE_ATTRIBUTE_NONNULL 00048 #define NPY_GCC_NONNULL(n) __attribute__((nonnull(n))) 00049 #else 00050 #define NPY_GCC_NONNULL(n) 00051 #endif 00052 00053 #if defined HAVE_XMMINTRIN_H && defined HAVE__MM_LOAD_PS 00054 #define NPY_HAVE_SSE_INTRINSICS 00055 #endif 00056 00057 #if defined HAVE_EMMINTRIN_H && defined HAVE__MM_LOAD_PD 00058 #define NPY_HAVE_SSE2_INTRINSICS 00059 #endif 00060 00061 /* 00062 * give a hint to the compiler which branch is more likely or unlikely 00063 * to occur, e.g. rare error cases: 00064 * 00065 * if (NPY_UNLIKELY(failure == 0)) 00066 * return NULL; 00067 * 00068 * the double !! is to cast the expression (e.g. NULL) to a boolean required by 00069 * the intrinsic 00070 */ 00071 #ifdef HAVE___BUILTIN_EXPECT 00072 #define NPY_LIKELY(x) __builtin_expect(!!(x), 1) 00073 #define NPY_UNLIKELY(x) __builtin_expect(!!(x), 0) 00074 #else 00075 #define NPY_LIKELY(x) (x) 00076 #define NPY_UNLIKELY(x) (x) 00077 #endif 00078 00079 #ifdef HAVE___BUILTIN_PREFETCH 00080 /* unlike _mm_prefetch also works on non-x86 */ 00081 #define NPY_PREFETCH(x, rw, loc) __builtin_prefetch((x), (rw), (loc)) 00082 #else 00083 #ifdef HAVE__MM_PREFETCH 00084 /* _MM_HINT_ET[01] (rw = 1) unsupported, only available in gcc >= 4.9 */ 00085 #define NPY_PREFETCH(x, rw, loc) _mm_prefetch((x), loc == 0 ? _MM_HINT_NTA : \ 00086 (loc == 1 ? _MM_HINT_T2 : \ 00087 (loc == 2 ? _MM_HINT_T1 : \ 00088 (loc == 3 ? _MM_HINT_T0 : -1)))) 00089 #else 00090 #define NPY_PREFETCH(x, rw,loc) 00091 #endif 00092 #endif 00093 00094 #ifdef HAVE___BUILTIN_CPU_SUPPORTS 00095 #ifdef HAVE_ATTRIBUTE_TARGET_AVX2 00096 #define NPY_CPU_SUPPORTS_AVX2 __builtin_cpu_supports("avx2") 00097 #else 00098 #define NPY_CPU_SUPPORTS_AVX2 0 00099 #endif 00100 #ifdef HAVE_ATTRIBUTE_TARGET_AVX 00101 #define NPY_CPU_SUPPORTS_AVX __builtin_cpu_supports("avx") 00102 #else 00103 #define NPY_CPU_SUPPORTS_AVX 0 00104 #endif 00105 #else 00106 #define NPY_CPU_SUPPORTS_AVX 0 00107 #define NPY_CPU_SUPPORTS_AVX2 0 00108 #endif 00109 00110 #if defined(_MSC_VER) 00111 #define NPY_INLINE __inline 00112 #elif defined(__GNUC__) 00113 #if defined(__STRICT_ANSI__) 00114 #define NPY_INLINE __inline__ 00115 #else 00116 #define NPY_INLINE inline 00117 #endif 00118 #else 00119 #define NPY_INLINE 00120 #endif 00121 00122 #ifdef HAVE___THREAD 00123 #define NPY_TLS __thread 00124 #else 00125 #ifdef HAVE___DECLSPEC_THREAD_ 00126 #define NPY_TLS __declspec(thread) 00127 #else 00128 #define NPY_TLS 00129 #endif 00130 #endif 00131 00132 #ifdef WITH_CPYCHECKER_RETURNS_BORROWED_REF_ATTRIBUTE 00133 #define NPY_RETURNS_BORROWED_REF \ 00134 __attribute__((cpychecker_returns_borrowed_ref)) 00135 #else 00136 #define NPY_RETURNS_BORROWED_REF 00137 #endif 00138 00139 #ifdef WITH_CPYCHECKER_STEALS_REFERENCE_TO_ARG_ATTRIBUTE 00140 #define NPY_STEALS_REF_TO_ARG(n) \ 00141 __attribute__((cpychecker_steals_reference_to_arg(n))) 00142 #else 00143 #define NPY_STEALS_REF_TO_ARG(n) 00144 #endif 00145 00146 /* 64 bit file position support, also on win-amd64. Ticket #1660 */ 00147 #if defined(_MSC_VER) && defined(_WIN64) && (_MSC_VER > 1400) || \ 00148 defined(__MINGW32__) || defined(__MINGW64__) 00149 #include <io.h> 00150 00151 /* mingw based on 3.4.5 has lseek but not ftell/fseek */ 00152 #if defined(__MINGW32__) || defined(__MINGW64__) 00153 extern int __cdecl _fseeki64(FILE *, long long, int); 00154 extern long long __cdecl _ftelli64(FILE *); 00155 #endif 00156 00157 #define npy_fseek _fseeki64 00158 #define npy_ftell _ftelli64 00159 #define npy_lseek _lseeki64 00160 #define npy_off_t npy_int64 00161 00162 #if NPY_SIZEOF_INT == 8 00163 #define NPY_OFF_T_PYFMT "i" 00164 #elif NPY_SIZEOF_LONG == 8 00165 #define NPY_OFF_T_PYFMT "l" 00166 #elif NPY_SIZEOF_LONGLONG == 8 00167 #define NPY_OFF_T_PYFMT "L" 00168 #else 00169 #error Unsupported size for type off_t 00170 #endif 00171 #else 00172 #ifdef HAVE_FSEEKO 00173 #define npy_fseek fseeko 00174 #else 00175 #define npy_fseek fseek 00176 #endif 00177 #ifdef HAVE_FTELLO 00178 #define npy_ftell ftello 00179 #else 00180 #define npy_ftell ftell 00181 #endif 00182 #include <sys/types.h> 00183 #define npy_lseek lseek 00184 #define npy_off_t off_t 00185 00186 #if NPY_SIZEOF_OFF_T == NPY_SIZEOF_SHORT 00187 #define NPY_OFF_T_PYFMT "h" 00188 #elif NPY_SIZEOF_OFF_T == NPY_SIZEOF_INT 00189 #define NPY_OFF_T_PYFMT "i" 00190 #elif NPY_SIZEOF_OFF_T == NPY_SIZEOF_LONG 00191 #define NPY_OFF_T_PYFMT "l" 00192 #elif NPY_SIZEOF_OFF_T == NPY_SIZEOF_LONGLONG 00193 #define NPY_OFF_T_PYFMT "L" 00194 #else 00195 #error Unsupported size for type off_t 00196 #endif 00197 #endif 00198 00199 /* enums for detected endianness */ 00200 enum { 00201 NPY_CPU_UNKNOWN_ENDIAN, 00202 NPY_CPU_LITTLE, 00203 NPY_CPU_BIG 00204 }; 00205 00206 /* 00207 * This is to typedef npy_intp to the appropriate pointer size for this 00208 * platform. Py_intptr_t, Py_uintptr_t are defined in pyport.h. 00209 */ 00210 typedef Py_intptr_t npy_intp; 00211 typedef Py_uintptr_t npy_uintp; 00212 00213 /* 00214 * Define sizes that were not defined in numpyconfig.h. 00215 */ 00216 #define NPY_SIZEOF_CHAR 1 00217 #define NPY_SIZEOF_BYTE 1 00218 #define NPY_SIZEOF_DATETIME 8 00219 #define NPY_SIZEOF_TIMEDELTA 8 00220 #define NPY_SIZEOF_INTP NPY_SIZEOF_PY_INTPTR_T 00221 #define NPY_SIZEOF_UINTP NPY_SIZEOF_PY_INTPTR_T 00222 #define NPY_SIZEOF_HALF 2 00223 #define NPY_SIZEOF_CFLOAT NPY_SIZEOF_COMPLEX_FLOAT 00224 #define NPY_SIZEOF_CDOUBLE NPY_SIZEOF_COMPLEX_DOUBLE 00225 #define NPY_SIZEOF_CLONGDOUBLE NPY_SIZEOF_COMPLEX_LONGDOUBLE 00226 00227 #ifdef constchar 00228 #undef constchar 00229 #endif 00230 00231 #define NPY_SSIZE_T_PYFMT "n" 00232 #define constchar char 00233 00234 /* NPY_INTP_FMT Note: 00235 * Unlike the other NPY_*_FMT macros which are used with 00236 * PyOS_snprintf, NPY_INTP_FMT is used with PyErr_Format and 00237 * PyString_Format. These functions use different formatting 00238 * codes which are portably specified according to the Python 00239 * documentation. See ticket #1795. 00240 * 00241 * On Windows x64, the LONGLONG formatter should be used, but 00242 * in Python 2.6 the %lld formatter is not supported. In this 00243 * case we work around the problem by using the %zd formatter. 00244 */ 00245 #if NPY_SIZEOF_PY_INTPTR_T == NPY_SIZEOF_INT 00246 #define NPY_INTP NPY_INT 00247 #define NPY_UINTP NPY_UINT 00248 #define PyIntpArrType_Type PyIntArrType_Type 00249 #define PyUIntpArrType_Type PyUIntArrType_Type 00250 #define NPY_MAX_INTP NPY_MAX_INT 00251 #define NPY_MIN_INTP NPY_MIN_INT 00252 #define NPY_MAX_UINTP NPY_MAX_UINT 00253 #define NPY_INTP_FMT "d" 00254 #elif NPY_SIZEOF_PY_INTPTR_T == NPY_SIZEOF_LONG 00255 #define NPY_INTP NPY_LONG 00256 #define NPY_UINTP NPY_ULONG 00257 #define PyIntpArrType_Type PyLongArrType_Type 00258 #define PyUIntpArrType_Type PyULongArrType_Type 00259 #define NPY_MAX_INTP NPY_MAX_LONG 00260 #define NPY_MIN_INTP NPY_MIN_LONG 00261 #define NPY_MAX_UINTP NPY_MAX_ULONG 00262 #define NPY_INTP_FMT "ld" 00263 #elif defined(PY_LONG_LONG) && (NPY_SIZEOF_PY_INTPTR_T == NPY_SIZEOF_LONGLONG) 00264 #define NPY_INTP NPY_LONGLONG 00265 #define NPY_UINTP NPY_ULONGLONG 00266 #define PyIntpArrType_Type PyLongLongArrType_Type 00267 #define PyUIntpArrType_Type PyULongLongArrType_Type 00268 #define NPY_MAX_INTP NPY_MAX_LONGLONG 00269 #define NPY_MIN_INTP NPY_MIN_LONGLONG 00270 #define NPY_MAX_UINTP NPY_MAX_ULONGLONG 00271 #if (PY_VERSION_HEX >= 0x02070000) 00272 #define NPY_INTP_FMT "lld" 00273 #else 00274 #define NPY_INTP_FMT "zd" 00275 #endif 00276 #endif 00277 00278 /* 00279 * We can only use C99 formats for npy_int_p if it is the same as 00280 * intp_t, hence the condition on HAVE_UNITPTR_T 00281 */ 00282 #if (NPY_USE_C99_FORMATS) == 1 \ 00283 && (defined HAVE_UINTPTR_T) \ 00284 && (defined HAVE_INTTYPES_H) 00285 #include <inttypes.h> 00286 #undef NPY_INTP_FMT 00287 #define NPY_INTP_FMT PRIdPTR 00288 #endif 00289 00290 00291 /* 00292 * Some platforms don't define bool, long long, or long double. 00293 * Handle that here. 00294 */ 00295 #define NPY_BYTE_FMT "hhd" 00296 #define NPY_UBYTE_FMT "hhu" 00297 #define NPY_SHORT_FMT "hd" 00298 #define NPY_USHORT_FMT "hu" 00299 #define NPY_INT_FMT "d" 00300 #define NPY_UINT_FMT "u" 00301 #define NPY_LONG_FMT "ld" 00302 #define NPY_ULONG_FMT "lu" 00303 #define NPY_HALF_FMT "g" 00304 #define NPY_FLOAT_FMT "g" 00305 #define NPY_DOUBLE_FMT "g" 00306 00307 00308 #ifdef PY_LONG_LONG 00309 typedef PY_LONG_LONG npy_longlong; 00310 typedef unsigned PY_LONG_LONG npy_ulonglong; 00311 # ifdef _MSC_VER 00312 # define NPY_LONGLONG_FMT "I64d" 00313 # define NPY_ULONGLONG_FMT "I64u" 00314 # else 00315 # define NPY_LONGLONG_FMT "lld" 00316 # define NPY_ULONGLONG_FMT "llu" 00317 # endif 00318 # ifdef _MSC_VER 00319 # define NPY_LONGLONG_SUFFIX(x) (x##i64) 00320 # define NPY_ULONGLONG_SUFFIX(x) (x##Ui64) 00321 # else 00322 # define NPY_LONGLONG_SUFFIX(x) (x##LL) 00323 # define NPY_ULONGLONG_SUFFIX(x) (x##ULL) 00324 # endif 00325 #else 00326 typedef long npy_longlong; 00327 typedef unsigned long npy_ulonglong; 00328 # define NPY_LONGLONG_SUFFIX(x) (x##L) 00329 # define NPY_ULONGLONG_SUFFIX(x) (x##UL) 00330 #endif 00331 00332 00333 typedef unsigned char npy_bool; 00334 #define NPY_FALSE 0 00335 #define NPY_TRUE 1 00336 00337 00338 #if NPY_SIZEOF_LONGDOUBLE == NPY_SIZEOF_DOUBLE 00339 typedef double npy_longdouble; 00340 #define NPY_LONGDOUBLE_FMT "g" 00341 #else 00342 typedef long double npy_longdouble; 00343 #define NPY_LONGDOUBLE_FMT "Lg" 00344 #endif 00345 00346 #ifndef Py_USING_UNICODE 00347 #error Must use Python with unicode enabled. 00348 #endif 00349 00350 00351 typedef signed char npy_byte; 00352 typedef unsigned char npy_ubyte; 00353 typedef unsigned short npy_ushort; 00354 typedef unsigned int npy_uint; 00355 typedef unsigned long npy_ulong; 00356 00357 /* These are for completeness */ 00358 typedef char npy_char; 00359 typedef short npy_short; 00360 typedef int npy_int; 00361 typedef long npy_long; 00362 typedef float npy_float; 00363 typedef double npy_double; 00364 00365 /* 00366 * Hash value compatibility. 00367 * As of Python 3.2 hash values are of type Py_hash_t. 00368 * Previous versions use C long. 00369 */ 00370 #if PY_VERSION_HEX < 0x03020000 00371 typedef long npy_hash_t; 00372 #define NPY_SIZEOF_HASH_T NPY_SIZEOF_LONG 00373 #else 00374 typedef Py_hash_t npy_hash_t; 00375 #define NPY_SIZEOF_HASH_T NPY_SIZEOF_INTP 00376 #endif 00377 00378 /* 00379 * Disabling C99 complex usage: a lot of C code in numpy/scipy rely on being 00380 * able to do .real/.imag. Will have to convert code first. 00381 */ 00382 #if 0 00383 #if defined(NPY_USE_C99_COMPLEX) && defined(NPY_HAVE_COMPLEX_DOUBLE) 00384 typedef complex npy_cdouble; 00385 #else 00386 typedef struct { double real, imag; } npy_cdouble; 00387 #endif 00388 00389 #if defined(NPY_USE_C99_COMPLEX) && defined(NPY_HAVE_COMPLEX_FLOAT) 00390 typedef complex float npy_cfloat; 00391 #else 00392 typedef struct { float real, imag; } npy_cfloat; 00393 #endif 00394 00395 #if defined(NPY_USE_C99_COMPLEX) && defined(NPY_HAVE_COMPLEX_LONG_DOUBLE) 00396 typedef complex long double npy_clongdouble; 00397 #else 00398 typedef struct {npy_longdouble real, imag;} npy_clongdouble; 00399 #endif 00400 #endif 00401 #if NPY_SIZEOF_COMPLEX_DOUBLE != 2 * NPY_SIZEOF_DOUBLE 00402 #error npy_cdouble definition is not compatible with C99 complex definition ! \ 00403 Please contact NumPy maintainers and give detailed information about your \ 00404 compiler and platform 00405 #endif 00406 typedef struct { double real, imag; } npy_cdouble; 00407 00408 #if NPY_SIZEOF_COMPLEX_FLOAT != 2 * NPY_SIZEOF_FLOAT 00409 #error npy_cfloat definition is not compatible with C99 complex definition ! \ 00410 Please contact NumPy maintainers and give detailed information about your \ 00411 compiler and platform 00412 #endif 00413 typedef struct { float real, imag; } npy_cfloat; 00414 00415 #if NPY_SIZEOF_COMPLEX_LONGDOUBLE != 2 * NPY_SIZEOF_LONGDOUBLE 00416 #error npy_clongdouble definition is not compatible with C99 complex definition ! \ 00417 Please contact NumPy maintainers and give detailed information about your \ 00418 compiler and platform 00419 #endif 00420 typedef struct { npy_longdouble real, imag; } npy_clongdouble; 00421 00422 /* 00423 * numarray-style bit-width typedefs 00424 */ 00425 #define NPY_MAX_INT8 127 00426 #define NPY_MIN_INT8 -128 00427 #define NPY_MAX_UINT8 255 00428 #define NPY_MAX_INT16 32767 00429 #define NPY_MIN_INT16 -32768 00430 #define NPY_MAX_UINT16 65535 00431 #define NPY_MAX_INT32 2147483647 00432 #define NPY_MIN_INT32 (-NPY_MAX_INT32 - 1) 00433 #define NPY_MAX_UINT32 4294967295U 00434 #define NPY_MAX_INT64 NPY_LONGLONG_SUFFIX(9223372036854775807) 00435 #define NPY_MIN_INT64 (-NPY_MAX_INT64 - NPY_LONGLONG_SUFFIX(1)) 00436 #define NPY_MAX_UINT64 NPY_ULONGLONG_SUFFIX(18446744073709551615) 00437 #define NPY_MAX_INT128 NPY_LONGLONG_SUFFIX(85070591730234615865843651857942052864) 00438 #define NPY_MIN_INT128 (-NPY_MAX_INT128 - NPY_LONGLONG_SUFFIX(1)) 00439 #define NPY_MAX_UINT128 NPY_ULONGLONG_SUFFIX(170141183460469231731687303715884105728) 00440 #define NPY_MAX_INT256 NPY_LONGLONG_SUFFIX(57896044618658097711785492504343953926634992332820282019728792003956564819967) 00441 #define NPY_MIN_INT256 (-NPY_MAX_INT256 - NPY_LONGLONG_SUFFIX(1)) 00442 #define NPY_MAX_UINT256 NPY_ULONGLONG_SUFFIX(115792089237316195423570985008687907853269984665640564039457584007913129639935) 00443 #define NPY_MIN_DATETIME NPY_MIN_INT64 00444 #define NPY_MAX_DATETIME NPY_MAX_INT64 00445 #define NPY_MIN_TIMEDELTA NPY_MIN_INT64 00446 #define NPY_MAX_TIMEDELTA NPY_MAX_INT64 00447 00448 /* Need to find the number of bits for each type and 00449 make definitions accordingly. 00450 00451 C states that sizeof(char) == 1 by definition 00452 00453 So, just using the sizeof keyword won't help. 00454 00455 It also looks like Python itself uses sizeof(char) quite a 00456 bit, which by definition should be 1 all the time. 00457 00458 Idea: Make Use of CHAR_BIT which should tell us how many 00459 BITS per CHARACTER 00460 */ 00461 00462 /* Include platform definitions -- These are in the C89/90 standard */ 00463 #include <limits.h> 00464 #define NPY_MAX_BYTE SCHAR_MAX 00465 #define NPY_MIN_BYTE SCHAR_MIN 00466 #define NPY_MAX_UBYTE UCHAR_MAX 00467 #define NPY_MAX_SHORT SHRT_MAX 00468 #define NPY_MIN_SHORT SHRT_MIN 00469 #define NPY_MAX_USHORT USHRT_MAX 00470 #define NPY_MAX_INT INT_MAX 00471 #ifndef INT_MIN 00472 #define INT_MIN (-INT_MAX - 1) 00473 #endif 00474 #define NPY_MIN_INT INT_MIN 00475 #define NPY_MAX_UINT UINT_MAX 00476 #define NPY_MAX_LONG LONG_MAX 00477 #define NPY_MIN_LONG LONG_MIN 00478 #define NPY_MAX_ULONG ULONG_MAX 00479 00480 #define NPY_BITSOF_BOOL (sizeof(npy_bool) * CHAR_BIT) 00481 #define NPY_BITSOF_CHAR CHAR_BIT 00482 #define NPY_BITSOF_BYTE (NPY_SIZEOF_BYTE * CHAR_BIT) 00483 #define NPY_BITSOF_SHORT (NPY_SIZEOF_SHORT * CHAR_BIT) 00484 #define NPY_BITSOF_INT (NPY_SIZEOF_INT * CHAR_BIT) 00485 #define NPY_BITSOF_LONG (NPY_SIZEOF_LONG * CHAR_BIT) 00486 #define NPY_BITSOF_LONGLONG (NPY_SIZEOF_LONGLONG * CHAR_BIT) 00487 #define NPY_BITSOF_INTP (NPY_SIZEOF_INTP * CHAR_BIT) 00488 #define NPY_BITSOF_HALF (NPY_SIZEOF_HALF * CHAR_BIT) 00489 #define NPY_BITSOF_FLOAT (NPY_SIZEOF_FLOAT * CHAR_BIT) 00490 #define NPY_BITSOF_DOUBLE (NPY_SIZEOF_DOUBLE * CHAR_BIT) 00491 #define NPY_BITSOF_LONGDOUBLE (NPY_SIZEOF_LONGDOUBLE * CHAR_BIT) 00492 #define NPY_BITSOF_CFLOAT (NPY_SIZEOF_CFLOAT * CHAR_BIT) 00493 #define NPY_BITSOF_CDOUBLE (NPY_SIZEOF_CDOUBLE * CHAR_BIT) 00494 #define NPY_BITSOF_CLONGDOUBLE (NPY_SIZEOF_CLONGDOUBLE * CHAR_BIT) 00495 #define NPY_BITSOF_DATETIME (NPY_SIZEOF_DATETIME * CHAR_BIT) 00496 #define NPY_BITSOF_TIMEDELTA (NPY_SIZEOF_TIMEDELTA * CHAR_BIT) 00497 00498 #if NPY_BITSOF_LONG == 8 00499 #define NPY_INT8 NPY_LONG 00500 #define NPY_UINT8 NPY_ULONG 00501 typedef long npy_int8; 00502 typedef unsigned long npy_uint8; 00503 #define PyInt8ScalarObject PyLongScalarObject 00504 #define PyInt8ArrType_Type PyLongArrType_Type 00505 #define PyUInt8ScalarObject PyULongScalarObject 00506 #define PyUInt8ArrType_Type PyULongArrType_Type 00507 #define NPY_INT8_FMT NPY_LONG_FMT 00508 #define NPY_UINT8_FMT NPY_ULONG_FMT 00509 #elif NPY_BITSOF_LONG == 16 00510 #define NPY_INT16 NPY_LONG 00511 #define NPY_UINT16 NPY_ULONG 00512 typedef long npy_int16; 00513 typedef unsigned long npy_uint16; 00514 #define PyInt16ScalarObject PyLongScalarObject 00515 #define PyInt16ArrType_Type PyLongArrType_Type 00516 #define PyUInt16ScalarObject PyULongScalarObject 00517 #define PyUInt16ArrType_Type PyULongArrType_Type 00518 #define NPY_INT16_FMT NPY_LONG_FMT 00519 #define NPY_UINT16_FMT NPY_ULONG_FMT 00520 #elif NPY_BITSOF_LONG == 32 00521 #define NPY_INT32 NPY_LONG 00522 #define NPY_UINT32 NPY_ULONG 00523 typedef long npy_int32; 00524 typedef unsigned long npy_uint32; 00525 typedef unsigned long npy_ucs4; 00526 #define PyInt32ScalarObject PyLongScalarObject 00527 #define PyInt32ArrType_Type PyLongArrType_Type 00528 #define PyUInt32ScalarObject PyULongScalarObject 00529 #define PyUInt32ArrType_Type PyULongArrType_Type 00530 #define NPY_INT32_FMT NPY_LONG_FMT 00531 #define NPY_UINT32_FMT NPY_ULONG_FMT 00532 #elif NPY_BITSOF_LONG == 64 00533 #define NPY_INT64 NPY_LONG 00534 #define NPY_UINT64 NPY_ULONG 00535 typedef long npy_int64; 00536 typedef unsigned long npy_uint64; 00537 #define PyInt64ScalarObject PyLongScalarObject 00538 #define PyInt64ArrType_Type PyLongArrType_Type 00539 #define PyUInt64ScalarObject PyULongScalarObject 00540 #define PyUInt64ArrType_Type PyULongArrType_Type 00541 #define NPY_INT64_FMT NPY_LONG_FMT 00542 #define NPY_UINT64_FMT NPY_ULONG_FMT 00543 #define MyPyLong_FromInt64 PyLong_FromLong 00544 #define MyPyLong_AsInt64 PyLong_AsLong 00545 #elif NPY_BITSOF_LONG == 128 00546 #define NPY_INT128 NPY_LONG 00547 #define NPY_UINT128 NPY_ULONG 00548 typedef long npy_int128; 00549 typedef unsigned long npy_uint128; 00550 #define PyInt128ScalarObject PyLongScalarObject 00551 #define PyInt128ArrType_Type PyLongArrType_Type 00552 #define PyUInt128ScalarObject PyULongScalarObject 00553 #define PyUInt128ArrType_Type PyULongArrType_Type 00554 #define NPY_INT128_FMT NPY_LONG_FMT 00555 #define NPY_UINT128_FMT NPY_ULONG_FMT 00556 #endif 00557 00558 #if NPY_BITSOF_LONGLONG == 8 00559 # ifndef NPY_INT8 00560 # define NPY_INT8 NPY_LONGLONG 00561 # define NPY_UINT8 NPY_ULONGLONG 00562 typedef npy_longlong npy_int8; 00563 typedef npy_ulonglong npy_uint8; 00564 # define PyInt8ScalarObject PyLongLongScalarObject 00565 # define PyInt8ArrType_Type PyLongLongArrType_Type 00566 # define PyUInt8ScalarObject PyULongLongScalarObject 00567 # define PyUInt8ArrType_Type PyULongLongArrType_Type 00568 #define NPY_INT8_FMT NPY_LONGLONG_FMT 00569 #define NPY_UINT8_FMT NPY_ULONGLONG_FMT 00570 # endif 00571 # define NPY_MAX_LONGLONG NPY_MAX_INT8 00572 # define NPY_MIN_LONGLONG NPY_MIN_INT8 00573 # define NPY_MAX_ULONGLONG NPY_MAX_UINT8 00574 #elif NPY_BITSOF_LONGLONG == 16 00575 # ifndef NPY_INT16 00576 # define NPY_INT16 NPY_LONGLONG 00577 # define NPY_UINT16 NPY_ULONGLONG 00578 typedef npy_longlong npy_int16; 00579 typedef npy_ulonglong npy_uint16; 00580 # define PyInt16ScalarObject PyLongLongScalarObject 00581 # define PyInt16ArrType_Type PyLongLongArrType_Type 00582 # define PyUInt16ScalarObject PyULongLongScalarObject 00583 # define PyUInt16ArrType_Type PyULongLongArrType_Type 00584 #define NPY_INT16_FMT NPY_LONGLONG_FMT 00585 #define NPY_UINT16_FMT NPY_ULONGLONG_FMT 00586 # endif 00587 # define NPY_MAX_LONGLONG NPY_MAX_INT16 00588 # define NPY_MIN_LONGLONG NPY_MIN_INT16 00589 # define NPY_MAX_ULONGLONG NPY_MAX_UINT16 00590 #elif NPY_BITSOF_LONGLONG == 32 00591 # ifndef NPY_INT32 00592 # define NPY_INT32 NPY_LONGLONG 00593 # define NPY_UINT32 NPY_ULONGLONG 00594 typedef npy_longlong npy_int32; 00595 typedef npy_ulonglong npy_uint32; 00596 typedef npy_ulonglong npy_ucs4; 00597 # define PyInt32ScalarObject PyLongLongScalarObject 00598 # define PyInt32ArrType_Type PyLongLongArrType_Type 00599 # define PyUInt32ScalarObject PyULongLongScalarObject 00600 # define PyUInt32ArrType_Type PyULongLongArrType_Type 00601 #define NPY_INT32_FMT NPY_LONGLONG_FMT 00602 #define NPY_UINT32_FMT NPY_ULONGLONG_FMT 00603 # endif 00604 # define NPY_MAX_LONGLONG NPY_MAX_INT32 00605 # define NPY_MIN_LONGLONG NPY_MIN_INT32 00606 # define NPY_MAX_ULONGLONG NPY_MAX_UINT32 00607 #elif NPY_BITSOF_LONGLONG == 64 00608 # ifndef NPY_INT64 00609 # define NPY_INT64 NPY_LONGLONG 00610 # define NPY_UINT64 NPY_ULONGLONG 00611 typedef npy_longlong npy_int64; 00612 typedef npy_ulonglong npy_uint64; 00613 # define PyInt64ScalarObject PyLongLongScalarObject 00614 # define PyInt64ArrType_Type PyLongLongArrType_Type 00615 # define PyUInt64ScalarObject PyULongLongScalarObject 00616 # define PyUInt64ArrType_Type PyULongLongArrType_Type 00617 #define NPY_INT64_FMT NPY_LONGLONG_FMT 00618 #define NPY_UINT64_FMT NPY_ULONGLONG_FMT 00619 # define MyPyLong_FromInt64 PyLong_FromLongLong 00620 # define MyPyLong_AsInt64 PyLong_AsLongLong 00621 # endif 00622 # define NPY_MAX_LONGLONG NPY_MAX_INT64 00623 # define NPY_MIN_LONGLONG NPY_MIN_INT64 00624 # define NPY_MAX_ULONGLONG NPY_MAX_UINT64 00625 #elif NPY_BITSOF_LONGLONG == 128 00626 # ifndef NPY_INT128 00627 # define NPY_INT128 NPY_LONGLONG 00628 # define NPY_UINT128 NPY_ULONGLONG 00629 typedef npy_longlong npy_int128; 00630 typedef npy_ulonglong npy_uint128; 00631 # define PyInt128ScalarObject PyLongLongScalarObject 00632 # define PyInt128ArrType_Type PyLongLongArrType_Type 00633 # define PyUInt128ScalarObject PyULongLongScalarObject 00634 # define PyUInt128ArrType_Type PyULongLongArrType_Type 00635 #define NPY_INT128_FMT NPY_LONGLONG_FMT 00636 #define NPY_UINT128_FMT NPY_ULONGLONG_FMT 00637 # endif 00638 # define NPY_MAX_LONGLONG NPY_MAX_INT128 00639 # define NPY_MIN_LONGLONG NPY_MIN_INT128 00640 # define NPY_MAX_ULONGLONG NPY_MAX_UINT128 00641 #elif NPY_BITSOF_LONGLONG == 256 00642 # define NPY_INT256 NPY_LONGLONG 00643 # define NPY_UINT256 NPY_ULONGLONG 00644 typedef npy_longlong npy_int256; 00645 typedef npy_ulonglong npy_uint256; 00646 # define PyInt256ScalarObject PyLongLongScalarObject 00647 # define PyInt256ArrType_Type PyLongLongArrType_Type 00648 # define PyUInt256ScalarObject PyULongLongScalarObject 00649 # define PyUInt256ArrType_Type PyULongLongArrType_Type 00650 #define NPY_INT256_FMT NPY_LONGLONG_FMT 00651 #define NPY_UINT256_FMT NPY_ULONGLONG_FMT 00652 # define NPY_MAX_LONGLONG NPY_MAX_INT256 00653 # define NPY_MIN_LONGLONG NPY_MIN_INT256 00654 # define NPY_MAX_ULONGLONG NPY_MAX_UINT256 00655 #endif 00656 00657 #if NPY_BITSOF_INT == 8 00658 #ifndef NPY_INT8 00659 #define NPY_INT8 NPY_INT 00660 #define NPY_UINT8 NPY_UINT 00661 typedef int npy_int8; 00662 typedef unsigned int npy_uint8; 00663 # define PyInt8ScalarObject PyIntScalarObject 00664 # define PyInt8ArrType_Type PyIntArrType_Type 00665 # define PyUInt8ScalarObject PyUIntScalarObject 00666 # define PyUInt8ArrType_Type PyUIntArrType_Type 00667 #define NPY_INT8_FMT NPY_INT_FMT 00668 #define NPY_UINT8_FMT NPY_UINT_FMT 00669 #endif 00670 #elif NPY_BITSOF_INT == 16 00671 #ifndef NPY_INT16 00672 #define NPY_INT16 NPY_INT 00673 #define NPY_UINT16 NPY_UINT 00674 typedef int npy_int16; 00675 typedef unsigned int npy_uint16; 00676 # define PyInt16ScalarObject PyIntScalarObject 00677 # define PyInt16ArrType_Type PyIntArrType_Type 00678 # define PyUInt16ScalarObject PyIntUScalarObject 00679 # define PyUInt16ArrType_Type PyIntUArrType_Type 00680 #define NPY_INT16_FMT NPY_INT_FMT 00681 #define NPY_UINT16_FMT NPY_UINT_FMT 00682 #endif 00683 #elif NPY_BITSOF_INT == 32 00684 #ifndef NPY_INT32 00685 #define NPY_INT32 NPY_INT 00686 #define NPY_UINT32 NPY_UINT 00687 typedef int npy_int32; 00688 typedef unsigned int npy_uint32; 00689 typedef unsigned int npy_ucs4; 00690 # define PyInt32ScalarObject PyIntScalarObject 00691 # define PyInt32ArrType_Type PyIntArrType_Type 00692 # define PyUInt32ScalarObject PyUIntScalarObject 00693 # define PyUInt32ArrType_Type PyUIntArrType_Type 00694 #define NPY_INT32_FMT NPY_INT_FMT 00695 #define NPY_UINT32_FMT NPY_UINT_FMT 00696 #endif 00697 #elif NPY_BITSOF_INT == 64 00698 #ifndef NPY_INT64 00699 #define NPY_INT64 NPY_INT 00700 #define NPY_UINT64 NPY_UINT 00701 typedef int npy_int64; 00702 typedef unsigned int npy_uint64; 00703 # define PyInt64ScalarObject PyIntScalarObject 00704 # define PyInt64ArrType_Type PyIntArrType_Type 00705 # define PyUInt64ScalarObject PyUIntScalarObject 00706 # define PyUInt64ArrType_Type PyUIntArrType_Type 00707 #define NPY_INT64_FMT NPY_INT_FMT 00708 #define NPY_UINT64_FMT NPY_UINT_FMT 00709 # define MyPyLong_FromInt64 PyLong_FromLong 00710 # define MyPyLong_AsInt64 PyLong_AsLong 00711 #endif 00712 #elif NPY_BITSOF_INT == 128 00713 #ifndef NPY_INT128 00714 #define NPY_INT128 NPY_INT 00715 #define NPY_UINT128 NPY_UINT 00716 typedef int npy_int128; 00717 typedef unsigned int npy_uint128; 00718 # define PyInt128ScalarObject PyIntScalarObject 00719 # define PyInt128ArrType_Type PyIntArrType_Type 00720 # define PyUInt128ScalarObject PyUIntScalarObject 00721 # define PyUInt128ArrType_Type PyUIntArrType_Type 00722 #define NPY_INT128_FMT NPY_INT_FMT 00723 #define NPY_UINT128_FMT NPY_UINT_FMT 00724 #endif 00725 #endif 00726 00727 #if NPY_BITSOF_SHORT == 8 00728 #ifndef NPY_INT8 00729 #define NPY_INT8 NPY_SHORT 00730 #define NPY_UINT8 NPY_USHORT 00731 typedef short npy_int8; 00732 typedef unsigned short npy_uint8; 00733 # define PyInt8ScalarObject PyShortScalarObject 00734 # define PyInt8ArrType_Type PyShortArrType_Type 00735 # define PyUInt8ScalarObject PyUShortScalarObject 00736 # define PyUInt8ArrType_Type PyUShortArrType_Type 00737 #define NPY_INT8_FMT NPY_SHORT_FMT 00738 #define NPY_UINT8_FMT NPY_USHORT_FMT 00739 #endif 00740 #elif NPY_BITSOF_SHORT == 16 00741 #ifndef NPY_INT16 00742 #define NPY_INT16 NPY_SHORT 00743 #define NPY_UINT16 NPY_USHORT 00744 typedef short npy_int16; 00745 typedef unsigned short npy_uint16; 00746 # define PyInt16ScalarObject PyShortScalarObject 00747 # define PyInt16ArrType_Type PyShortArrType_Type 00748 # define PyUInt16ScalarObject PyUShortScalarObject 00749 # define PyUInt16ArrType_Type PyUShortArrType_Type 00750 #define NPY_INT16_FMT NPY_SHORT_FMT 00751 #define NPY_UINT16_FMT NPY_USHORT_FMT 00752 #endif 00753 #elif NPY_BITSOF_SHORT == 32 00754 #ifndef NPY_INT32 00755 #define NPY_INT32 NPY_SHORT 00756 #define NPY_UINT32 NPY_USHORT 00757 typedef short npy_int32; 00758 typedef unsigned short npy_uint32; 00759 typedef unsigned short npy_ucs4; 00760 # define PyInt32ScalarObject PyShortScalarObject 00761 # define PyInt32ArrType_Type PyShortArrType_Type 00762 # define PyUInt32ScalarObject PyUShortScalarObject 00763 # define PyUInt32ArrType_Type PyUShortArrType_Type 00764 #define NPY_INT32_FMT NPY_SHORT_FMT 00765 #define NPY_UINT32_FMT NPY_USHORT_FMT 00766 #endif 00767 #elif NPY_BITSOF_SHORT == 64 00768 #ifndef NPY_INT64 00769 #define NPY_INT64 NPY_SHORT 00770 #define NPY_UINT64 NPY_USHORT 00771 typedef short npy_int64; 00772 typedef unsigned short npy_uint64; 00773 # define PyInt64ScalarObject PyShortScalarObject 00774 # define PyInt64ArrType_Type PyShortArrType_Type 00775 # define PyUInt64ScalarObject PyUShortScalarObject 00776 # define PyUInt64ArrType_Type PyUShortArrType_Type 00777 #define NPY_INT64_FMT NPY_SHORT_FMT 00778 #define NPY_UINT64_FMT NPY_USHORT_FMT 00779 # define MyPyLong_FromInt64 PyLong_FromLong 00780 # define MyPyLong_AsInt64 PyLong_AsLong 00781 #endif 00782 #elif NPY_BITSOF_SHORT == 128 00783 #ifndef NPY_INT128 00784 #define NPY_INT128 NPY_SHORT 00785 #define NPY_UINT128 NPY_USHORT 00786 typedef short npy_int128; 00787 typedef unsigned short npy_uint128; 00788 # define PyInt128ScalarObject PyShortScalarObject 00789 # define PyInt128ArrType_Type PyShortArrType_Type 00790 # define PyUInt128ScalarObject PyUShortScalarObject 00791 # define PyUInt128ArrType_Type PyUShortArrType_Type 00792 #define NPY_INT128_FMT NPY_SHORT_FMT 00793 #define NPY_UINT128_FMT NPY_USHORT_FMT 00794 #endif 00795 #endif 00796 00797 00798 #if NPY_BITSOF_CHAR == 8 00799 #ifndef NPY_INT8 00800 #define NPY_INT8 NPY_BYTE 00801 #define NPY_UINT8 NPY_UBYTE 00802 typedef signed char npy_int8; 00803 typedef unsigned char npy_uint8; 00804 # define PyInt8ScalarObject PyByteScalarObject 00805 # define PyInt8ArrType_Type PyByteArrType_Type 00806 # define PyUInt8ScalarObject PyUByteScalarObject 00807 # define PyUInt8ArrType_Type PyUByteArrType_Type 00808 #define NPY_INT8_FMT NPY_BYTE_FMT 00809 #define NPY_UINT8_FMT NPY_UBYTE_FMT 00810 #endif 00811 #elif NPY_BITSOF_CHAR == 16 00812 #ifndef NPY_INT16 00813 #define NPY_INT16 NPY_BYTE 00814 #define NPY_UINT16 NPY_UBYTE 00815 typedef signed char npy_int16; 00816 typedef unsigned char npy_uint16; 00817 # define PyInt16ScalarObject PyByteScalarObject 00818 # define PyInt16ArrType_Type PyByteArrType_Type 00819 # define PyUInt16ScalarObject PyUByteScalarObject 00820 # define PyUInt16ArrType_Type PyUByteArrType_Type 00821 #define NPY_INT16_FMT NPY_BYTE_FMT 00822 #define NPY_UINT16_FMT NPY_UBYTE_FMT 00823 #endif 00824 #elif NPY_BITSOF_CHAR == 32 00825 #ifndef NPY_INT32 00826 #define NPY_INT32 NPY_BYTE 00827 #define NPY_UINT32 NPY_UBYTE 00828 typedef signed char npy_int32; 00829 typedef unsigned char npy_uint32; 00830 typedef unsigned char npy_ucs4; 00831 # define PyInt32ScalarObject PyByteScalarObject 00832 # define PyInt32ArrType_Type PyByteArrType_Type 00833 # define PyUInt32ScalarObject PyUByteScalarObject 00834 # define PyUInt32ArrType_Type PyUByteArrType_Type 00835 #define NPY_INT32_FMT NPY_BYTE_FMT 00836 #define NPY_UINT32_FMT NPY_UBYTE_FMT 00837 #endif 00838 #elif NPY_BITSOF_CHAR == 64 00839 #ifndef NPY_INT64 00840 #define NPY_INT64 NPY_BYTE 00841 #define NPY_UINT64 NPY_UBYTE 00842 typedef signed char npy_int64; 00843 typedef unsigned char npy_uint64; 00844 # define PyInt64ScalarObject PyByteScalarObject 00845 # define PyInt64ArrType_Type PyByteArrType_Type 00846 # define PyUInt64ScalarObject PyUByteScalarObject 00847 # define PyUInt64ArrType_Type PyUByteArrType_Type 00848 #define NPY_INT64_FMT NPY_BYTE_FMT 00849 #define NPY_UINT64_FMT NPY_UBYTE_FMT 00850 # define MyPyLong_FromInt64 PyLong_FromLong 00851 # define MyPyLong_AsInt64 PyLong_AsLong 00852 #endif 00853 #elif NPY_BITSOF_CHAR == 128 00854 #ifndef NPY_INT128 00855 #define NPY_INT128 NPY_BYTE 00856 #define NPY_UINT128 NPY_UBYTE 00857 typedef signed char npy_int128; 00858 typedef unsigned char npy_uint128; 00859 # define PyInt128ScalarObject PyByteScalarObject 00860 # define PyInt128ArrType_Type PyByteArrType_Type 00861 # define PyUInt128ScalarObject PyUByteScalarObject 00862 # define PyUInt128ArrType_Type PyUByteArrType_Type 00863 #define NPY_INT128_FMT NPY_BYTE_FMT 00864 #define NPY_UINT128_FMT NPY_UBYTE_FMT 00865 #endif 00866 #endif 00867 00868 00869 00870 #if NPY_BITSOF_DOUBLE == 32 00871 #ifndef NPY_FLOAT32 00872 #define NPY_FLOAT32 NPY_DOUBLE 00873 #define NPY_COMPLEX64 NPY_CDOUBLE 00874 typedef double npy_float32; 00875 typedef npy_cdouble npy_complex64; 00876 # define PyFloat32ScalarObject PyDoubleScalarObject 00877 # define PyComplex64ScalarObject PyCDoubleScalarObject 00878 # define PyFloat32ArrType_Type PyDoubleArrType_Type 00879 # define PyComplex64ArrType_Type PyCDoubleArrType_Type 00880 #define NPY_FLOAT32_FMT NPY_DOUBLE_FMT 00881 #define NPY_COMPLEX64_FMT NPY_CDOUBLE_FMT 00882 #endif 00883 #elif NPY_BITSOF_DOUBLE == 64 00884 #ifndef NPY_FLOAT64 00885 #define NPY_FLOAT64 NPY_DOUBLE 00886 #define NPY_COMPLEX128 NPY_CDOUBLE 00887 typedef double npy_float64; 00888 typedef npy_cdouble npy_complex128; 00889 # define PyFloat64ScalarObject PyDoubleScalarObject 00890 # define PyComplex128ScalarObject PyCDoubleScalarObject 00891 # define PyFloat64ArrType_Type PyDoubleArrType_Type 00892 # define PyComplex128ArrType_Type PyCDoubleArrType_Type 00893 #define NPY_FLOAT64_FMT NPY_DOUBLE_FMT 00894 #define NPY_COMPLEX128_FMT NPY_CDOUBLE_FMT 00895 #endif 00896 #elif NPY_BITSOF_DOUBLE == 80 00897 #ifndef NPY_FLOAT80 00898 #define NPY_FLOAT80 NPY_DOUBLE 00899 #define NPY_COMPLEX160 NPY_CDOUBLE 00900 typedef double npy_float80; 00901 typedef npy_cdouble npy_complex160; 00902 # define PyFloat80ScalarObject PyDoubleScalarObject 00903 # define PyComplex160ScalarObject PyCDoubleScalarObject 00904 # define PyFloat80ArrType_Type PyDoubleArrType_Type 00905 # define PyComplex160ArrType_Type PyCDoubleArrType_Type 00906 #define NPY_FLOAT80_FMT NPY_DOUBLE_FMT 00907 #define NPY_COMPLEX160_FMT NPY_CDOUBLE_FMT 00908 #endif 00909 #elif NPY_BITSOF_DOUBLE == 96 00910 #ifndef NPY_FLOAT96 00911 #define NPY_FLOAT96 NPY_DOUBLE 00912 #define NPY_COMPLEX192 NPY_CDOUBLE 00913 typedef double npy_float96; 00914 typedef npy_cdouble npy_complex192; 00915 # define PyFloat96ScalarObject PyDoubleScalarObject 00916 # define PyComplex192ScalarObject PyCDoubleScalarObject 00917 # define PyFloat96ArrType_Type PyDoubleArrType_Type 00918 # define PyComplex192ArrType_Type PyCDoubleArrType_Type 00919 #define NPY_FLOAT96_FMT NPY_DOUBLE_FMT 00920 #define NPY_COMPLEX192_FMT NPY_CDOUBLE_FMT 00921 #endif 00922 #elif NPY_BITSOF_DOUBLE == 128 00923 #ifndef NPY_FLOAT128 00924 #define NPY_FLOAT128 NPY_DOUBLE 00925 #define NPY_COMPLEX256 NPY_CDOUBLE 00926 typedef double npy_float128; 00927 typedef npy_cdouble npy_complex256; 00928 # define PyFloat128ScalarObject PyDoubleScalarObject 00929 # define PyComplex256ScalarObject PyCDoubleScalarObject 00930 # define PyFloat128ArrType_Type PyDoubleArrType_Type 00931 # define PyComplex256ArrType_Type PyCDoubleArrType_Type 00932 #define NPY_FLOAT128_FMT NPY_DOUBLE_FMT 00933 #define NPY_COMPLEX256_FMT NPY_CDOUBLE_FMT 00934 #endif 00935 #endif 00936 00937 00938 00939 #if NPY_BITSOF_FLOAT == 32 00940 #ifndef NPY_FLOAT32 00941 #define NPY_FLOAT32 NPY_FLOAT 00942 #define NPY_COMPLEX64 NPY_CFLOAT 00943 typedef float npy_float32; 00944 typedef npy_cfloat npy_complex64; 00945 # define PyFloat32ScalarObject PyFloatScalarObject 00946 # define PyComplex64ScalarObject PyCFloatScalarObject 00947 # define PyFloat32ArrType_Type PyFloatArrType_Type 00948 # define PyComplex64ArrType_Type PyCFloatArrType_Type 00949 #define NPY_FLOAT32_FMT NPY_FLOAT_FMT 00950 #define NPY_COMPLEX64_FMT NPY_CFLOAT_FMT 00951 #endif 00952 #elif NPY_BITSOF_FLOAT == 64 00953 #ifndef NPY_FLOAT64 00954 #define NPY_FLOAT64 NPY_FLOAT 00955 #define NPY_COMPLEX128 NPY_CFLOAT 00956 typedef float npy_float64; 00957 typedef npy_cfloat npy_complex128; 00958 # define PyFloat64ScalarObject PyFloatScalarObject 00959 # define PyComplex128ScalarObject PyCFloatScalarObject 00960 # define PyFloat64ArrType_Type PyFloatArrType_Type 00961 # define PyComplex128ArrType_Type PyCFloatArrType_Type 00962 #define NPY_FLOAT64_FMT NPY_FLOAT_FMT 00963 #define NPY_COMPLEX128_FMT NPY_CFLOAT_FMT 00964 #endif 00965 #elif NPY_BITSOF_FLOAT == 80 00966 #ifndef NPY_FLOAT80 00967 #define NPY_FLOAT80 NPY_FLOAT 00968 #define NPY_COMPLEX160 NPY_CFLOAT 00969 typedef float npy_float80; 00970 typedef npy_cfloat npy_complex160; 00971 # define PyFloat80ScalarObject PyFloatScalarObject 00972 # define PyComplex160ScalarObject PyCFloatScalarObject 00973 # define PyFloat80ArrType_Type PyFloatArrType_Type 00974 # define PyComplex160ArrType_Type PyCFloatArrType_Type 00975 #define NPY_FLOAT80_FMT NPY_FLOAT_FMT 00976 #define NPY_COMPLEX160_FMT NPY_CFLOAT_FMT 00977 #endif 00978 #elif NPY_BITSOF_FLOAT == 96 00979 #ifndef NPY_FLOAT96 00980 #define NPY_FLOAT96 NPY_FLOAT 00981 #define NPY_COMPLEX192 NPY_CFLOAT 00982 typedef float npy_float96; 00983 typedef npy_cfloat npy_complex192; 00984 # define PyFloat96ScalarObject PyFloatScalarObject 00985 # define PyComplex192ScalarObject PyCFloatScalarObject 00986 # define PyFloat96ArrType_Type PyFloatArrType_Type 00987 # define PyComplex192ArrType_Type PyCFloatArrType_Type 00988 #define NPY_FLOAT96_FMT NPY_FLOAT_FMT 00989 #define NPY_COMPLEX192_FMT NPY_CFLOAT_FMT 00990 #endif 00991 #elif NPY_BITSOF_FLOAT == 128 00992 #ifndef NPY_FLOAT128 00993 #define NPY_FLOAT128 NPY_FLOAT 00994 #define NPY_COMPLEX256 NPY_CFLOAT 00995 typedef float npy_float128; 00996 typedef npy_cfloat npy_complex256; 00997 # define PyFloat128ScalarObject PyFloatScalarObject 00998 # define PyComplex256ScalarObject PyCFloatScalarObject 00999 # define PyFloat128ArrType_Type PyFloatArrType_Type 01000 # define PyComplex256ArrType_Type PyCFloatArrType_Type 01001 #define NPY_FLOAT128_FMT NPY_FLOAT_FMT 01002 #define NPY_COMPLEX256_FMT NPY_CFLOAT_FMT 01003 #endif 01004 #endif 01005 01006 /* half/float16 isn't a floating-point type in C */ 01007 #define NPY_FLOAT16 NPY_HALF 01008 typedef npy_uint16 npy_half; 01009 typedef npy_half npy_float16; 01010 01011 #if NPY_BITSOF_LONGDOUBLE == 32 01012 #ifndef NPY_FLOAT32 01013 #define NPY_FLOAT32 NPY_LONGDOUBLE 01014 #define NPY_COMPLEX64 NPY_CLONGDOUBLE 01015 typedef npy_longdouble npy_float32; 01016 typedef npy_clongdouble npy_complex64; 01017 # define PyFloat32ScalarObject PyLongDoubleScalarObject 01018 # define PyComplex64ScalarObject PyCLongDoubleScalarObject 01019 # define PyFloat32ArrType_Type PyLongDoubleArrType_Type 01020 # define PyComplex64ArrType_Type PyCLongDoubleArrType_Type 01021 #define NPY_FLOAT32_FMT NPY_LONGDOUBLE_FMT 01022 #define NPY_COMPLEX64_FMT NPY_CLONGDOUBLE_FMT 01023 #endif 01024 #elif NPY_BITSOF_LONGDOUBLE == 64 01025 #ifndef NPY_FLOAT64 01026 #define NPY_FLOAT64 NPY_LONGDOUBLE 01027 #define NPY_COMPLEX128 NPY_CLONGDOUBLE 01028 typedef npy_longdouble npy_float64; 01029 typedef npy_clongdouble npy_complex128; 01030 # define PyFloat64ScalarObject PyLongDoubleScalarObject 01031 # define PyComplex128ScalarObject PyCLongDoubleScalarObject 01032 # define PyFloat64ArrType_Type PyLongDoubleArrType_Type 01033 # define PyComplex128ArrType_Type PyCLongDoubleArrType_Type 01034 #define NPY_FLOAT64_FMT NPY_LONGDOUBLE_FMT 01035 #define NPY_COMPLEX128_FMT NPY_CLONGDOUBLE_FMT 01036 #endif 01037 #elif NPY_BITSOF_LONGDOUBLE == 80 01038 #ifndef NPY_FLOAT80 01039 #define NPY_FLOAT80 NPY_LONGDOUBLE 01040 #define NPY_COMPLEX160 NPY_CLONGDOUBLE 01041 typedef npy_longdouble npy_float80; 01042 typedef npy_clongdouble npy_complex160; 01043 # define PyFloat80ScalarObject PyLongDoubleScalarObject 01044 # define PyComplex160ScalarObject PyCLongDoubleScalarObject 01045 # define PyFloat80ArrType_Type PyLongDoubleArrType_Type 01046 # define PyComplex160ArrType_Type PyCLongDoubleArrType_Type 01047 #define NPY_FLOAT80_FMT NPY_LONGDOUBLE_FMT 01048 #define NPY_COMPLEX160_FMT NPY_CLONGDOUBLE_FMT 01049 #endif 01050 #elif NPY_BITSOF_LONGDOUBLE == 96 01051 #ifndef NPY_FLOAT96 01052 #define NPY_FLOAT96 NPY_LONGDOUBLE 01053 #define NPY_COMPLEX192 NPY_CLONGDOUBLE 01054 typedef npy_longdouble npy_float96; 01055 typedef npy_clongdouble npy_complex192; 01056 # define PyFloat96ScalarObject PyLongDoubleScalarObject 01057 # define PyComplex192ScalarObject PyCLongDoubleScalarObject 01058 # define PyFloat96ArrType_Type PyLongDoubleArrType_Type 01059 # define PyComplex192ArrType_Type PyCLongDoubleArrType_Type 01060 #define NPY_FLOAT96_FMT NPY_LONGDOUBLE_FMT 01061 #define NPY_COMPLEX192_FMT NPY_CLONGDOUBLE_FMT 01062 #endif 01063 #elif NPY_BITSOF_LONGDOUBLE == 128 01064 #ifndef NPY_FLOAT128 01065 #define NPY_FLOAT128 NPY_LONGDOUBLE 01066 #define NPY_COMPLEX256 NPY_CLONGDOUBLE 01067 typedef npy_longdouble npy_float128; 01068 typedef npy_clongdouble npy_complex256; 01069 # define PyFloat128ScalarObject PyLongDoubleScalarObject 01070 # define PyComplex256ScalarObject PyCLongDoubleScalarObject 01071 # define PyFloat128ArrType_Type PyLongDoubleArrType_Type 01072 # define PyComplex256ArrType_Type PyCLongDoubleArrType_Type 01073 #define NPY_FLOAT128_FMT NPY_LONGDOUBLE_FMT 01074 #define NPY_COMPLEX256_FMT NPY_CLONGDOUBLE_FMT 01075 #endif 01076 #elif NPY_BITSOF_LONGDOUBLE == 256 01077 #define NPY_FLOAT256 NPY_LONGDOUBLE 01078 #define NPY_COMPLEX512 NPY_CLONGDOUBLE 01079 typedef npy_longdouble npy_float256; 01080 typedef npy_clongdouble npy_complex512; 01081 # define PyFloat256ScalarObject PyLongDoubleScalarObject 01082 # define PyComplex512ScalarObject PyCLongDoubleScalarObject 01083 # define PyFloat256ArrType_Type PyLongDoubleArrType_Type 01084 # define PyComplex512ArrType_Type PyCLongDoubleArrType_Type 01085 #define NPY_FLOAT256_FMT NPY_LONGDOUBLE_FMT 01086 #define NPY_COMPLEX512_FMT NPY_CLONGDOUBLE_FMT 01087 #endif 01088 01089 /* datetime typedefs */ 01090 typedef npy_int64 npy_timedelta; 01091 typedef npy_int64 npy_datetime; 01092 #define NPY_DATETIME_FMT NPY_INT64_FMT 01093 #define NPY_TIMEDELTA_FMT NPY_INT64_FMT 01094 01095 /* End of typedefs for numarray style bit-width names */ 01096 01097 #endif