numpy 2.0.0
|
00001 #ifndef _NPY_COMMON_H_ 00002 #define _NPY_COMMON_H_ 00003 00004 /* This is auto-generated */ 00005 #include "numpyconfig.h" 00006 00007 #if defined(_MSC_VER) 00008 #define NPY_INLINE __inline 00009 #elif defined(__GNUC__) 00010 #if defined(__STRICT_ANSI__) 00011 #define NPY_INLINE __inline__ 00012 #else 00013 #define NPY_INLINE inline 00014 #endif 00015 #else 00016 #define NPY_INLINE 00017 #endif 00018 00019 /* enums for detected endianness */ 00020 enum { 00021 NPY_CPU_UNKNOWN_ENDIAN, 00022 NPY_CPU_LITTLE, 00023 NPY_CPU_BIG 00024 }; 00025 00026 /* Some platforms don't define bool, long long, or long double. 00027 Handle that here. 00028 */ 00029 00030 #define NPY_BYTE_FMT "hhd" 00031 #define NPY_UBYTE_FMT "hhu" 00032 #define NPY_SHORT_FMT "hd" 00033 #define NPY_USHORT_FMT "hu" 00034 #define NPY_INT_FMT "d" 00035 #define NPY_UINT_FMT "u" 00036 #define NPY_LONG_FMT "ld" 00037 #define NPY_ULONG_FMT "lu" 00038 #define NPY_HALF_FMT "g" 00039 #define NPY_FLOAT_FMT "g" 00040 #define NPY_DOUBLE_FMT "g" 00041 00042 00043 #ifdef PY_LONG_LONG 00044 typedef PY_LONG_LONG npy_longlong; 00045 typedef unsigned PY_LONG_LONG npy_ulonglong; 00046 # ifdef _MSC_VER 00047 # define NPY_LONGLONG_FMT "I64d" 00048 # define NPY_ULONGLONG_FMT "I64u" 00049 # define NPY_LONGLONG_SUFFIX(x) (x##i64) 00050 # define NPY_ULONGLONG_SUFFIX(x) (x##Ui64) 00051 # else 00052 /* #define LONGLONG_FMT "lld" Another possible variant 00053 #define ULONGLONG_FMT "llu" 00054 00055 #define LONGLONG_FMT "qd" -- BSD perhaps? 00056 #define ULONGLONG_FMT "qu" 00057 */ 00058 # define NPY_LONGLONG_FMT "Ld" 00059 # define NPY_ULONGLONG_FMT "Lu" 00060 # define NPY_LONGLONG_SUFFIX(x) (x##LL) 00061 # define NPY_ULONGLONG_SUFFIX(x) (x##ULL) 00062 # endif 00063 #else 00064 typedef long npy_longlong; 00065 typedef unsigned long npy_ulonglong; 00066 # define NPY_LONGLONG_SUFFIX(x) (x##L) 00067 # define NPY_ULONGLONG_SUFFIX(x) (x##UL) 00068 #endif 00069 00070 00071 typedef unsigned char npy_bool; 00072 #define NPY_FALSE 0 00073 #define NPY_TRUE 1 00074 00075 00076 #if NPY_SIZEOF_LONGDOUBLE == NPY_SIZEOF_DOUBLE 00077 typedef double npy_longdouble; 00078 #define NPY_LONGDOUBLE_FMT "g" 00079 #else 00080 typedef long double npy_longdouble; 00081 #define NPY_LONGDOUBLE_FMT "Lg" 00082 #endif 00083 00084 #ifndef Py_USING_UNICODE 00085 #error Must use Python with unicode enabled. 00086 #endif 00087 00088 00089 typedef signed char npy_byte; 00090 typedef unsigned char npy_ubyte; 00091 typedef unsigned short npy_ushort; 00092 typedef unsigned int npy_uint; 00093 typedef unsigned long npy_ulong; 00094 00095 /* These are for completeness */ 00096 typedef float npy_float; 00097 typedef double npy_double; 00098 typedef short npy_short; 00099 typedef int npy_int; 00100 typedef long npy_long; 00101 00102 /* 00103 * Disabling C99 complex usage: a lot of C code in numpy/scipy rely on being 00104 * able to do .real/.imag. Will have to convert code first. 00105 */ 00106 #if 0 00107 #if defined(NPY_USE_C99_COMPLEX) && defined(NPY_HAVE_COMPLEX_DOUBLE) 00108 typedef complex npy_cdouble; 00109 #else 00110 typedef struct { double real, imag; } npy_cdouble; 00111 #endif 00112 00113 #if defined(NPY_USE_C99_COMPLEX) && defined(NPY_HAVE_COMPLEX_FLOAT) 00114 typedef complex float npy_cfloat; 00115 #else 00116 typedef struct { float real, imag; } npy_cfloat; 00117 #endif 00118 00119 #if defined(NPY_USE_C99_COMPLEX) && defined(NPY_HAVE_COMPLEX_LONG_DOUBLE) 00120 typedef complex long double npy_clongdouble; 00121 #else 00122 typedef struct {npy_longdouble real, imag;} npy_clongdouble; 00123 #endif 00124 #endif 00125 #if NPY_SIZEOF_COMPLEX_DOUBLE != 2 * NPY_SIZEOF_DOUBLE 00126 #error npy_cdouble definition is not compatible with C99 complex definition ! \ 00127 Please contact Numpy maintainers and give detailed information about your \ 00128 compiler and platform 00129 #endif 00130 typedef struct { double real, imag; } npy_cdouble; 00131 00132 #if NPY_SIZEOF_COMPLEX_FLOAT != 2 * NPY_SIZEOF_FLOAT 00133 #error npy_cfloat definition is not compatible with C99 complex definition ! \ 00134 Please contact Numpy maintainers and give detailed information about your \ 00135 compiler and platform 00136 #endif 00137 typedef struct { float real, imag; } npy_cfloat; 00138 00139 #if NPY_SIZEOF_COMPLEX_LONGDOUBLE != 2 * NPY_SIZEOF_LONGDOUBLE 00140 #error npy_clongdouble definition is not compatible with C99 complex definition ! \ 00141 Please contact Numpy maintainers and give detailed information about your \ 00142 compiler and platform 00143 #endif 00144 typedef struct { npy_longdouble real, imag; } npy_clongdouble; 00145 00146 /* 00147 * numarray-style bit-width typedefs 00148 */ 00149 #define NPY_MAX_INT8 127 00150 #define NPY_MIN_INT8 -128 00151 #define NPY_MAX_UINT8 255 00152 #define NPY_MAX_INT16 32767 00153 #define NPY_MIN_INT16 -32768 00154 #define NPY_MAX_UINT16 65535 00155 #define NPY_MAX_INT32 2147483647 00156 #define NPY_MIN_INT32 (-NPY_MAX_INT32 - 1) 00157 #define NPY_MAX_UINT32 4294967295U 00158 #define NPY_MAX_INT64 NPY_LONGLONG_SUFFIX(9223372036854775807) 00159 #define NPY_MIN_INT64 (-NPY_MAX_INT64 - NPY_LONGLONG_SUFFIX(1)) 00160 #define NPY_MAX_UINT64 NPY_ULONGLONG_SUFFIX(18446744073709551615) 00161 #define NPY_MAX_INT128 NPY_LONGLONG_SUFFIX(85070591730234615865843651857942052864) 00162 #define NPY_MIN_INT128 (-NPY_MAX_INT128 - NPY_LONGLONG_SUFFIX(1)) 00163 #define NPY_MAX_UINT128 NPY_ULONGLONG_SUFFIX(170141183460469231731687303715884105728) 00164 #define NPY_MAX_INT256 NPY_LONGLONG_SUFFIX(57896044618658097711785492504343953926634992332820282019728792003956564819967) 00165 #define NPY_MIN_INT256 (-NPY_MAX_INT256 - NPY_LONGLONG_SUFFIX(1)) 00166 #define NPY_MAX_UINT256 NPY_ULONGLONG_SUFFIX(115792089237316195423570985008687907853269984665640564039457584007913129639935) 00167 #define NPY_MIN_DATETIME NPY_MIN_INT64 00168 #define NPY_MAX_DATETIME NPY_MAX_INT64 00169 #define NPY_MIN_TIMEDELTA NPY_MIN_INT64 00170 #define NPY_MAX_TIMEDELTA NPY_MAX_INT64 00171 00172 /* Need to find the number of bits for each type and 00173 make definitions accordingly. 00174 00175 C states that sizeof(char) == 1 by definition 00176 00177 So, just using the sizeof keyword won't help. 00178 00179 It also looks like Python itself uses sizeof(char) quite a 00180 bit, which by definition should be 1 all the time. 00181 00182 Idea: Make Use of CHAR_BIT which should tell us how many 00183 BITS per CHARACTER 00184 */ 00185 00186 /* Include platform definitions -- These are in the C89/90 standard */ 00187 #include <limits.h> 00188 #define NPY_MAX_BYTE SCHAR_MAX 00189 #define NPY_MIN_BYTE SCHAR_MIN 00190 #define NPY_MAX_UBYTE UCHAR_MAX 00191 #define NPY_MAX_SHORT SHRT_MAX 00192 #define NPY_MIN_SHORT SHRT_MIN 00193 #define NPY_MAX_USHORT USHRT_MAX 00194 #define NPY_MAX_INT INT_MAX 00195 #ifndef INT_MIN 00196 #define INT_MIN (-INT_MAX - 1) 00197 #endif 00198 #define NPY_MIN_INT INT_MIN 00199 #define NPY_MAX_UINT UINT_MAX 00200 #define NPY_MAX_LONG LONG_MAX 00201 #define NPY_MIN_LONG LONG_MIN 00202 #define NPY_MAX_ULONG ULONG_MAX 00203 00204 #define NPY_SIZEOF_HALF 2 00205 #define NPY_SIZEOF_DATETIME 8 00206 #define NPY_SIZEOF_TIMEDELTA 8 00207 00208 #define NPY_BITSOF_BOOL (sizeof(npy_bool)*CHAR_BIT) 00209 #define NPY_BITSOF_CHAR CHAR_BIT 00210 #define NPY_BITSOF_SHORT (NPY_SIZEOF_SHORT * CHAR_BIT) 00211 #define NPY_BITSOF_INT (NPY_SIZEOF_INT * CHAR_BIT) 00212 #define NPY_BITSOF_LONG (NPY_SIZEOF_LONG * CHAR_BIT) 00213 #define NPY_BITSOF_LONGLONG (NPY_SIZEOF_LONGLONG * CHAR_BIT) 00214 #define NPY_BITSOF_HALF (NPY_SIZEOF_HALF * CHAR_BIT) 00215 #define NPY_BITSOF_FLOAT (NPY_SIZEOF_FLOAT * CHAR_BIT) 00216 #define NPY_BITSOF_DOUBLE (NPY_SIZEOF_DOUBLE * CHAR_BIT) 00217 #define NPY_BITSOF_LONGDOUBLE (NPY_SIZEOF_LONGDOUBLE * CHAR_BIT) 00218 #define NPY_BITSOF_DATETIME (NPY_SIZEOF_DATETIME * CHAR_BIT) 00219 #define NPY_BITSOF_TIMEDELTA (NPY_SIZEOF_TIMEDELTA * CHAR_BIT) 00220 00221 #if NPY_BITSOF_LONG == 8 00222 #define NPY_INT8 NPY_LONG 00223 #define NPY_UINT8 NPY_ULONG 00224 typedef long npy_int8; 00225 typedef unsigned long npy_uint8; 00226 #define PyInt8ScalarObject PyLongScalarObject 00227 #define PyInt8ArrType_Type PyLongArrType_Type 00228 #define PyUInt8ScalarObject PyULongScalarObject 00229 #define PyUInt8ArrType_Type PyULongArrType_Type 00230 #define NPY_INT8_FMT NPY_LONG_FMT 00231 #define NPY_UINT8_FMT NPY_ULONG_FMT 00232 #elif NPY_BITSOF_LONG == 16 00233 #define NPY_INT16 NPY_LONG 00234 #define NPY_UINT16 NPY_ULONG 00235 typedef long npy_int16; 00236 typedef unsigned long npy_uint16; 00237 #define PyInt16ScalarObject PyLongScalarObject 00238 #define PyInt16ArrType_Type PyLongArrType_Type 00239 #define PyUInt16ScalarObject PyULongScalarObject 00240 #define PyUInt16ArrType_Type PyULongArrType_Type 00241 #define NPY_INT16_FMT NPY_LONG_FMT 00242 #define NPY_UINT16_FMT NPY_ULONG_FMT 00243 #elif NPY_BITSOF_LONG == 32 00244 #define NPY_INT32 NPY_LONG 00245 #define NPY_UINT32 NPY_ULONG 00246 typedef long npy_int32; 00247 typedef unsigned long npy_uint32; 00248 typedef unsigned long npy_ucs4; 00249 #define PyInt32ScalarObject PyLongScalarObject 00250 #define PyInt32ArrType_Type PyLongArrType_Type 00251 #define PyUInt32ScalarObject PyULongScalarObject 00252 #define PyUInt32ArrType_Type PyULongArrType_Type 00253 #define NPY_INT32_FMT NPY_LONG_FMT 00254 #define NPY_UINT32_FMT NPY_ULONG_FMT 00255 #elif NPY_BITSOF_LONG == 64 00256 #define NPY_INT64 NPY_LONG 00257 #define NPY_UINT64 NPY_ULONG 00258 typedef long npy_int64; 00259 typedef unsigned long npy_uint64; 00260 #define PyInt64ScalarObject PyLongScalarObject 00261 #define PyInt64ArrType_Type PyLongArrType_Type 00262 #define PyUInt64ScalarObject PyULongScalarObject 00263 #define PyUInt64ArrType_Type PyULongArrType_Type 00264 #define NPY_INT64_FMT NPY_LONG_FMT 00265 #define NPY_UINT64_FMT NPY_ULONG_FMT 00266 #define MyPyLong_FromInt64 PyLong_FromLong 00267 #define MyPyLong_AsInt64 PyLong_AsLong 00268 #elif NPY_BITSOF_LONG == 128 00269 #define NPY_INT128 NPY_LONG 00270 #define NPY_UINT128 NPY_ULONG 00271 typedef long npy_int128; 00272 typedef unsigned long npy_uint128; 00273 #define PyInt128ScalarObject PyLongScalarObject 00274 #define PyInt128ArrType_Type PyLongArrType_Type 00275 #define PyUInt128ScalarObject PyULongScalarObject 00276 #define PyUInt128ArrType_Type PyULongArrType_Type 00277 #define NPY_INT128_FMT NPY_LONG_FMT 00278 #define NPY_UINT128_FMT NPY_ULONG_FMT 00279 #endif 00280 00281 #if NPY_BITSOF_LONGLONG == 8 00282 # ifndef NPY_INT8 00283 # define NPY_INT8 NPY_LONGLONG 00284 # define NPY_UINT8 NPY_ULONGLONG 00285 typedef npy_longlong npy_int8; 00286 typedef npy_ulonglong npy_uint8; 00287 # define PyInt8ScalarObject PyLongLongScalarObject 00288 # define PyInt8ArrType_Type PyLongLongArrType_Type 00289 # define PyUInt8ScalarObject PyULongLongScalarObject 00290 # define PyUInt8ArrType_Type PyULongLongArrType_Type 00291 #define NPY_INT8_FMT NPY_LONGLONG_FMT 00292 #define NPY_UINT8_FMT NPY_ULONGLONG_FMT 00293 # endif 00294 # define NPY_MAX_LONGLONG NPY_MAX_INT8 00295 # define NPY_MIN_LONGLONG NPY_MIN_INT8 00296 # define NPY_MAX_ULONGLONG NPY_MAX_UINT8 00297 #elif NPY_BITSOF_LONGLONG == 16 00298 # ifndef NPY_INT16 00299 # define NPY_INT16 NPY_LONGLONG 00300 # define NPY_UINT16 NPY_ULONGLONG 00301 typedef npy_longlong npy_int16; 00302 typedef npy_ulonglong npy_uint16; 00303 # define PyInt16ScalarObject PyLongLongScalarObject 00304 # define PyInt16ArrType_Type PyLongLongArrType_Type 00305 # define PyUInt16ScalarObject PyULongLongScalarObject 00306 # define PyUInt16ArrType_Type PyULongLongArrType_Type 00307 #define NPY_INT16_FMT NPY_LONGLONG_FMT 00308 #define NPY_UINT16_FMT NPY_ULONGLONG_FMT 00309 # endif 00310 # define NPY_MAX_LONGLONG NPY_MAX_INT16 00311 # define NPY_MIN_LONGLONG NPY_MIN_INT16 00312 # define NPY_MAX_ULONGLONG NPY_MAX_UINT16 00313 #elif NPY_BITSOF_LONGLONG == 32 00314 # ifndef NPY_INT32 00315 # define NPY_INT32 NPY_LONGLONG 00316 # define NPY_UINT32 NPY_ULONGLONG 00317 typedef npy_longlong npy_int32; 00318 typedef npy_ulonglong npy_uint32; 00319 typedef npy_ulonglong npy_ucs4; 00320 # define PyInt32ScalarObject PyLongLongScalarObject 00321 # define PyInt32ArrType_Type PyLongLongArrType_Type 00322 # define PyUInt32ScalarObject PyULongLongScalarObject 00323 # define PyUInt32ArrType_Type PyULongLongArrType_Type 00324 #define NPY_INT32_FMT NPY_LONGLONG_FMT 00325 #define NPY_UINT32_FMT NPY_ULONGLONG_FMT 00326 # endif 00327 # define NPY_MAX_LONGLONG NPY_MAX_INT32 00328 # define NPY_MIN_LONGLONG NPY_MIN_INT32 00329 # define NPY_MAX_ULONGLONG NPY_MAX_UINT32 00330 #elif NPY_BITSOF_LONGLONG == 64 00331 # ifndef NPY_INT64 00332 # define NPY_INT64 NPY_LONGLONG 00333 # define NPY_UINT64 NPY_ULONGLONG 00334 typedef npy_longlong npy_int64; 00335 typedef npy_ulonglong npy_uint64; 00336 # define PyInt64ScalarObject PyLongLongScalarObject 00337 # define PyInt64ArrType_Type PyLongLongArrType_Type 00338 # define PyUInt64ScalarObject PyULongLongScalarObject 00339 # define PyUInt64ArrType_Type PyULongLongArrType_Type 00340 #define NPY_INT64_FMT NPY_LONGLONG_FMT 00341 #define NPY_UINT64_FMT NPY_ULONGLONG_FMT 00342 # define MyPyLong_FromInt64 PyLong_FromLongLong 00343 # define MyPyLong_AsInt64 PyLong_AsLongLong 00344 # endif 00345 # define NPY_MAX_LONGLONG NPY_MAX_INT64 00346 # define NPY_MIN_LONGLONG NPY_MIN_INT64 00347 # define NPY_MAX_ULONGLONG NPY_MAX_UINT64 00348 #elif NPY_BITSOF_LONGLONG == 128 00349 # ifndef NPY_INT128 00350 # define NPY_INT128 NPY_LONGLONG 00351 # define NPY_UINT128 NPY_ULONGLONG 00352 typedef npy_longlong npy_int128; 00353 typedef npy_ulonglong npy_uint128; 00354 # define PyInt128ScalarObject PyLongLongScalarObject 00355 # define PyInt128ArrType_Type PyLongLongArrType_Type 00356 # define PyUInt128ScalarObject PyULongLongScalarObject 00357 # define PyUInt128ArrType_Type PyULongLongArrType_Type 00358 #define NPY_INT128_FMT NPY_LONGLONG_FMT 00359 #define NPY_UINT128_FMT NPY_ULONGLONG_FMT 00360 # endif 00361 # define NPY_MAX_LONGLONG NPY_MAX_INT128 00362 # define NPY_MIN_LONGLONG NPY_MIN_INT128 00363 # define NPY_MAX_ULONGLONG NPY_MAX_UINT128 00364 #elif NPY_BITSOF_LONGLONG == 256 00365 # define NPY_INT256 NPY_LONGLONG 00366 # define NPY_UINT256 NPY_ULONGLONG 00367 typedef npy_longlong npy_int256; 00368 typedef npy_ulonglong npy_uint256; 00369 # define PyInt256ScalarObject PyLongLongScalarObject 00370 # define PyInt256ArrType_Type PyLongLongArrType_Type 00371 # define PyUInt256ScalarObject PyULongLongScalarObject 00372 # define PyUInt256ArrType_Type PyULongLongArrType_Type 00373 #define NPY_INT256_FMT NPY_LONGLONG_FMT 00374 #define NPY_UINT256_FMT NPY_ULONGLONG_FMT 00375 # define NPY_MAX_LONGLONG NPY_MAX_INT256 00376 # define NPY_MIN_LONGLONG NPY_MIN_INT256 00377 # define NPY_MAX_ULONGLONG NPY_MAX_UINT256 00378 #endif 00379 00380 #if NPY_BITSOF_INT == 8 00381 #ifndef NPY_INT8 00382 #define NPY_INT8 NPY_INT 00383 #define NPY_UINT8 NPY_UINT 00384 typedef int npy_int8; 00385 typedef unsigned int npy_uint8; 00386 # define PyInt8ScalarObject PyIntScalarObject 00387 # define PyInt8ArrType_Type PyIntArrType_Type 00388 # define PyUInt8ScalarObject PyUIntScalarObject 00389 # define PyUInt8ArrType_Type PyUIntArrType_Type 00390 #define NPY_INT8_FMT NPY_INT_FMT 00391 #define NPY_UINT8_FMT NPY_UINT_FMT 00392 #endif 00393 #elif NPY_BITSOF_INT == 16 00394 #ifndef NPY_INT16 00395 #define NPY_INT16 NPY_INT 00396 #define NPY_UINT16 NPY_UINT 00397 typedef int npy_int16; 00398 typedef unsigned int npy_uint16; 00399 # define PyInt16ScalarObject PyIntScalarObject 00400 # define PyInt16ArrType_Type PyIntArrType_Type 00401 # define PyUInt16ScalarObject PyIntUScalarObject 00402 # define PyUInt16ArrType_Type PyIntUArrType_Type 00403 #define NPY_INT16_FMT NPY_INT_FMT 00404 #define NPY_UINT16_FMT NPY_UINT_FMT 00405 #endif 00406 #elif NPY_BITSOF_INT == 32 00407 #ifndef NPY_INT32 00408 #define NPY_INT32 NPY_INT 00409 #define NPY_UINT32 NPY_UINT 00410 typedef int npy_int32; 00411 typedef unsigned int npy_uint32; 00412 typedef unsigned int npy_ucs4; 00413 # define PyInt32ScalarObject PyIntScalarObject 00414 # define PyInt32ArrType_Type PyIntArrType_Type 00415 # define PyUInt32ScalarObject PyUIntScalarObject 00416 # define PyUInt32ArrType_Type PyUIntArrType_Type 00417 #define NPY_INT32_FMT NPY_INT_FMT 00418 #define NPY_UINT32_FMT NPY_UINT_FMT 00419 #endif 00420 #elif NPY_BITSOF_INT == 64 00421 #ifndef NPY_INT64 00422 #define NPY_INT64 NPY_INT 00423 #define NPY_UINT64 NPY_UINT 00424 typedef int npy_int64; 00425 typedef unsigned int npy_uint64; 00426 # define PyInt64ScalarObject PyIntScalarObject 00427 # define PyInt64ArrType_Type PyIntArrType_Type 00428 # define PyUInt64ScalarObject PyUIntScalarObject 00429 # define PyUInt64ArrType_Type PyUIntArrType_Type 00430 #define NPY_INT64_FMT NPY_INT_FMT 00431 #define NPY_UINT64_FMT NPY_UINT_FMT 00432 # define MyPyLong_FromInt64 PyLong_FromLong 00433 # define MyPyLong_AsInt64 PyLong_AsLong 00434 #endif 00435 #elif NPY_BITSOF_INT == 128 00436 #ifndef NPY_INT128 00437 #define NPY_INT128 NPY_INT 00438 #define NPY_UINT128 NPY_UINT 00439 typedef int npy_int128; 00440 typedef unsigned int npy_uint128; 00441 # define PyInt128ScalarObject PyIntScalarObject 00442 # define PyInt128ArrType_Type PyIntArrType_Type 00443 # define PyUInt128ScalarObject PyUIntScalarObject 00444 # define PyUInt128ArrType_Type PyUIntArrType_Type 00445 #define NPY_INT128_FMT NPY_INT_FMT 00446 #define NPY_UINT128_FMT NPY_UINT_FMT 00447 #endif 00448 #endif 00449 00450 #if NPY_BITSOF_SHORT == 8 00451 #ifndef NPY_INT8 00452 #define NPY_INT8 NPY_SHORT 00453 #define NPY_UINT8 NPY_USHORT 00454 typedef short npy_int8; 00455 typedef unsigned short npy_uint8; 00456 # define PyInt8ScalarObject PyShortScalarObject 00457 # define PyInt8ArrType_Type PyShortArrType_Type 00458 # define PyUInt8ScalarObject PyUShortScalarObject 00459 # define PyUInt8ArrType_Type PyUShortArrType_Type 00460 #define NPY_INT8_FMT NPY_SHORT_FMT 00461 #define NPY_UINT8_FMT NPY_USHORT_FMT 00462 #endif 00463 #elif NPY_BITSOF_SHORT == 16 00464 #ifndef NPY_INT16 00465 #define NPY_INT16 NPY_SHORT 00466 #define NPY_UINT16 NPY_USHORT 00467 typedef short npy_int16; 00468 typedef unsigned short npy_uint16; 00469 # define PyInt16ScalarObject PyShortScalarObject 00470 # define PyInt16ArrType_Type PyShortArrType_Type 00471 # define PyUInt16ScalarObject PyUShortScalarObject 00472 # define PyUInt16ArrType_Type PyUShortArrType_Type 00473 #define NPY_INT16_FMT NPY_SHORT_FMT 00474 #define NPY_UINT16_FMT NPY_USHORT_FMT 00475 #endif 00476 #elif NPY_BITSOF_SHORT == 32 00477 #ifndef NPY_INT32 00478 #define NPY_INT32 NPY_SHORT 00479 #define NPY_UINT32 NPY_USHORT 00480 typedef short npy_int32; 00481 typedef unsigned short npy_uint32; 00482 typedef unsigned short npy_ucs4; 00483 # define PyInt32ScalarObject PyShortScalarObject 00484 # define PyInt32ArrType_Type PyShortArrType_Type 00485 # define PyUInt32ScalarObject PyUShortScalarObject 00486 # define PyUInt32ArrType_Type PyUShortArrType_Type 00487 #define NPY_INT32_FMT NPY_SHORT_FMT 00488 #define NPY_UINT32_FMT NPY_USHORT_FMT 00489 #endif 00490 #elif NPY_BITSOF_SHORT == 64 00491 #ifndef NPY_INT64 00492 #define NPY_INT64 NPY_SHORT 00493 #define NPY_UINT64 NPY_USHORT 00494 typedef short npy_int64; 00495 typedef unsigned short npy_uint64; 00496 # define PyInt64ScalarObject PyShortScalarObject 00497 # define PyInt64ArrType_Type PyShortArrType_Type 00498 # define PyUInt64ScalarObject PyUShortScalarObject 00499 # define PyUInt64ArrType_Type PyUShortArrType_Type 00500 #define NPY_INT64_FMT NPY_SHORT_FMT 00501 #define NPY_UINT64_FMT NPY_USHORT_FMT 00502 # define MyPyLong_FromInt64 PyLong_FromLong 00503 # define MyPyLong_AsInt64 PyLong_AsLong 00504 #endif 00505 #elif NPY_BITSOF_SHORT == 128 00506 #ifndef NPY_INT128 00507 #define NPY_INT128 NPY_SHORT 00508 #define NPY_UINT128 NPY_USHORT 00509 typedef short npy_int128; 00510 typedef unsigned short npy_uint128; 00511 # define PyInt128ScalarObject PyShortScalarObject 00512 # define PyInt128ArrType_Type PyShortArrType_Type 00513 # define PyUInt128ScalarObject PyUShortScalarObject 00514 # define PyUInt128ArrType_Type PyUShortArrType_Type 00515 #define NPY_INT128_FMT NPY_SHORT_FMT 00516 #define NPY_UINT128_FMT NPY_USHORT_FMT 00517 #endif 00518 #endif 00519 00520 00521 #if NPY_BITSOF_CHAR == 8 00522 #ifndef NPY_INT8 00523 #define NPY_INT8 NPY_BYTE 00524 #define NPY_UINT8 NPY_UBYTE 00525 typedef signed char npy_int8; 00526 typedef unsigned char npy_uint8; 00527 # define PyInt8ScalarObject PyByteScalarObject 00528 # define PyInt8ArrType_Type PyByteArrType_Type 00529 # define PyUInt8ScalarObject PyUByteScalarObject 00530 # define PyUInt8ArrType_Type PyUByteArrType_Type 00531 #define NPY_INT8_FMT NPY_BYTE_FMT 00532 #define NPY_UINT8_FMT NPY_UBYTE_FMT 00533 #endif 00534 #elif NPY_BITSOF_CHAR == 16 00535 #ifndef NPY_INT16 00536 #define NPY_INT16 NPY_BYTE 00537 #define NPY_UINT16 NPY_UBYTE 00538 typedef signed char npy_int16; 00539 typedef unsigned char npy_uint16; 00540 # define PyInt16ScalarObject PyByteScalarObject 00541 # define PyInt16ArrType_Type PyByteArrType_Type 00542 # define PyUInt16ScalarObject PyUByteScalarObject 00543 # define PyUInt16ArrType_Type PyUByteArrType_Type 00544 #define NPY_INT16_FMT NPY_BYTE_FMT 00545 #define NPY_UINT16_FMT NPY_UBYTE_FMT 00546 #endif 00547 #elif NPY_BITSOF_CHAR == 32 00548 #ifndef NPY_INT32 00549 #define NPY_INT32 NPY_BYTE 00550 #define NPY_UINT32 NPY_UBYTE 00551 typedef signed char npy_int32; 00552 typedef unsigned char npy_uint32; 00553 typedef unsigned char npy_ucs4; 00554 # define PyInt32ScalarObject PyByteScalarObject 00555 # define PyInt32ArrType_Type PyByteArrType_Type 00556 # define PyUInt32ScalarObject PyUByteScalarObject 00557 # define PyUInt32ArrType_Type PyUByteArrType_Type 00558 #define NPY_INT32_FMT NPY_BYTE_FMT 00559 #define NPY_UINT32_FMT NPY_UBYTE_FMT 00560 #endif 00561 #elif NPY_BITSOF_CHAR == 64 00562 #ifndef NPY_INT64 00563 #define NPY_INT64 NPY_BYTE 00564 #define NPY_UINT64 NPY_UBYTE 00565 typedef signed char npy_int64; 00566 typedef unsigned char npy_uint64; 00567 # define PyInt64ScalarObject PyByteScalarObject 00568 # define PyInt64ArrType_Type PyByteArrType_Type 00569 # define PyUInt64ScalarObject PyUByteScalarObject 00570 # define PyUInt64ArrType_Type PyUByteArrType_Type 00571 #define NPY_INT64_FMT NPY_BYTE_FMT 00572 #define NPY_UINT64_FMT NPY_UBYTE_FMT 00573 # define MyPyLong_FromInt64 PyLong_FromLong 00574 # define MyPyLong_AsInt64 PyLong_AsLong 00575 #endif 00576 #elif NPY_BITSOF_CHAR == 128 00577 #ifndef NPY_INT128 00578 #define NPY_INT128 NPY_BYTE 00579 #define NPY_UINT128 NPY_UBYTE 00580 typedef signed char npy_int128; 00581 typedef unsigned char npy_uint128; 00582 # define PyInt128ScalarObject PyByteScalarObject 00583 # define PyInt128ArrType_Type PyByteArrType_Type 00584 # define PyUInt128ScalarObject PyUByteScalarObject 00585 # define PyUInt128ArrType_Type PyUByteArrType_Type 00586 #define NPY_INT128_FMT NPY_BYTE_FMT 00587 #define NPY_UINT128_FMT NPY_UBYTE_FMT 00588 #endif 00589 #endif 00590 00591 00592 00593 #if NPY_BITSOF_DOUBLE == 32 00594 #ifndef NPY_FLOAT32 00595 #define NPY_FLOAT32 NPY_DOUBLE 00596 #define NPY_COMPLEX64 NPY_CDOUBLE 00597 typedef double npy_float32; 00598 typedef npy_cdouble npy_complex64; 00599 # define PyFloat32ScalarObject PyDoubleScalarObject 00600 # define PyComplex64ScalarObject PyCDoubleScalarObject 00601 # define PyFloat32ArrType_Type PyDoubleArrType_Type 00602 # define PyComplex64ArrType_Type PyCDoubleArrType_Type 00603 #define NPY_FLOAT32_FMT NPY_DOUBLE_FMT 00604 #define NPY_COMPLEX64_FMT NPY_CDOUBLE_FMT 00605 #endif 00606 #elif NPY_BITSOF_DOUBLE == 64 00607 #ifndef NPY_FLOAT64 00608 #define NPY_FLOAT64 NPY_DOUBLE 00609 #define NPY_COMPLEX128 NPY_CDOUBLE 00610 typedef double npy_float64; 00611 typedef npy_cdouble npy_complex128; 00612 # define PyFloat64ScalarObject PyDoubleScalarObject 00613 # define PyComplex128ScalarObject PyCDoubleScalarObject 00614 # define PyFloat64ArrType_Type PyDoubleArrType_Type 00615 # define PyComplex128ArrType_Type PyCDoubleArrType_Type 00616 #define NPY_FLOAT64_FMT NPY_DOUBLE_FMT 00617 #define NPY_COMPLEX128_FMT NPY_CDOUBLE_FMT 00618 #endif 00619 #elif NPY_BITSOF_DOUBLE == 80 00620 #ifndef NPY_FLOAT80 00621 #define NPY_FLOAT80 NPY_DOUBLE 00622 #define NPY_COMPLEX160 NPY_CDOUBLE 00623 typedef double npy_float80; 00624 typedef npy_cdouble npy_complex160; 00625 # define PyFloat80ScalarObject PyDoubleScalarObject 00626 # define PyComplex160ScalarObject PyCDoubleScalarObject 00627 # define PyFloat80ArrType_Type PyDoubleArrType_Type 00628 # define PyComplex160ArrType_Type PyCDoubleArrType_Type 00629 #define NPY_FLOAT80_FMT NPY_DOUBLE_FMT 00630 #define NPY_COMPLEX160_FMT NPY_CDOUBLE_FMT 00631 #endif 00632 #elif NPY_BITSOF_DOUBLE == 96 00633 #ifndef NPY_FLOAT96 00634 #define NPY_FLOAT96 NPY_DOUBLE 00635 #define NPY_COMPLEX192 NPY_CDOUBLE 00636 typedef double npy_float96; 00637 typedef npy_cdouble npy_complex192; 00638 # define PyFloat96ScalarObject PyDoubleScalarObject 00639 # define PyComplex192ScalarObject PyCDoubleScalarObject 00640 # define PyFloat96ArrType_Type PyDoubleArrType_Type 00641 # define PyComplex192ArrType_Type PyCDoubleArrType_Type 00642 #define NPY_FLOAT96_FMT NPY_DOUBLE_FMT 00643 #define NPY_COMPLEX192_FMT NPY_CDOUBLE_FMT 00644 #endif 00645 #elif NPY_BITSOF_DOUBLE == 128 00646 #ifndef NPY_FLOAT128 00647 #define NPY_FLOAT128 NPY_DOUBLE 00648 #define NPY_COMPLEX256 NPY_CDOUBLE 00649 typedef double npy_float128; 00650 typedef npy_cdouble npy_complex256; 00651 # define PyFloat128ScalarObject PyDoubleScalarObject 00652 # define PyComplex256ScalarObject PyCDoubleScalarObject 00653 # define PyFloat128ArrType_Type PyDoubleArrType_Type 00654 # define PyComplex256ArrType_Type PyCDoubleArrType_Type 00655 #define NPY_FLOAT128_FMT NPY_DOUBLE_FMT 00656 #define NPY_COMPLEX256_FMT NPY_CDOUBLE_FMT 00657 #endif 00658 #endif 00659 00660 00661 00662 #if NPY_BITSOF_FLOAT == 32 00663 #ifndef NPY_FLOAT32 00664 #define NPY_FLOAT32 NPY_FLOAT 00665 #define NPY_COMPLEX64 NPY_CFLOAT 00666 typedef float npy_float32; 00667 typedef npy_cfloat npy_complex64; 00668 # define PyFloat32ScalarObject PyFloatScalarObject 00669 # define PyComplex64ScalarObject PyCFloatScalarObject 00670 # define PyFloat32ArrType_Type PyFloatArrType_Type 00671 # define PyComplex64ArrType_Type PyCFloatArrType_Type 00672 #define NPY_FLOAT32_FMT NPY_FLOAT_FMT 00673 #define NPY_COMPLEX64_FMT NPY_CFLOAT_FMT 00674 #endif 00675 #elif NPY_BITSOF_FLOAT == 64 00676 #ifndef NPY_FLOAT64 00677 #define NPY_FLOAT64 NPY_FLOAT 00678 #define NPY_COMPLEX128 NPY_CFLOAT 00679 typedef float npy_float64; 00680 typedef npy_cfloat npy_complex128; 00681 # define PyFloat64ScalarObject PyFloatScalarObject 00682 # define PyComplex128ScalarObject PyCFloatScalarObject 00683 # define PyFloat64ArrType_Type PyFloatArrType_Type 00684 # define PyComplex128ArrType_Type PyCFloatArrType_Type 00685 #define NPY_FLOAT64_FMT NPY_FLOAT_FMT 00686 #define NPY_COMPLEX128_FMT NPY_CFLOAT_FMT 00687 #endif 00688 #elif NPY_BITSOF_FLOAT == 80 00689 #ifndef NPY_FLOAT80 00690 #define NPY_FLOAT80 NPY_FLOAT 00691 #define NPY_COMPLEX160 NPY_CFLOAT 00692 typedef float npy_float80; 00693 typedef npy_cfloat npy_complex160; 00694 # define PyFloat80ScalarObject PyFloatScalarObject 00695 # define PyComplex160ScalarObject PyCFloatScalarObject 00696 # define PyFloat80ArrType_Type PyFloatArrType_Type 00697 # define PyComplex160ArrType_Type PyCFloatArrType_Type 00698 #define NPY_FLOAT80_FMT NPY_FLOAT_FMT 00699 #define NPY_COMPLEX160_FMT NPY_CFLOAT_FMT 00700 #endif 00701 #elif NPY_BITSOF_FLOAT == 96 00702 #ifndef NPY_FLOAT96 00703 #define NPY_FLOAT96 NPY_FLOAT 00704 #define NPY_COMPLEX192 NPY_CFLOAT 00705 typedef float npy_float96; 00706 typedef npy_cfloat npy_complex192; 00707 # define PyFloat96ScalarObject PyFloatScalarObject 00708 # define PyComplex192ScalarObject PyCFloatScalarObject 00709 # define PyFloat96ArrType_Type PyFloatArrType_Type 00710 # define PyComplex192ArrType_Type PyCFloatArrType_Type 00711 #define NPY_FLOAT96_FMT NPY_FLOAT_FMT 00712 #define NPY_COMPLEX192_FMT NPY_CFLOAT_FMT 00713 #endif 00714 #elif NPY_BITSOF_FLOAT == 128 00715 #ifndef NPY_FLOAT128 00716 #define NPY_FLOAT128 NPY_FLOAT 00717 #define NPY_COMPLEX256 NPY_CFLOAT 00718 typedef float npy_float128; 00719 typedef npy_cfloat npy_complex256; 00720 # define PyFloat128ScalarObject PyFloatScalarObject 00721 # define PyComplex256ScalarObject PyCFloatScalarObject 00722 # define PyFloat128ArrType_Type PyFloatArrType_Type 00723 # define PyComplex256ArrType_Type PyCFloatArrType_Type 00724 #define NPY_FLOAT128_FMT NPY_FLOAT_FMT 00725 #define NPY_COMPLEX256_FMT NPY_CFLOAT_FMT 00726 #endif 00727 #endif 00728 00729 /* half/float16 isn't a floating-point type in C */ 00730 #define NPY_FLOAT16 NPY_HALF 00731 typedef npy_uint16 npy_half; 00732 typedef npy_half npy_float16; 00733 00734 #if NPY_BITSOF_LONGDOUBLE == 32 00735 #ifndef NPY_FLOAT32 00736 #define NPY_FLOAT32 NPY_LONGDOUBLE 00737 #define NPY_COMPLEX64 NPY_CLONGDOUBLE 00738 typedef npy_longdouble npy_float32; 00739 typedef npy_clongdouble npy_complex64; 00740 # define PyFloat32ScalarObject PyLongDoubleScalarObject 00741 # define PyComplex64ScalarObject PyCLongDoubleScalarObject 00742 # define PyFloat32ArrType_Type PyLongDoubleArrType_Type 00743 # define PyComplex64ArrType_Type PyCLongDoubleArrType_Type 00744 #define NPY_FLOAT32_FMT NPY_LONGDOUBLE_FMT 00745 #define NPY_COMPLEX64_FMT NPY_CLONGDOUBLE_FMT 00746 #endif 00747 #elif NPY_BITSOF_LONGDOUBLE == 64 00748 #ifndef NPY_FLOAT64 00749 #define NPY_FLOAT64 NPY_LONGDOUBLE 00750 #define NPY_COMPLEX128 NPY_CLONGDOUBLE 00751 typedef npy_longdouble npy_float64; 00752 typedef npy_clongdouble npy_complex128; 00753 # define PyFloat64ScalarObject PyLongDoubleScalarObject 00754 # define PyComplex128ScalarObject PyCLongDoubleScalarObject 00755 # define PyFloat64ArrType_Type PyLongDoubleArrType_Type 00756 # define PyComplex128ArrType_Type PyCLongDoubleArrType_Type 00757 #define NPY_FLOAT64_FMT NPY_LONGDOUBLE_FMT 00758 #define NPY_COMPLEX128_FMT NPY_CLONGDOUBLE_FMT 00759 #endif 00760 #elif NPY_BITSOF_LONGDOUBLE == 80 00761 #ifndef NPY_FLOAT80 00762 #define NPY_FLOAT80 NPY_LONGDOUBLE 00763 #define NPY_COMPLEX160 NPY_CLONGDOUBLE 00764 typedef npy_longdouble npy_float80; 00765 typedef npy_clongdouble npy_complex160; 00766 # define PyFloat80ScalarObject PyLongDoubleScalarObject 00767 # define PyComplex160ScalarObject PyCLongDoubleScalarObject 00768 # define PyFloat80ArrType_Type PyLongDoubleArrType_Type 00769 # define PyComplex160ArrType_Type PyCLongDoubleArrType_Type 00770 #define NPY_FLOAT80_FMT NPY_LONGDOUBLE_FMT 00771 #define NPY_COMPLEX160_FMT NPY_CLONGDOUBLE_FMT 00772 #endif 00773 #elif NPY_BITSOF_LONGDOUBLE == 96 00774 #ifndef NPY_FLOAT96 00775 #define NPY_FLOAT96 NPY_LONGDOUBLE 00776 #define NPY_COMPLEX192 NPY_CLONGDOUBLE 00777 typedef npy_longdouble npy_float96; 00778 typedef npy_clongdouble npy_complex192; 00779 # define PyFloat96ScalarObject PyLongDoubleScalarObject 00780 # define PyComplex192ScalarObject PyCLongDoubleScalarObject 00781 # define PyFloat96ArrType_Type PyLongDoubleArrType_Type 00782 # define PyComplex192ArrType_Type PyCLongDoubleArrType_Type 00783 #define NPY_FLOAT96_FMT NPY_LONGDOUBLE_FMT 00784 #define NPY_COMPLEX192_FMT NPY_CLONGDOUBLE_FMT 00785 #endif 00786 #elif NPY_BITSOF_LONGDOUBLE == 128 00787 #ifndef NPY_FLOAT128 00788 #define NPY_FLOAT128 NPY_LONGDOUBLE 00789 #define NPY_COMPLEX256 NPY_CLONGDOUBLE 00790 typedef npy_longdouble npy_float128; 00791 typedef npy_clongdouble npy_complex256; 00792 # define PyFloat128ScalarObject PyLongDoubleScalarObject 00793 # define PyComplex256ScalarObject PyCLongDoubleScalarObject 00794 # define PyFloat128ArrType_Type PyLongDoubleArrType_Type 00795 # define PyComplex256ArrType_Type PyCLongDoubleArrType_Type 00796 #define NPY_FLOAT128_FMT NPY_LONGDOUBLE_FMT 00797 #define NPY_COMPLEX256_FMT NPY_CLONGDOUBLE_FMT 00798 #endif 00799 #elif NPY_BITSOF_LONGDOUBLE == 256 00800 #define NPY_FLOAT256 NPY_LONGDOUBLE 00801 #define NPY_COMPLEX512 NPY_CLONGDOUBLE 00802 typedef npy_longdouble npy_float256; 00803 typedef npy_clongdouble npy_complex512; 00804 # define PyFloat256ScalarObject PyLongDoubleScalarObject 00805 # define PyComplex512ScalarObject PyCLongDoubleScalarObject 00806 # define PyFloat256ArrType_Type PyLongDoubleArrType_Type 00807 # define PyComplex512ArrType_Type PyCLongDoubleArrType_Type 00808 #define NPY_FLOAT256_FMT NPY_LONGDOUBLE_FMT 00809 #define NPY_COMPLEX512_FMT NPY_CLONGDOUBLE_FMT 00810 #endif 00811 00812 /* datetime typedefs */ 00813 typedef npy_int64 npy_timedelta; 00814 typedef npy_int64 npy_datetime; 00815 #define NPY_DATETIME_FMT NPY_INT64_FMT 00816 #define NPY_TIMEDELTA_FMT NPY_INT64_FMT 00817 00818 /* End of typedefs for numarray style bit-width names */ 00819 00820 #endif 00821