mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 01:46:28 +03:00
pin numpy to >=1.7, ship headers
This commit is contained in:
parent
b98cc3266d
commit
bb3238bcdd
|
@ -2,6 +2,7 @@
|
||||||
"build": {
|
"build": {
|
||||||
"sdist": [
|
"sdist": [
|
||||||
"pip install -r requirements.txt",
|
"pip install -r requirements.txt",
|
||||||
|
"pip install \"numpy<1.8\"",
|
||||||
"python setup.py sdist"
|
"python setup.py sdist"
|
||||||
],
|
],
|
||||||
"install": [
|
"install": [
|
||||||
|
@ -9,6 +10,7 @@
|
||||||
],
|
],
|
||||||
"wheel": [
|
"wheel": [
|
||||||
"python untar.py source.tar.gz .",
|
"python untar.py source.tar.gz .",
|
||||||
|
"pip install \"numpy<1.8\"",
|
||||||
"python setup.py bdist_wheel",
|
"python setup.py bdist_wheel",
|
||||||
"python cpdist.py dist"
|
"python cpdist.py dist"
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
#if defined(_MULTIARRAYMODULE) || defined(WITH_CPYCHECKER_STEALS_REFERENCE_TO_ARG_ATTRIBUTE)
|
#ifdef _MULTIARRAYMODULE
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
|
@ -270,7 +270,7 @@ NPY_NO_EXPORT char * PyArray_Zero \
|
||||||
(PyArrayObject *);
|
(PyArrayObject *);
|
||||||
NPY_NO_EXPORT char * PyArray_One \
|
NPY_NO_EXPORT char * PyArray_One \
|
||||||
(PyArrayObject *);
|
(PyArrayObject *);
|
||||||
NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) NPY_GCC_NONNULL(2) PyObject * PyArray_CastToType \
|
NPY_NO_EXPORT PyObject * PyArray_CastToType \
|
||||||
(PyArrayObject *, PyArray_Descr *, int);
|
(PyArrayObject *, PyArray_Descr *, int);
|
||||||
NPY_NO_EXPORT int PyArray_CastTo \
|
NPY_NO_EXPORT int PyArray_CastTo \
|
||||||
(PyArrayObject *, PyArrayObject *);
|
(PyArrayObject *, PyArrayObject *);
|
||||||
|
@ -294,7 +294,7 @@ NPY_NO_EXPORT npy_intp PyArray_Size \
|
||||||
(PyObject *);
|
(PyObject *);
|
||||||
NPY_NO_EXPORT PyObject * PyArray_Scalar \
|
NPY_NO_EXPORT PyObject * PyArray_Scalar \
|
||||||
(void *, PyArray_Descr *, PyObject *);
|
(void *, PyArray_Descr *, PyObject *);
|
||||||
NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_FromScalar \
|
NPY_NO_EXPORT PyObject * PyArray_FromScalar \
|
||||||
(PyObject *, PyArray_Descr *);
|
(PyObject *, PyArray_Descr *);
|
||||||
NPY_NO_EXPORT void PyArray_ScalarAsCtype \
|
NPY_NO_EXPORT void PyArray_ScalarAsCtype \
|
||||||
(PyObject *, void *);
|
(PyObject *, void *);
|
||||||
|
@ -308,13 +308,13 @@ NPY_NO_EXPORT PyArray_VectorUnaryFunc * PyArray_GetCastFunc \
|
||||||
(PyArray_Descr *, int);
|
(PyArray_Descr *, int);
|
||||||
NPY_NO_EXPORT PyObject * PyArray_FromDims \
|
NPY_NO_EXPORT PyObject * PyArray_FromDims \
|
||||||
(int, int *, int);
|
(int, int *, int);
|
||||||
NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(3) PyObject * PyArray_FromDimsAndDataAndDescr \
|
NPY_NO_EXPORT PyObject * PyArray_FromDimsAndDataAndDescr \
|
||||||
(int, int *, PyArray_Descr *, char *);
|
(int, int *, PyArray_Descr *, char *);
|
||||||
NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_FromAny \
|
NPY_NO_EXPORT PyObject * PyArray_FromAny \
|
||||||
(PyObject *, PyArray_Descr *, int, int, int, PyObject *);
|
(PyObject *, PyArray_Descr *, int, int, int, PyObject *);
|
||||||
NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(1) PyObject * PyArray_EnsureArray \
|
NPY_NO_EXPORT PyObject * PyArray_EnsureArray \
|
||||||
(PyObject *);
|
(PyObject *);
|
||||||
NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(1) PyObject * PyArray_EnsureAnyArray \
|
NPY_NO_EXPORT PyObject * PyArray_EnsureAnyArray \
|
||||||
(PyObject *);
|
(PyObject *);
|
||||||
NPY_NO_EXPORT PyObject * PyArray_FromFile \
|
NPY_NO_EXPORT PyObject * PyArray_FromFile \
|
||||||
(FILE *, PyArray_Descr *, npy_intp, char *);
|
(FILE *, PyArray_Descr *, npy_intp, char *);
|
||||||
|
@ -322,13 +322,13 @@ NPY_NO_EXPORT PyObject * PyArray_FromString \
|
||||||
(char *, npy_intp, PyArray_Descr *, npy_intp, char *);
|
(char *, npy_intp, PyArray_Descr *, npy_intp, char *);
|
||||||
NPY_NO_EXPORT PyObject * PyArray_FromBuffer \
|
NPY_NO_EXPORT PyObject * PyArray_FromBuffer \
|
||||||
(PyObject *, PyArray_Descr *, npy_intp, npy_intp);
|
(PyObject *, PyArray_Descr *, npy_intp, npy_intp);
|
||||||
NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_FromIter \
|
NPY_NO_EXPORT PyObject * PyArray_FromIter \
|
||||||
(PyObject *, PyArray_Descr *, npy_intp);
|
(PyObject *, PyArray_Descr *, npy_intp);
|
||||||
NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(1) PyObject * PyArray_Return \
|
NPY_NO_EXPORT PyObject * PyArray_Return \
|
||||||
(PyArrayObject *);
|
(PyArrayObject *);
|
||||||
NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) NPY_GCC_NONNULL(2) PyObject * PyArray_GetField \
|
NPY_NO_EXPORT PyObject * PyArray_GetField \
|
||||||
(PyArrayObject *, PyArray_Descr *, int);
|
(PyArrayObject *, PyArray_Descr *, int);
|
||||||
NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) NPY_GCC_NONNULL(2) int PyArray_SetField \
|
NPY_NO_EXPORT int PyArray_SetField \
|
||||||
(PyArrayObject *, PyArray_Descr *, int, PyObject *);
|
(PyArrayObject *, PyArray_Descr *, int, PyObject *);
|
||||||
NPY_NO_EXPORT PyObject * PyArray_Byteswap \
|
NPY_NO_EXPORT PyObject * PyArray_Byteswap \
|
||||||
(PyArrayObject *, npy_bool);
|
(PyArrayObject *, npy_bool);
|
||||||
|
@ -342,7 +342,7 @@ NPY_NO_EXPORT int PyArray_CopyAnyInto \
|
||||||
(PyArrayObject *, PyArrayObject *);
|
(PyArrayObject *, PyArrayObject *);
|
||||||
NPY_NO_EXPORT int PyArray_CopyObject \
|
NPY_NO_EXPORT int PyArray_CopyObject \
|
||||||
(PyArrayObject *, PyObject *);
|
(PyArrayObject *, PyObject *);
|
||||||
NPY_NO_EXPORT NPY_GCC_NONNULL(1) PyObject * PyArray_NewCopy \
|
NPY_NO_EXPORT PyObject * PyArray_NewCopy \
|
||||||
(PyArrayObject *, NPY_ORDER);
|
(PyArrayObject *, NPY_ORDER);
|
||||||
NPY_NO_EXPORT PyObject * PyArray_ToList \
|
NPY_NO_EXPORT PyObject * PyArray_ToList \
|
||||||
(PyArrayObject *);
|
(PyArrayObject *);
|
||||||
|
@ -358,9 +358,9 @@ NPY_NO_EXPORT int PyArray_ValidType \
|
||||||
(int);
|
(int);
|
||||||
NPY_NO_EXPORT void PyArray_UpdateFlags \
|
NPY_NO_EXPORT void PyArray_UpdateFlags \
|
||||||
(PyArrayObject *, int);
|
(PyArrayObject *, int);
|
||||||
NPY_NO_EXPORT NPY_GCC_NONNULL(1) PyObject * PyArray_New \
|
NPY_NO_EXPORT PyObject * PyArray_New \
|
||||||
(PyTypeObject *, int, npy_intp *, int, npy_intp *, void *, int, int, PyObject *);
|
(PyTypeObject *, int, npy_intp *, int, npy_intp *, void *, int, int, PyObject *);
|
||||||
NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) NPY_GCC_NONNULL(1) NPY_GCC_NONNULL(2) PyObject * PyArray_NewFromDescr \
|
NPY_NO_EXPORT PyObject * PyArray_NewFromDescr \
|
||||||
(PyTypeObject *, PyArray_Descr *, int, npy_intp *, npy_intp *, void *, int, PyObject *);
|
(PyTypeObject *, PyArray_Descr *, int, npy_intp *, npy_intp *, void *, int, PyObject *);
|
||||||
NPY_NO_EXPORT PyArray_Descr * PyArray_DescrNew \
|
NPY_NO_EXPORT PyArray_Descr * PyArray_DescrNew \
|
||||||
(PyArray_Descr *);
|
(PyArray_Descr *);
|
||||||
|
@ -388,9 +388,9 @@ NPY_NO_EXPORT PyArray_Descr * PyArray_DescrNewByteorder \
|
||||||
(PyArray_Descr *, char);
|
(PyArray_Descr *, char);
|
||||||
NPY_NO_EXPORT PyObject * PyArray_IterAllButAxis \
|
NPY_NO_EXPORT PyObject * PyArray_IterAllButAxis \
|
||||||
(PyObject *, int *);
|
(PyObject *, int *);
|
||||||
NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_CheckFromAny \
|
NPY_NO_EXPORT PyObject * PyArray_CheckFromAny \
|
||||||
(PyObject *, PyArray_Descr *, int, int, int, PyObject *);
|
(PyObject *, PyArray_Descr *, int, int, int, PyObject *);
|
||||||
NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_FromArray \
|
NPY_NO_EXPORT PyObject * PyArray_FromArray \
|
||||||
(PyArrayObject *, PyArray_Descr *, int);
|
(PyArrayObject *, PyArray_Descr *, int);
|
||||||
NPY_NO_EXPORT PyObject * PyArray_FromInterface \
|
NPY_NO_EXPORT PyObject * PyArray_FromInterface \
|
||||||
(PyObject *);
|
(PyObject *);
|
||||||
|
@ -446,7 +446,7 @@ NPY_NO_EXPORT PyObject * PyArray_Newshape \
|
||||||
(PyArrayObject *, PyArray_Dims *, NPY_ORDER);
|
(PyArrayObject *, PyArray_Dims *, NPY_ORDER);
|
||||||
NPY_NO_EXPORT PyObject * PyArray_Squeeze \
|
NPY_NO_EXPORT PyObject * PyArray_Squeeze \
|
||||||
(PyArrayObject *);
|
(PyArrayObject *);
|
||||||
NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) PyObject * PyArray_View \
|
NPY_NO_EXPORT PyObject * PyArray_View \
|
||||||
(PyArrayObject *, PyArray_Descr *, PyTypeObject *);
|
(PyArrayObject *, PyArray_Descr *, PyTypeObject *);
|
||||||
NPY_NO_EXPORT PyObject * PyArray_SwapAxes \
|
NPY_NO_EXPORT PyObject * PyArray_SwapAxes \
|
||||||
(PyArrayObject *, int, int);
|
(PyArrayObject *, int, int);
|
||||||
|
@ -496,7 +496,7 @@ NPY_NO_EXPORT void * PyArray_GetPtr \
|
||||||
(PyArrayObject *, npy_intp*);
|
(PyArrayObject *, npy_intp*);
|
||||||
NPY_NO_EXPORT int PyArray_CompareLists \
|
NPY_NO_EXPORT int PyArray_CompareLists \
|
||||||
(npy_intp *, npy_intp *, int);
|
(npy_intp *, npy_intp *, int);
|
||||||
NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(5) int PyArray_AsCArray \
|
NPY_NO_EXPORT int PyArray_AsCArray \
|
||||||
(PyObject **, void *, npy_intp *, int, PyArray_Descr*);
|
(PyObject **, void *, npy_intp *, int, PyArray_Descr*);
|
||||||
NPY_NO_EXPORT int PyArray_As1D \
|
NPY_NO_EXPORT int PyArray_As1D \
|
||||||
(PyObject **, char **, int *, int);
|
(PyObject **, char **, int *, int);
|
||||||
|
@ -538,9 +538,9 @@ NPY_NO_EXPORT int PyArray_OrderConverter \
|
||||||
(PyObject *, NPY_ORDER *);
|
(PyObject *, NPY_ORDER *);
|
||||||
NPY_NO_EXPORT unsigned char PyArray_EquivTypes \
|
NPY_NO_EXPORT unsigned char PyArray_EquivTypes \
|
||||||
(PyArray_Descr *, PyArray_Descr *);
|
(PyArray_Descr *, PyArray_Descr *);
|
||||||
NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(3) PyObject * PyArray_Zeros \
|
NPY_NO_EXPORT PyObject * PyArray_Zeros \
|
||||||
(int, npy_intp *, PyArray_Descr *, int);
|
(int, npy_intp *, PyArray_Descr *, int);
|
||||||
NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(3) PyObject * PyArray_Empty \
|
NPY_NO_EXPORT PyObject * PyArray_Empty \
|
||||||
(int, npy_intp *, PyArray_Descr *, int);
|
(int, npy_intp *, PyArray_Descr *, int);
|
||||||
NPY_NO_EXPORT PyObject * PyArray_Where \
|
NPY_NO_EXPORT PyObject * PyArray_Where \
|
||||||
(PyObject *, PyObject *, PyObject *);
|
(PyObject *, PyObject *, PyObject *);
|
||||||
|
@ -746,7 +746,7 @@ NPY_NO_EXPORT npy_bool PyArray_CanCastTypeTo \
|
||||||
(PyArray_Descr *, PyArray_Descr *, NPY_CASTING);
|
(PyArray_Descr *, PyArray_Descr *, NPY_CASTING);
|
||||||
NPY_NO_EXPORT PyArrayObject * PyArray_EinsteinSum \
|
NPY_NO_EXPORT PyArrayObject * PyArray_EinsteinSum \
|
||||||
(char *, npy_intp, PyArrayObject **, PyArray_Descr *, NPY_ORDER, NPY_CASTING, PyArrayObject *);
|
(char *, npy_intp, PyArrayObject **, PyArray_Descr *, NPY_ORDER, NPY_CASTING, PyArrayObject *);
|
||||||
NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(3) NPY_GCC_NONNULL(1) PyObject * PyArray_NewLikeArray \
|
NPY_NO_EXPORT PyObject * PyArray_NewLikeArray \
|
||||||
(PyArrayObject *, NPY_ORDER, PyArray_Descr *, int);
|
(PyArrayObject *, NPY_ORDER, PyArray_Descr *, int);
|
||||||
NPY_NO_EXPORT int PyArray_GetArrayParamsFromObject \
|
NPY_NO_EXPORT int PyArray_GetArrayParamsFromObject \
|
||||||
(PyObject *, PyArray_Descr *, npy_bool, PyArray_Descr **, int *, npy_intp *, PyArrayObject **, PyObject *);
|
(PyObject *, PyArray_Descr *, npy_bool, PyArray_Descr **, int *, npy_intp *, PyArrayObject **, PyObject *);
|
||||||
|
@ -756,7 +756,7 @@ NPY_NO_EXPORT PyObject * PyArray_MatrixProduct2 \
|
||||||
(PyObject *, PyObject *, PyArrayObject*);
|
(PyObject *, PyObject *, PyArrayObject*);
|
||||||
NPY_NO_EXPORT npy_bool NpyIter_IsFirstVisit \
|
NPY_NO_EXPORT npy_bool NpyIter_IsFirstVisit \
|
||||||
(NpyIter *, int);
|
(NpyIter *, int);
|
||||||
NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) int PyArray_SetBaseObject \
|
NPY_NO_EXPORT int PyArray_SetBaseObject \
|
||||||
(PyArrayObject *, PyObject *);
|
(PyArrayObject *, PyObject *);
|
||||||
NPY_NO_EXPORT void PyArray_CreateSortedStridePerm \
|
NPY_NO_EXPORT void PyArray_CreateSortedStridePerm \
|
||||||
(int, npy_intp *, npy_stride_sort_item *);
|
(int, npy_intp *, npy_stride_sort_item *);
|
||||||
|
@ -766,7 +766,7 @@ NPY_NO_EXPORT void PyArray_DebugPrint \
|
||||||
(PyArrayObject *);
|
(PyArrayObject *);
|
||||||
NPY_NO_EXPORT int PyArray_FailUnlessWriteable \
|
NPY_NO_EXPORT int PyArray_FailUnlessWriteable \
|
||||||
(PyArrayObject *, const char *);
|
(PyArrayObject *, const char *);
|
||||||
NPY_NO_EXPORT NPY_STEALS_REF_TO_ARG(2) int PyArray_SetUpdateIfCopyBase \
|
NPY_NO_EXPORT int PyArray_SetUpdateIfCopyBase \
|
||||||
(PyArrayObject *, PyArrayObject *);
|
(PyArrayObject *, PyArrayObject *);
|
||||||
NPY_NO_EXPORT void * PyDataMem_NEW \
|
NPY_NO_EXPORT void * PyDataMem_NEW \
|
||||||
(size_t);
|
(size_t);
|
||||||
|
@ -782,22 +782,6 @@ NPY_NO_EXPORT PyDataMem_EventHookFunc * PyDataMem_SetEventHook \
|
||||||
NPY_NO_EXPORT NPY_CASTING NPY_DEFAULT_ASSIGN_CASTING;
|
NPY_NO_EXPORT NPY_CASTING NPY_DEFAULT_ASSIGN_CASTING;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NPY_NO_EXPORT void PyArray_MapIterSwapAxes \
|
|
||||||
(PyArrayMapIterObject *, PyArrayObject **, int);
|
|
||||||
NPY_NO_EXPORT PyObject * PyArray_MapIterArray \
|
|
||||||
(PyArrayObject *, PyObject *);
|
|
||||||
NPY_NO_EXPORT void PyArray_MapIterNext \
|
|
||||||
(PyArrayMapIterObject *);
|
|
||||||
NPY_NO_EXPORT int PyArray_Partition \
|
|
||||||
(PyArrayObject *, PyArrayObject *, int, NPY_SELECTKIND);
|
|
||||||
NPY_NO_EXPORT PyObject * PyArray_ArgPartition \
|
|
||||||
(PyArrayObject *, PyArrayObject *, int, NPY_SELECTKIND);
|
|
||||||
NPY_NO_EXPORT int PyArray_SelectkindConverter \
|
|
||||||
(PyObject *, NPY_SELECTKIND *);
|
|
||||||
NPY_NO_EXPORT void * PyDataMem_NEW_ZEROED \
|
|
||||||
(size_t, size_t);
|
|
||||||
NPY_NO_EXPORT NPY_GCC_NONNULL(1) int PyArray_CheckAnyScalarExact \
|
|
||||||
(PyObject *);
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -1604,30 +1588,6 @@ static void **PyArray_API=NULL;
|
||||||
(*(PyDataMem_EventHookFunc * (*)(PyDataMem_EventHookFunc *, void *, void **)) \
|
(*(PyDataMem_EventHookFunc * (*)(PyDataMem_EventHookFunc *, void *, void **)) \
|
||||||
PyArray_API[291])
|
PyArray_API[291])
|
||||||
#define NPY_DEFAULT_ASSIGN_CASTING (*(NPY_CASTING *)PyArray_API[292])
|
#define NPY_DEFAULT_ASSIGN_CASTING (*(NPY_CASTING *)PyArray_API[292])
|
||||||
#define PyArray_MapIterSwapAxes \
|
|
||||||
(*(void (*)(PyArrayMapIterObject *, PyArrayObject **, int)) \
|
|
||||||
PyArray_API[293])
|
|
||||||
#define PyArray_MapIterArray \
|
|
||||||
(*(PyObject * (*)(PyArrayObject *, PyObject *)) \
|
|
||||||
PyArray_API[294])
|
|
||||||
#define PyArray_MapIterNext \
|
|
||||||
(*(void (*)(PyArrayMapIterObject *)) \
|
|
||||||
PyArray_API[295])
|
|
||||||
#define PyArray_Partition \
|
|
||||||
(*(int (*)(PyArrayObject *, PyArrayObject *, int, NPY_SELECTKIND)) \
|
|
||||||
PyArray_API[296])
|
|
||||||
#define PyArray_ArgPartition \
|
|
||||||
(*(PyObject * (*)(PyArrayObject *, PyArrayObject *, int, NPY_SELECTKIND)) \
|
|
||||||
PyArray_API[297])
|
|
||||||
#define PyArray_SelectkindConverter \
|
|
||||||
(*(int (*)(PyObject *, NPY_SELECTKIND *)) \
|
|
||||||
PyArray_API[298])
|
|
||||||
#define PyDataMem_NEW_ZEROED \
|
|
||||||
(*(void * (*)(size_t, size_t)) \
|
|
||||||
PyArray_API[299])
|
|
||||||
#define PyArray_CheckAnyScalarExact \
|
|
||||||
(*(int (*)(PyObject *)) \
|
|
||||||
PyArray_API[300])
|
|
||||||
|
|
||||||
#if !defined(NO_IMPORT_ARRAY) && !defined(NO_IMPORT)
|
#if !defined(NO_IMPORT_ARRAY) && !defined(NO_IMPORT)
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -14,7 +14,7 @@ NPY_NO_EXPORT PyTypeObject PyUFunc_Type;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NPY_NO_EXPORT PyObject * PyUFunc_FromFuncAndData \
|
NPY_NO_EXPORT PyObject * PyUFunc_FromFuncAndData \
|
||||||
(PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int);
|
(PyUFuncGenericFunction *, void **, char *, int, int, int, int, char *, char *, int);
|
||||||
NPY_NO_EXPORT int PyUFunc_RegisterLoopForType \
|
NPY_NO_EXPORT int PyUFunc_RegisterLoopForType \
|
||||||
(PyUFuncObject *, int, PyUFuncGenericFunction, int *, void *);
|
(PyUFuncObject *, int, PyUFuncGenericFunction, int *, void *);
|
||||||
NPY_NO_EXPORT int PyUFunc_GenericFunction \
|
NPY_NO_EXPORT int PyUFunc_GenericFunction \
|
||||||
|
@ -74,7 +74,7 @@ NPY_NO_EXPORT int PyUFunc_handlefperr \
|
||||||
NPY_NO_EXPORT int PyUFunc_ReplaceLoopBySignature \
|
NPY_NO_EXPORT int PyUFunc_ReplaceLoopBySignature \
|
||||||
(PyUFuncObject *, PyUFuncGenericFunction, int *, PyUFuncGenericFunction *);
|
(PyUFuncObject *, PyUFuncGenericFunction, int *, PyUFuncGenericFunction *);
|
||||||
NPY_NO_EXPORT PyObject * PyUFunc_FromFuncAndDataAndSignature \
|
NPY_NO_EXPORT PyObject * PyUFunc_FromFuncAndDataAndSignature \
|
||||||
(PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int, const char *);
|
(PyUFuncGenericFunction *, void **, char *, int, int, int, int, char *, char *, int, const char *);
|
||||||
NPY_NO_EXPORT int PyUFunc_SetUsesArraysAsData \
|
NPY_NO_EXPORT int PyUFunc_SetUsesArraysAsData \
|
||||||
(void **, size_t);
|
(void **, size_t);
|
||||||
NPY_NO_EXPORT void PyUFunc_e_e \
|
NPY_NO_EXPORT void PyUFunc_e_e \
|
||||||
|
@ -93,8 +93,6 @@ NPY_NO_EXPORT int PyUFunc_DefaultTypeResolver \
|
||||||
(PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyObject *, PyArray_Descr **);
|
(PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyObject *, PyArray_Descr **);
|
||||||
NPY_NO_EXPORT int PyUFunc_ValidateCasting \
|
NPY_NO_EXPORT int PyUFunc_ValidateCasting \
|
||||||
(PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyArray_Descr **);
|
(PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyArray_Descr **);
|
||||||
NPY_NO_EXPORT int PyUFunc_RegisterLoopForDescr \
|
|
||||||
(PyUFuncObject *, PyArray_Descr *, PyUFuncGenericFunction, PyArray_Descr **, void *);
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -114,7 +112,7 @@ static void **PyUFunc_API=NULL;
|
||||||
|
|
||||||
#define PyUFunc_Type (*(PyTypeObject *)PyUFunc_API[0])
|
#define PyUFunc_Type (*(PyTypeObject *)PyUFunc_API[0])
|
||||||
#define PyUFunc_FromFuncAndData \
|
#define PyUFunc_FromFuncAndData \
|
||||||
(*(PyObject * (*)(PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int)) \
|
(*(PyObject * (*)(PyUFuncGenericFunction *, void **, char *, int, int, int, int, char *, char *, int)) \
|
||||||
PyUFunc_API[1])
|
PyUFunc_API[1])
|
||||||
#define PyUFunc_RegisterLoopForType \
|
#define PyUFunc_RegisterLoopForType \
|
||||||
(*(int (*)(PyUFuncObject *, int, PyUFuncGenericFunction, int *, void *)) \
|
(*(int (*)(PyUFuncObject *, int, PyUFuncGenericFunction, int *, void *)) \
|
||||||
|
@ -204,7 +202,7 @@ static void **PyUFunc_API=NULL;
|
||||||
(*(int (*)(PyUFuncObject *, PyUFuncGenericFunction, int *, PyUFuncGenericFunction *)) \
|
(*(int (*)(PyUFuncObject *, PyUFuncGenericFunction, int *, PyUFuncGenericFunction *)) \
|
||||||
PyUFunc_API[30])
|
PyUFunc_API[30])
|
||||||
#define PyUFunc_FromFuncAndDataAndSignature \
|
#define PyUFunc_FromFuncAndDataAndSignature \
|
||||||
(*(PyObject * (*)(PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int, const char *)) \
|
(*(PyObject * (*)(PyUFuncGenericFunction *, void **, char *, int, int, int, int, char *, char *, int, const char *)) \
|
||||||
PyUFunc_API[31])
|
PyUFunc_API[31])
|
||||||
#define PyUFunc_SetUsesArraysAsData \
|
#define PyUFunc_SetUsesArraysAsData \
|
||||||
(*(int (*)(void **, size_t)) \
|
(*(int (*)(void **, size_t)) \
|
||||||
|
@ -233,11 +231,8 @@ static void **PyUFunc_API=NULL;
|
||||||
#define PyUFunc_ValidateCasting \
|
#define PyUFunc_ValidateCasting \
|
||||||
(*(int (*)(PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyArray_Descr **)) \
|
(*(int (*)(PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyArray_Descr **)) \
|
||||||
PyUFunc_API[40])
|
PyUFunc_API[40])
|
||||||
#define PyUFunc_RegisterLoopForDescr \
|
|
||||||
(*(int (*)(PyUFuncObject *, PyArray_Descr *, PyUFuncGenericFunction, PyArray_Descr **, void *)) \
|
|
||||||
PyUFunc_API[41])
|
|
||||||
|
|
||||||
static NPY_INLINE int
|
static int
|
||||||
_import_umath(void)
|
_import_umath(void)
|
||||||
{
|
{
|
||||||
PyObject *numpy = PyImport_ImportModule("numpy.core.umath");
|
PyObject *numpy = PyImport_ImportModule("numpy.core.umath");
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#define NPY_SIZEOF_LONGDOUBLE 16
|
#define NPY_SIZEOF_LONGDOUBLE 16
|
||||||
#define NPY_SIZEOF_COMPLEX_LONGDOUBLE 32
|
#define NPY_SIZEOF_COMPLEX_LONGDOUBLE 32
|
||||||
#define NPY_SIZEOF_PY_INTPTR_T 8
|
#define NPY_SIZEOF_PY_INTPTR_T 8
|
||||||
#define NPY_SIZEOF_OFF_T 8
|
|
||||||
#define NPY_SIZEOF_PY_LONG_LONG 8
|
#define NPY_SIZEOF_PY_LONG_LONG 8
|
||||||
#define NPY_SIZEOF_LONGLONG 8
|
#define NPY_SIZEOF_LONGLONG 8
|
||||||
#define NPY_NO_SMP 0
|
#define NPY_NO_SMP 0
|
||||||
|
@ -20,11 +19,10 @@
|
||||||
#define NPY_HAVE_COMPLEX_DOUBLE 1
|
#define NPY_HAVE_COMPLEX_DOUBLE 1
|
||||||
#define NPY_HAVE_COMPLEX_FLOAT 1
|
#define NPY_HAVE_COMPLEX_FLOAT 1
|
||||||
#define NPY_HAVE_COMPLEX_LONG_DOUBLE 1
|
#define NPY_HAVE_COMPLEX_LONG_DOUBLE 1
|
||||||
#define NPY_ENABLE_SEPARATE_COMPILATION 1
|
|
||||||
#define NPY_USE_C99_FORMATS 1
|
#define NPY_USE_C99_FORMATS 1
|
||||||
#define NPY_VISIBILITY_HIDDEN __attribute__((visibility("hidden")))
|
#define NPY_VISIBILITY_HIDDEN __attribute__((visibility("hidden")))
|
||||||
#define NPY_ABI_VERSION 0x01000009
|
#define NPY_ABI_VERSION 0x01000009
|
||||||
#define NPY_API_VERSION 0x0000000A
|
#define NPY_API_VERSION 0x00000007
|
||||||
|
|
||||||
#ifndef __STDC_FORMAT_MACROS
|
#ifndef __STDC_FORMAT_MACROS
|
||||||
#define __STDC_FORMAT_MACROS 1
|
#define __STDC_FORMAT_MACROS 1
|
||||||
|
|
|
@ -1,3 +1,14 @@
|
||||||
|
|
||||||
|
/* This expects the following variables to be defined (besides
|
||||||
|
the usual ones from pyconfig.h
|
||||||
|
|
||||||
|
SIZEOF_LONG_DOUBLE -- sizeof(long double) or sizeof(double) if no
|
||||||
|
long double is present on platform.
|
||||||
|
CHAR_BIT -- number of bits in a char (usually 8)
|
||||||
|
(should be in limits.h)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef Py_ARRAYOBJECT_H
|
#ifndef Py_ARRAYOBJECT_H
|
||||||
#define Py_ARRAYOBJECT_H
|
#define Py_ARRAYOBJECT_H
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ Get pointer to one of correct type for array
|
||||||
For backward compatibility
|
For backward compatibility
|
||||||
|
|
||||||
Cast an array using typecode structure.
|
Cast an array using typecode structure.
|
||||||
steals reference to dtype --- cannot be NULL
|
steals reference to at --- cannot be NULL
|
||||||
|
|
||||||
This function always makes a copy of arr, even if the dtype
|
This function always makes a copy of arr, even if the dtype
|
||||||
doesn't change.
|
doesn't change.
|
||||||
|
@ -356,7 +356,6 @@ steals a reference to dtype (which cannot be NULL)
|
||||||
|
|
||||||
Return either an array or the appropriate Python object if the array
|
Return either an array or the appropriate Python object if the array
|
||||||
is 0d and matches a Python type.
|
is 0d and matches a Python type.
|
||||||
steals reference to mp
|
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
|
@ -365,7 +364,6 @@ steals reference to mp
|
||||||
offset)
|
offset)
|
||||||
|
|
||||||
Get a subset of bytes from each element of the array
|
Get a subset of bytes from each element of the array
|
||||||
steals reference to typed, must not be NULL
|
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
|
@ -374,7 +372,6 @@ steals reference to typed, must not be NULL
|
||||||
offset, PyObject *val)
|
offset, PyObject *val)
|
||||||
|
|
||||||
Set a subset of bytes from each element of the array
|
Set a subset of bytes from each element of the array
|
||||||
steals reference to dtype, must not be NULL
|
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
|
@ -1109,7 +1106,7 @@ as you get a new reference to it.
|
||||||
PyArray_IntpFromSequence(PyObject *seq, npy_intp *vals, int maxvals)
|
PyArray_IntpFromSequence(PyObject *seq, npy_intp *vals, int maxvals)
|
||||||
|
|
||||||
PyArray_IntpFromSequence
|
PyArray_IntpFromSequence
|
||||||
Returns the number of integers converted or -1 if an error occurred.
|
Returns the number of dimensions or -1 if an error occurred.
|
||||||
vals must be large enough to hold maxvals
|
vals must be large enough to hold maxvals
|
||||||
|
|
||||||
::
|
::
|
||||||
|
@ -2181,7 +2178,7 @@ int ndim = 0;
|
||||||
npy_intp dims[NPY_MAXDIMS];
|
npy_intp dims[NPY_MAXDIMS];
|
||||||
|
|
||||||
if (PyArray_GetArrayParamsFromObject(op, NULL, 1, &dtype,
|
if (PyArray_GetArrayParamsFromObject(op, NULL, 1, &dtype,
|
||||||
&ndim, dims, &arr, NULL) < 0) {
|
&ndim, &dims, &arr, NULL) < 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (arr == NULL) {
|
if (arr == NULL) {
|
||||||
|
@ -2221,7 +2218,7 @@ could be applied to each axis, like in ravel_multi_index.
|
||||||
PyArray_MatrixProduct2(PyObject *op1, PyObject
|
PyArray_MatrixProduct2(PyObject *op1, PyObject
|
||||||
*op2, PyArrayObject*out)
|
*op2, PyArrayObject*out)
|
||||||
|
|
||||||
Numeric.matrixproduct2(a,v,out)
|
Numeric.matrixproduct(a,v,out)
|
||||||
just like inner product but does the swapaxes stuff on the fly
|
just like inner product but does the swapaxes stuff on the fly
|
||||||
|
|
||||||
::
|
::
|
||||||
|
@ -2287,10 +2284,6 @@ index zero for that axis.
|
||||||
WARNING: If an axis flagged for removal has a shape equal to zero,
|
WARNING: If an axis flagged for removal has a shape equal to zero,
|
||||||
the array will point to invalid memory. The caller must
|
the array will point to invalid memory. The caller must
|
||||||
validate this!
|
validate this!
|
||||||
If an axis flagged for removal has a shape larger then one,
|
|
||||||
the aligned flag (and in the future the contiguous flags),
|
|
||||||
may need explicite update.
|
|
||||||
(check also NPY_RELAXED_STRIDES_CHECKING)
|
|
||||||
|
|
||||||
For example, this can be used to remove the reduction axes
|
For example, this can be used to remove the reduction axes
|
||||||
from a reduction result once its computation is complete.
|
from a reduction result once its computation is complete.
|
||||||
|
@ -2380,70 +2373,3 @@ operations that might cause new allocation events (such as the
|
||||||
creation/descruction numpy objects, or creating/destroying Python
|
creation/descruction numpy objects, or creating/destroying Python
|
||||||
objects which might cause a gc)
|
objects which might cause a gc)
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
void
|
|
||||||
PyArray_MapIterSwapAxes(PyArrayMapIterObject *mit, PyArrayObject
|
|
||||||
**ret, int getmap)
|
|
||||||
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
PyObject *
|
|
||||||
PyArray_MapIterArray(PyArrayObject *a, PyObject *index)
|
|
||||||
|
|
||||||
|
|
||||||
Use advanced indexing to iterate an array. Please note
|
|
||||||
that most of this public API is currently not guaranteed
|
|
||||||
to stay the same between versions. If you plan on using
|
|
||||||
it, please consider adding more utility functions here
|
|
||||||
to accommodate new features.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
void
|
|
||||||
PyArray_MapIterNext(PyArrayMapIterObject *mit)
|
|
||||||
|
|
||||||
This function needs to update the state of the map iterator
|
|
||||||
and point mit->dataptr to the memory-location of the next object
|
|
||||||
|
|
||||||
Note that this function never handles an extra operand but provides
|
|
||||||
compatibility for an old (exposed) API.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
int
|
|
||||||
PyArray_Partition(PyArrayObject *op, PyArrayObject *ktharray, int
|
|
||||||
axis, NPY_SELECTKIND which)
|
|
||||||
|
|
||||||
Partition an array in-place
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
PyObject *
|
|
||||||
PyArray_ArgPartition(PyArrayObject *op, PyArrayObject *ktharray, int
|
|
||||||
axis, NPY_SELECTKIND which)
|
|
||||||
|
|
||||||
ArgPartition an array
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
int
|
|
||||||
PyArray_SelectkindConverter(PyObject *obj, NPY_SELECTKIND *selectkind)
|
|
||||||
|
|
||||||
Convert object to select kind
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
void *
|
|
||||||
PyDataMem_NEW_ZEROED(size_t size, size_t elsize)
|
|
||||||
|
|
||||||
Allocates zeroed memory for array data.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
int
|
|
||||||
PyArray_CheckAnyScalarExact(PyObject *obj)
|
|
||||||
|
|
||||||
return true an object is exactly a numpy scalar
|
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ extern "C" CONFUSE_EMACS
|
||||||
everything when you're typing */
|
everything when you're typing */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Python.h>
|
|
||||||
#include "ndarraytypes.h"
|
#include "ndarraytypes.h"
|
||||||
|
|
||||||
/* Includes the "function" C-API -- these are all stored in a
|
/* Includes the "function" C-API -- these are all stored in a
|
||||||
|
@ -51,26 +50,14 @@ extern "C" CONFUSE_EMACS
|
||||||
|
|
||||||
#define PyArray_CheckScalar(m) (PyArray_IsScalar(m, Generic) || \
|
#define PyArray_CheckScalar(m) (PyArray_IsScalar(m, Generic) || \
|
||||||
PyArray_IsZeroDim(m))
|
PyArray_IsZeroDim(m))
|
||||||
#if PY_MAJOR_VERSION >= 3
|
|
||||||
#define PyArray_IsPythonNumber(obj) \
|
|
||||||
(PyFloat_Check(obj) || PyComplex_Check(obj) || \
|
|
||||||
PyLong_Check(obj) || PyBool_Check(obj))
|
|
||||||
#define PyArray_IsIntegerScalar(obj) (PyLong_Check(obj) \
|
|
||||||
|| PyArray_IsScalar((obj), Integer))
|
|
||||||
#define PyArray_IsPythonScalar(obj) \
|
|
||||||
(PyArray_IsPythonNumber(obj) || PyBytes_Check(obj) || \
|
|
||||||
PyUnicode_Check(obj))
|
|
||||||
#else
|
|
||||||
#define PyArray_IsPythonNumber(obj) \
|
#define PyArray_IsPythonNumber(obj) \
|
||||||
(PyInt_Check(obj) || PyFloat_Check(obj) || PyComplex_Check(obj) || \
|
(PyInt_Check(obj) || PyFloat_Check(obj) || PyComplex_Check(obj) || \
|
||||||
PyLong_Check(obj) || PyBool_Check(obj))
|
PyLong_Check(obj) || PyBool_Check(obj))
|
||||||
#define PyArray_IsIntegerScalar(obj) (PyInt_Check(obj) \
|
|
||||||
|| PyLong_Check(obj) \
|
|
||||||
|| PyArray_IsScalar((obj), Integer))
|
|
||||||
#define PyArray_IsPythonScalar(obj) \
|
#define PyArray_IsPythonScalar(obj) \
|
||||||
(PyArray_IsPythonNumber(obj) || PyString_Check(obj) || \
|
(PyArray_IsPythonNumber(obj) || PyString_Check(obj) || \
|
||||||
PyUnicode_Check(obj))
|
PyUnicode_Check(obj))
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PyArray_IsAnyScalar(obj) \
|
#define PyArray_IsAnyScalar(obj) \
|
||||||
(PyArray_IsScalar(obj, Generic) || PyArray_IsPythonScalar(obj))
|
(PyArray_IsScalar(obj, Generic) || PyArray_IsPythonScalar(obj))
|
||||||
|
@ -78,6 +65,10 @@ extern "C" CONFUSE_EMACS
|
||||||
#define PyArray_CheckAnyScalar(obj) (PyArray_IsPythonScalar(obj) || \
|
#define PyArray_CheckAnyScalar(obj) (PyArray_IsPythonScalar(obj) || \
|
||||||
PyArray_CheckScalar(obj))
|
PyArray_CheckScalar(obj))
|
||||||
|
|
||||||
|
#define PyArray_IsIntegerScalar(obj) (PyInt_Check(obj) \
|
||||||
|
|| PyLong_Check(obj) \
|
||||||
|
|| PyArray_IsScalar((obj), Integer))
|
||||||
|
|
||||||
|
|
||||||
#define PyArray_GETCONTIGUOUS(m) (PyArray_ISCONTIGUOUS(m) ? \
|
#define PyArray_GETCONTIGUOUS(m) (PyArray_ISCONTIGUOUS(m) ? \
|
||||||
Py_INCREF(m), (m) : \
|
Py_INCREF(m), (m) : \
|
||||||
|
@ -96,7 +87,7 @@ extern "C" CONFUSE_EMACS
|
||||||
NULL)
|
NULL)
|
||||||
|
|
||||||
#define PyArray_FROM_OT(m,type) PyArray_FromAny(m, \
|
#define PyArray_FROM_OT(m,type) PyArray_FromAny(m, \
|
||||||
PyArray_DescrFromType(type), 0, 0, 0, NULL)
|
PyArray_DescrFromType(type), 0, 0, 0, NULL);
|
||||||
|
|
||||||
#define PyArray_FROM_OTF(m, type, flags) \
|
#define PyArray_FROM_OTF(m, type, flags) \
|
||||||
PyArray_FromAny(m, PyArray_DescrFromType(type), 0, 0, \
|
PyArray_FromAny(m, PyArray_DescrFromType(type), 0, 0, \
|
||||||
|
@ -234,8 +225,15 @@ PyArray_XDECREF_ERR(PyArrayObject *arr)
|
||||||
(PyTuple_GET_ITEM((value), 2) == (key)))
|
(PyTuple_GET_ITEM((value), 2) == (key)))
|
||||||
|
|
||||||
|
|
||||||
|
/* Define python version independent deprecation macro */
|
||||||
|
|
||||||
|
#if PY_VERSION_HEX >= 0x02050000
|
||||||
#define DEPRECATE(msg) PyErr_WarnEx(PyExc_DeprecationWarning,msg,1)
|
#define DEPRECATE(msg) PyErr_WarnEx(PyExc_DeprecationWarning,msg,1)
|
||||||
#define DEPRECATE_FUTUREWARNING(msg) PyErr_WarnEx(PyExc_FutureWarning,msg,1)
|
#define DEPRECATE_FUTUREWARNING(msg) PyErr_WarnEx(PyExc_FutureWarning,msg,1)
|
||||||
|
#else
|
||||||
|
#define DEPRECATE(msg) PyErr_Warn(PyExc_DeprecationWarning,msg)
|
||||||
|
#define DEPRECATE_FUTUREWARNING(msg) PyErr_Warn(PyExc_FutureWarning,msg)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#ifndef NDARRAYTYPES_H
|
#ifndef NDARRAYTYPES_H
|
||||||
#define NDARRAYTYPES_H
|
#define NDARRAYTYPES_H
|
||||||
|
|
||||||
|
/* numpyconfig.h is auto-generated by the installer */
|
||||||
|
#include "numpyconfig.h"
|
||||||
|
|
||||||
#include "npy_common.h"
|
#include "npy_common.h"
|
||||||
#include "npy_endian.h"
|
#include "npy_endian.h"
|
||||||
#include "npy_cpu.h"
|
#include "npy_cpu.h"
|
||||||
|
@ -155,12 +158,6 @@ typedef enum {
|
||||||
#define NPY_NSORTS (NPY_MERGESORT + 1)
|
#define NPY_NSORTS (NPY_MERGESORT + 1)
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
NPY_INTROSELECT=0
|
|
||||||
} NPY_SELECTKIND;
|
|
||||||
#define NPY_NSELECTS (NPY_INTROSELECT + 1)
|
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
NPY_SEARCHLEFT=0,
|
NPY_SEARCHLEFT=0,
|
||||||
NPY_SEARCHRIGHT=1
|
NPY_SEARCHRIGHT=1
|
||||||
|
@ -202,7 +199,13 @@ typedef enum {
|
||||||
/* Allow safe casts or casts within the same kind */
|
/* Allow safe casts or casts within the same kind */
|
||||||
NPY_SAME_KIND_CASTING=3,
|
NPY_SAME_KIND_CASTING=3,
|
||||||
/* Allow any casts */
|
/* Allow any casts */
|
||||||
NPY_UNSAFE_CASTING=4
|
NPY_UNSAFE_CASTING=4,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Temporary internal definition only, will be removed in upcoming
|
||||||
|
* release, see below
|
||||||
|
* */
|
||||||
|
NPY_INTERNAL_UNSAFE_CASTING_BUT_WARN_UNLESS_SAME_KIND = 100,
|
||||||
} NPY_CASTING;
|
} NPY_CASTING;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -391,12 +394,6 @@ typedef int (PyArray_FillFunc)(void *, npy_intp, void *);
|
||||||
|
|
||||||
typedef int (PyArray_SortFunc)(void *, npy_intp, void *);
|
typedef int (PyArray_SortFunc)(void *, npy_intp, void *);
|
||||||
typedef int (PyArray_ArgSortFunc)(void *, npy_intp *, npy_intp, void *);
|
typedef int (PyArray_ArgSortFunc)(void *, npy_intp *, npy_intp, void *);
|
||||||
typedef int (PyArray_PartitionFunc)(void *, npy_intp, npy_intp,
|
|
||||||
npy_intp *, npy_intp *,
|
|
||||||
void *);
|
|
||||||
typedef int (PyArray_ArgPartitionFunc)(void *, npy_intp *, npy_intp, npy_intp,
|
|
||||||
npy_intp *, npy_intp *,
|
|
||||||
void *);
|
|
||||||
|
|
||||||
typedef int (PyArray_FillWithScalarFunc)(void *, npy_intp, void *, void *);
|
typedef int (PyArray_FillWithScalarFunc)(void *, npy_intp, void *, void *);
|
||||||
|
|
||||||
|
@ -619,10 +616,6 @@ typedef struct _PyArray_Descr {
|
||||||
* for NumPy 1.7.0.
|
* for NumPy 1.7.0.
|
||||||
*/
|
*/
|
||||||
NpyAuxData *c_metadata;
|
NpyAuxData *c_metadata;
|
||||||
/* Cached hash value (-1 if not yet computed).
|
|
||||||
* This was added for NumPy 2.0.0.
|
|
||||||
*/
|
|
||||||
npy_hash_t hash;
|
|
||||||
} PyArray_Descr;
|
} PyArray_Descr;
|
||||||
|
|
||||||
typedef struct _arr_descr {
|
typedef struct _arr_descr {
|
||||||
|
@ -637,8 +630,8 @@ typedef struct _arr_descr {
|
||||||
* (PyArray_DATA and friends) to access fields here for a number of
|
* (PyArray_DATA and friends) to access fields here for a number of
|
||||||
* releases. Direct access to the members themselves is deprecated.
|
* releases. Direct access to the members themselves is deprecated.
|
||||||
* To ensure that your code does not use deprecated access,
|
* To ensure that your code does not use deprecated access,
|
||||||
* #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
|
* #define NPY_NO_DEPRECATED_API NPY_1_7_VERSION
|
||||||
* (or NPY_1_8_API_VERSION or higher as required).
|
* (or NPY_1_8_VERSION or higher as required).
|
||||||
*/
|
*/
|
||||||
/* This struct will be moved to a private header in a future release */
|
/* This struct will be moved to a private header in a future release */
|
||||||
typedef struct tagPyArrayObject_fields {
|
typedef struct tagPyArrayObject_fields {
|
||||||
|
@ -685,8 +678,7 @@ typedef struct tagPyArrayObject_fields {
|
||||||
* To hide the implementation details, we only expose
|
* To hide the implementation details, we only expose
|
||||||
* the Python struct HEAD.
|
* the Python struct HEAD.
|
||||||
*/
|
*/
|
||||||
#if !defined(NPY_NO_DEPRECATED_API) || \
|
#if !(defined(NPY_NO_DEPRECATED_API) && (NPY_API_VERSION <= NPY_NO_DEPRECATED_API))
|
||||||
(NPY_NO_DEPRECATED_API < NPY_1_7_API_VERSION)
|
|
||||||
/*
|
/*
|
||||||
* Can't put this in npy_deprecated_api.h like the others.
|
* Can't put this in npy_deprecated_api.h like the others.
|
||||||
* PyArrayObject field access is deprecated as of NumPy 1.7.
|
* PyArrayObject field access is deprecated as of NumPy 1.7.
|
||||||
|
@ -765,14 +757,7 @@ typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note: all 0-d arrays are C_CONTIGUOUS and F_CONTIGUOUS. If a
|
* Note: all 0-d arrays are C_CONTIGUOUS and F_CONTIGUOUS. If a
|
||||||
* 1-d array is C_CONTIGUOUS it is also F_CONTIGUOUS. Arrays with
|
* 1-d array is C_CONTIGUOUS it is also F_CONTIGUOUS
|
||||||
* more then one dimension can be C_CONTIGUOUS and F_CONTIGUOUS
|
|
||||||
* at the same time if they have either zero or one element.
|
|
||||||
* If NPY_RELAXED_STRIDES_CHECKING is set, a higher dimensional
|
|
||||||
* array is always C_CONTIGUOUS and F_CONTIGUOUS if it has zero elements
|
|
||||||
* and the array is contiguous if ndarray.squeeze() is contiguous.
|
|
||||||
* I.e. dimensions for which `ndarray.shape[dimension] == 1` are
|
|
||||||
* ignored.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -926,16 +911,12 @@ typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *);
|
||||||
#define PyArray_IS_C_CONTIGUOUS(m) PyArray_CHKFLAGS(m, NPY_ARRAY_C_CONTIGUOUS)
|
#define PyArray_IS_C_CONTIGUOUS(m) PyArray_CHKFLAGS(m, NPY_ARRAY_C_CONTIGUOUS)
|
||||||
#define PyArray_IS_F_CONTIGUOUS(m) PyArray_CHKFLAGS(m, NPY_ARRAY_F_CONTIGUOUS)
|
#define PyArray_IS_F_CONTIGUOUS(m) PyArray_CHKFLAGS(m, NPY_ARRAY_F_CONTIGUOUS)
|
||||||
|
|
||||||
/* the variable is used in some places, so always define it */
|
|
||||||
#define NPY_BEGIN_THREADS_DEF PyThreadState *_save=NULL;
|
|
||||||
#if NPY_ALLOW_THREADS
|
#if NPY_ALLOW_THREADS
|
||||||
#define NPY_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
|
#define NPY_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
|
||||||
#define NPY_END_ALLOW_THREADS Py_END_ALLOW_THREADS
|
#define NPY_END_ALLOW_THREADS Py_END_ALLOW_THREADS
|
||||||
|
#define NPY_BEGIN_THREADS_DEF PyThreadState *_save=NULL;
|
||||||
#define NPY_BEGIN_THREADS do {_save = PyEval_SaveThread();} while (0);
|
#define NPY_BEGIN_THREADS do {_save = PyEval_SaveThread();} while (0);
|
||||||
#define NPY_END_THREADS do { if (_save) \
|
#define NPY_END_THREADS do {if (_save) PyEval_RestoreThread(_save);} while (0);
|
||||||
{ PyEval_RestoreThread(_save); _save = NULL;} } while (0);
|
|
||||||
#define NPY_BEGIN_THREADS_THRESHOLDED(loop_size) do { if (loop_size > 500) \
|
|
||||||
{ _save = PyEval_SaveThread();} } while (0);
|
|
||||||
|
|
||||||
#define NPY_BEGIN_THREADS_DESCR(dtype) \
|
#define NPY_BEGIN_THREADS_DESCR(dtype) \
|
||||||
do {if (!(PyDataType_FLAGCHK(dtype, NPY_NEEDS_PYAPI))) \
|
do {if (!(PyDataType_FLAGCHK(dtype, NPY_NEEDS_PYAPI))) \
|
||||||
|
@ -951,9 +932,9 @@ typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *);
|
||||||
#else
|
#else
|
||||||
#define NPY_BEGIN_ALLOW_THREADS
|
#define NPY_BEGIN_ALLOW_THREADS
|
||||||
#define NPY_END_ALLOW_THREADS
|
#define NPY_END_ALLOW_THREADS
|
||||||
|
#define NPY_BEGIN_THREADS_DEF
|
||||||
#define NPY_BEGIN_THREADS
|
#define NPY_BEGIN_THREADS
|
||||||
#define NPY_END_THREADS
|
#define NPY_END_THREADS
|
||||||
#define NPY_BEGIN_THREADS_THRESHOLDED(loop_size)
|
|
||||||
#define NPY_BEGIN_THREADS_DESCR(dtype)
|
#define NPY_BEGIN_THREADS_DESCR(dtype)
|
||||||
#define NPY_END_THREADS_DESCR(dtype)
|
#define NPY_END_THREADS_DESCR(dtype)
|
||||||
#define NPY_ALLOW_C_API_DEF
|
#define NPY_ALLOW_C_API_DEF
|
||||||
|
@ -1099,6 +1080,27 @@ struct PyArrayIterObject_tag {
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#define _PyArray_ITER_NEXT3(it) do { \
|
||||||
|
if ((it)->coordinates[2] < (it)->dims_m1[2]) { \
|
||||||
|
(it)->coordinates[2]++; \
|
||||||
|
(it)->dataptr += (it)->strides[2]; \
|
||||||
|
} \
|
||||||
|
else { \
|
||||||
|
(it)->coordinates[2] = 0; \
|
||||||
|
(it)->dataptr -= (it)->backstrides[2]; \
|
||||||
|
if ((it)->coordinates[1] < (it)->dims_m1[1]) { \
|
||||||
|
(it)->coordinates[1]++; \
|
||||||
|
(it)->dataptr += (it)->strides[1]; \
|
||||||
|
} \
|
||||||
|
else { \
|
||||||
|
(it)->coordinates[1] = 0; \
|
||||||
|
(it)->coordinates[0]++; \
|
||||||
|
(it)->dataptr += (it)->strides[0] \
|
||||||
|
(it)->backstrides[1]; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define PyArray_ITER_NEXT(it) do { \
|
#define PyArray_ITER_NEXT(it) do { \
|
||||||
_PyAIT(it)->index++; \
|
_PyAIT(it)->index++; \
|
||||||
if (_PyAIT(it)->nd_m1 == 0) { \
|
if (_PyAIT(it)->nd_m1 == 0) { \
|
||||||
|
@ -1233,12 +1235,8 @@ typedef struct {
|
||||||
#define PyArray_MultiIter_NOTDONE(multi) \
|
#define PyArray_MultiIter_NOTDONE(multi) \
|
||||||
(_PyMIT(multi)->index < _PyMIT(multi)->size)
|
(_PyMIT(multi)->index < _PyMIT(multi)->size)
|
||||||
|
|
||||||
|
/* Store the information needed for fancy-indexing over an array */
|
||||||
|
|
||||||
/*
|
|
||||||
* Store the information needed for fancy-indexing over an array. The
|
|
||||||
* fields are slightly unordered to keep consec, dataptr and subspace
|
|
||||||
* where they were originally.
|
|
||||||
*/
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
/*
|
/*
|
||||||
|
@ -1253,71 +1251,29 @@ typedef struct {
|
||||||
npy_intp index; /* current index */
|
npy_intp index; /* current index */
|
||||||
int nd; /* number of dims */
|
int nd; /* number of dims */
|
||||||
npy_intp dimensions[NPY_MAXDIMS]; /* dimensions */
|
npy_intp dimensions[NPY_MAXDIMS]; /* dimensions */
|
||||||
NpyIter *outer; /* index objects
|
PyArrayIterObject *iters[NPY_MAXDIMS]; /* index object
|
||||||
iterator */
|
iterators */
|
||||||
void *unused[NPY_MAXDIMS - 2];
|
PyArrayIterObject *ait; /* flat Iterator for
|
||||||
PyArrayObject *array;
|
underlying array */
|
||||||
/* Flat iterator for the indexed array. For compatibility solely. */
|
|
||||||
PyArrayIterObject *ait;
|
|
||||||
|
|
||||||
/*
|
/* flat iterator for subspace (when numiter < nd) */
|
||||||
* Subspace array. For binary compatibility (was an iterator,
|
PyArrayIterObject *subspace;
|
||||||
* but only the check for NULL should be used).
|
|
||||||
*/
|
|
||||||
PyArrayObject *subspace;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if subspace iteration, then this is the array of axes in
|
* if subspace iteration, then this is the array of axes in
|
||||||
* the underlying array represented by the index objects
|
* the underlying array represented by the index objects
|
||||||
*/
|
*/
|
||||||
int iteraxes[NPY_MAXDIMS];
|
int iteraxes[NPY_MAXDIMS];
|
||||||
npy_intp fancy_strides[NPY_MAXDIMS];
|
|
||||||
|
|
||||||
/* pointer when all fancy indices are 0 */
|
|
||||||
char *baseoffset;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* after binding consec denotes at which axis the fancy axes
|
* if subspace iteration, the these are the coordinates to the
|
||||||
* are inserted.
|
* start of the subspace.
|
||||||
*/
|
*/
|
||||||
|
npy_intp bscoord[NPY_MAXDIMS];
|
||||||
|
|
||||||
|
PyObject *indexobj; /* creating obj */
|
||||||
int consec;
|
int consec;
|
||||||
char *dataptr;
|
char *dataptr;
|
||||||
|
|
||||||
int nd_fancy;
|
|
||||||
npy_intp fancy_dims[NPY_MAXDIMS];
|
|
||||||
|
|
||||||
/* Whether the iterator (any of the iterators) requires API */
|
|
||||||
int needs_api;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Extra op information.
|
|
||||||
*/
|
|
||||||
PyArrayObject *extra_op;
|
|
||||||
PyArray_Descr *extra_op_dtype; /* desired dtype */
|
|
||||||
npy_uint32 *extra_op_flags; /* Iterator flags */
|
|
||||||
|
|
||||||
NpyIter *extra_op_iter;
|
|
||||||
NpyIter_IterNextFunc *extra_op_next;
|
|
||||||
char **extra_op_ptrs;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Information about the iteration state.
|
|
||||||
*/
|
|
||||||
NpyIter_IterNextFunc *outer_next;
|
|
||||||
char **outer_ptrs;
|
|
||||||
npy_intp *outer_strides;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Information about the subspace iterator.
|
|
||||||
*/
|
|
||||||
NpyIter *subspace_iter;
|
|
||||||
NpyIter_IterNextFunc *subspace_next;
|
|
||||||
char **subspace_ptrs;
|
|
||||||
npy_intp *subspace_strides;
|
|
||||||
|
|
||||||
/* Count for the external loop (which ever it is) for API iteration */
|
|
||||||
npy_intp iter_count;
|
|
||||||
|
|
||||||
} PyArrayMapIterObject;
|
} PyArrayMapIterObject;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -1414,12 +1370,12 @@ PyArrayNeighborhoodIter_Next2D(PyArrayNeighborhoodIterObject* iter);
|
||||||
PyArray_CHKFLAGS(m, NPY_ARRAY_F_CONTIGUOUS))
|
PyArray_CHKFLAGS(m, NPY_ARRAY_F_CONTIGUOUS))
|
||||||
|
|
||||||
#define PyArray_ISFORTRAN(m) (PyArray_CHKFLAGS(m, NPY_ARRAY_F_CONTIGUOUS) && \
|
#define PyArray_ISFORTRAN(m) (PyArray_CHKFLAGS(m, NPY_ARRAY_F_CONTIGUOUS) && \
|
||||||
(!PyArray_CHKFLAGS(m, NPY_ARRAY_C_CONTIGUOUS)))
|
(PyArray_NDIM(m) > 1))
|
||||||
|
|
||||||
#define PyArray_FORTRAN_IF(m) ((PyArray_CHKFLAGS(m, NPY_ARRAY_F_CONTIGUOUS) ? \
|
#define PyArray_FORTRAN_IF(m) ((PyArray_CHKFLAGS(m, NPY_ARRAY_F_CONTIGUOUS) ? \
|
||||||
NPY_ARRAY_F_CONTIGUOUS : 0))
|
NPY_ARRAY_F_CONTIGUOUS : 0))
|
||||||
|
|
||||||
#if (defined(NPY_NO_DEPRECATED_API) && (NPY_1_7_API_VERSION <= NPY_NO_DEPRECATED_API))
|
#if (defined(NPY_NO_DEPRECATED_API) && (NPY_API_VERSION <= NPY_NO_DEPRECATED_API))
|
||||||
/*
|
/*
|
||||||
* Changing access macros into functions, to allow for future hiding
|
* Changing access macros into functions, to allow for future hiding
|
||||||
* of the internal memory layout. This later hiding will allow the 2.x series
|
* of the internal memory layout. This later hiding will allow the 2.x series
|
||||||
|
@ -1469,13 +1425,13 @@ PyArray_STRIDE(const PyArrayObject *arr, int istride)
|
||||||
return ((PyArrayObject_fields *)arr)->strides[istride];
|
return ((PyArrayObject_fields *)arr)->strides[istride];
|
||||||
}
|
}
|
||||||
|
|
||||||
static NPY_INLINE NPY_RETURNS_BORROWED_REF PyObject *
|
static NPY_INLINE PyObject *
|
||||||
PyArray_BASE(PyArrayObject *arr)
|
PyArray_BASE(PyArrayObject *arr)
|
||||||
{
|
{
|
||||||
return ((PyArrayObject_fields *)arr)->base;
|
return ((PyArrayObject_fields *)arr)->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
static NPY_INLINE NPY_RETURNS_BORROWED_REF PyArray_Descr *
|
static NPY_INLINE PyArray_Descr *
|
||||||
PyArray_DESCR(PyArrayObject *arr)
|
PyArray_DESCR(PyArrayObject *arr)
|
||||||
{
|
{
|
||||||
return ((PyArrayObject_fields *)arr)->descr;
|
return ((PyArrayObject_fields *)arr)->descr;
|
||||||
|
@ -1768,30 +1724,8 @@ typedef struct {
|
||||||
typedef void (PyDataMem_EventHookFunc)(void *inp, void *outp, size_t size,
|
typedef void (PyDataMem_EventHookFunc)(void *inp, void *outp, size_t size,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
/*
|
#if !(defined(NPY_NO_DEPRECATED_API) && (NPY_API_VERSION <= NPY_NO_DEPRECATED_API))
|
||||||
* Use the keyword NPY_DEPRECATED_INCLUDES to ensure that the header files
|
#include "npy_deprecated_api.h"
|
||||||
* npy_*_*_deprecated_api.h are only included from here and nowhere else.
|
|
||||||
*/
|
|
||||||
#ifdef NPY_DEPRECATED_INCLUDES
|
|
||||||
#error "Do not use the reserved keyword NPY_DEPRECATED_INCLUDES."
|
|
||||||
#endif
|
#endif
|
||||||
#define NPY_DEPRECATED_INCLUDES
|
|
||||||
#if !defined(NPY_NO_DEPRECATED_API) || \
|
|
||||||
(NPY_NO_DEPRECATED_API < NPY_1_7_API_VERSION)
|
|
||||||
#include "npy_1_7_deprecated_api.h"
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
* There is no file npy_1_8_deprecated_api.h since there are no additional
|
|
||||||
* deprecated API features in NumPy 1.8.
|
|
||||||
*
|
|
||||||
* Note to maintainers: insert code like the following in future NumPy
|
|
||||||
* versions.
|
|
||||||
*
|
|
||||||
* #if !defined(NPY_NO_DEPRECATED_API) || \
|
|
||||||
* (NPY_NO_DEPRECATED_API < NPY_1_9_API_VERSION)
|
|
||||||
* #include "npy_1_9_deprecated_api.h"
|
|
||||||
* #endif
|
|
||||||
*/
|
|
||||||
#undef NPY_DEPRECATED_INCLUDES
|
|
||||||
|
|
||||||
#endif /* NPY_ARRAYTYPES_H */
|
#endif /* NPY_ARRAYTYPES_H */
|
||||||
|
|
|
@ -64,11 +64,8 @@
|
||||||
#define datetime npy_datetime
|
#define datetime npy_datetime
|
||||||
#define timedelta npy_timedelta
|
#define timedelta npy_timedelta
|
||||||
|
|
||||||
#define SIZEOF_LONGLONG NPY_SIZEOF_LONGLONG
|
|
||||||
#define SIZEOF_INTP NPY_SIZEOF_INTP
|
#define SIZEOF_INTP NPY_SIZEOF_INTP
|
||||||
#define SIZEOF_UINTP NPY_SIZEOF_UINTP
|
#define SIZEOF_UINTP NPY_SIZEOF_UINTP
|
||||||
#define SIZEOF_HALF NPY_SIZEOF_HALF
|
|
||||||
#define SIZEOF_LONGDOUBLE NPY_SIZEOF_LONGDOUBLE
|
|
||||||
#define SIZEOF_DATETIME NPY_SIZEOF_DATETIME
|
#define SIZEOF_DATETIME NPY_SIZEOF_DATETIME
|
||||||
#define SIZEOF_TIMEDELTA NPY_SIZEOF_TIMEDELTA
|
#define SIZEOF_TIMEDELTA NPY_SIZEOF_TIMEDELTA
|
||||||
|
|
||||||
|
@ -116,6 +113,9 @@
|
||||||
#define MIN_TIMEDELTA NPY_MIN_TIMEDELTA
|
#define MIN_TIMEDELTA NPY_MIN_TIMEDELTA
|
||||||
#define MAX_TIMEDELTA NPY_MAX_TIMEDELTA
|
#define MAX_TIMEDELTA NPY_MAX_TIMEDELTA
|
||||||
|
|
||||||
|
#define SIZEOF_LONGDOUBLE NPY_SIZEOF_LONGDOUBLE
|
||||||
|
#define SIZEOF_LONGLONG NPY_SIZEOF_LONGLONG
|
||||||
|
#define SIZEOF_HALF NPY_SIZEOF_HALF
|
||||||
#define BITSOF_BOOL NPY_BITSOF_BOOL
|
#define BITSOF_BOOL NPY_BITSOF_BOOL
|
||||||
#define BITSOF_CHAR NPY_BITSOF_CHAR
|
#define BITSOF_CHAR NPY_BITSOF_CHAR
|
||||||
#define BITSOF_SHORT NPY_BITSOF_SHORT
|
#define BITSOF_SHORT NPY_BITSOF_SHORT
|
||||||
|
|
|
@ -141,17 +141,17 @@ PyUnicode_Concat2(PyObject **left, PyObject *right)
|
||||||
* PyFile_* compatibility
|
* PyFile_* compatibility
|
||||||
*/
|
*/
|
||||||
#if defined(NPY_PY3K)
|
#if defined(NPY_PY3K)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get a FILE* handle to the file represented by the Python object
|
* Get a FILE* handle to the file represented by the Python object
|
||||||
*/
|
*/
|
||||||
static NPY_INLINE FILE*
|
static NPY_INLINE FILE*
|
||||||
npy_PyFile_Dup2(PyObject *file, char *mode, npy_off_t *orig_pos)
|
npy_PyFile_Dup(PyObject *file, char *mode)
|
||||||
{
|
{
|
||||||
int fd, fd2;
|
int fd, fd2;
|
||||||
PyObject *ret, *os;
|
PyObject *ret, *os;
|
||||||
npy_off_t pos;
|
Py_ssize_t pos;
|
||||||
FILE *handle;
|
FILE *handle;
|
||||||
|
|
||||||
/* Flush first to ensure things end up in the file in the correct order */
|
/* Flush first to ensure things end up in the file in the correct order */
|
||||||
ret = PyObject_CallMethod(file, "flush", "");
|
ret = PyObject_CallMethod(file, "flush", "");
|
||||||
if (ret == NULL) {
|
if (ret == NULL) {
|
||||||
|
@ -162,11 +162,6 @@ npy_PyFile_Dup2(PyObject *file, char *mode, npy_off_t *orig_pos)
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* The handle needs to be dup'd because we have to call fclose
|
|
||||||
* at the end
|
|
||||||
*/
|
|
||||||
os = PyImport_ImportModule("os");
|
os = PyImport_ImportModule("os");
|
||||||
if (os == NULL) {
|
if (os == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -178,8 +173,6 @@ npy_PyFile_Dup2(PyObject *file, char *mode, npy_off_t *orig_pos)
|
||||||
}
|
}
|
||||||
fd2 = PyNumber_AsSsize_t(ret, NULL);
|
fd2 = PyNumber_AsSsize_t(ret, NULL);
|
||||||
Py_DECREF(ret);
|
Py_DECREF(ret);
|
||||||
|
|
||||||
/* Convert to FILE* handle */
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
handle = _fdopen(fd2, mode);
|
handle = _fdopen(fd2, mode);
|
||||||
#else
|
#else
|
||||||
|
@ -189,32 +182,18 @@ npy_PyFile_Dup2(PyObject *file, char *mode, npy_off_t *orig_pos)
|
||||||
PyErr_SetString(PyExc_IOError,
|
PyErr_SetString(PyExc_IOError,
|
||||||
"Getting a FILE* from a Python file object failed");
|
"Getting a FILE* from a Python file object failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Record the original raw file handle position */
|
|
||||||
*orig_pos = npy_ftell(handle);
|
|
||||||
if (*orig_pos == -1) {
|
|
||||||
PyErr_SetString(PyExc_IOError, "obtaining file position failed");
|
|
||||||
fclose(handle);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Seek raw handle to the Python-side position */
|
|
||||||
ret = PyObject_CallMethod(file, "tell", "");
|
ret = PyObject_CallMethod(file, "tell", "");
|
||||||
if (ret == NULL) {
|
if (ret == NULL) {
|
||||||
fclose(handle);
|
fclose(handle);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
pos = PyLong_AsLongLong(ret);
|
pos = PyNumber_AsSsize_t(ret, PyExc_OverflowError);
|
||||||
Py_DECREF(ret);
|
Py_DECREF(ret);
|
||||||
if (PyErr_Occurred()) {
|
if (PyErr_Occurred()) {
|
||||||
fclose(handle);
|
fclose(handle);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (npy_fseek(handle, pos, SEEK_SET) == -1) {
|
npy_fseek(handle, pos, SEEK_SET);
|
||||||
PyErr_SetString(PyExc_IOError, "seeking file failed");
|
|
||||||
fclose(handle);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,37 +201,14 @@ npy_PyFile_Dup2(PyObject *file, char *mode, npy_off_t *orig_pos)
|
||||||
* Close the dup-ed file handle, and seek the Python one to the current position
|
* Close the dup-ed file handle, and seek the Python one to the current position
|
||||||
*/
|
*/
|
||||||
static NPY_INLINE int
|
static NPY_INLINE int
|
||||||
npy_PyFile_DupClose2(PyObject *file, FILE* handle, npy_off_t orig_pos)
|
npy_PyFile_DupClose(PyObject *file, FILE* handle)
|
||||||
{
|
{
|
||||||
int fd;
|
|
||||||
PyObject *ret;
|
PyObject *ret;
|
||||||
npy_off_t position;
|
Py_ssize_t position;
|
||||||
|
|
||||||
position = npy_ftell(handle);
|
position = npy_ftell(handle);
|
||||||
|
|
||||||
/* Close the FILE* handle */
|
|
||||||
fclose(handle);
|
fclose(handle);
|
||||||
|
|
||||||
/*
|
ret = PyObject_CallMethod(file, "seek", NPY_SSIZE_T_PYFMT "i", position, 0);
|
||||||
* Restore original file handle position, in order to not confuse
|
|
||||||
* Python-side data structures
|
|
||||||
*/
|
|
||||||
fd = PyObject_AsFileDescriptor(file);
|
|
||||||
if (fd == -1) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (npy_lseek(fd, orig_pos, SEEK_SET) == -1) {
|
|
||||||
PyErr_SetString(PyExc_IOError, "seeking file failed");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (position == -1) {
|
|
||||||
PyErr_SetString(PyExc_IOError, "obtaining file position failed");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Seek Python-side handle to the FILE* handle position */
|
|
||||||
ret = PyObject_CallMethod(file, "seek", NPY_OFF_T_PYFMT "i", position, 0);
|
|
||||||
if (ret == NULL) {
|
if (ret == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -274,20 +230,8 @@ npy_PyFile_Check(PyObject *file)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static NPY_INLINE FILE *
|
#define npy_PyFile_Dup(file, mode) PyFile_AsFile(file)
|
||||||
npy_PyFile_Dup2(PyObject *file,
|
#define npy_PyFile_DupClose(file, handle) (0)
|
||||||
const char *NPY_UNUSED(mode), npy_off_t *NPY_UNUSED(orig_pos))
|
|
||||||
{
|
|
||||||
return PyFile_AsFile(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
static NPY_INLINE int
|
|
||||||
npy_PyFile_DupClose2(PyObject *NPY_UNUSED(file), FILE* NPY_UNUSED(handle),
|
|
||||||
npy_off_t NPY_UNUSED(orig_pos))
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define npy_PyFile_Check PyFile_Check
|
#define npy_PyFile_Check PyFile_Check
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -325,7 +269,7 @@ PyObject_Cmp(PyObject *i1, PyObject *i2, int *cmp)
|
||||||
{
|
{
|
||||||
int v;
|
int v;
|
||||||
v = PyObject_RichCompareBool(i1, i2, Py_LT);
|
v = PyObject_RichCompareBool(i1, i2, Py_LT);
|
||||||
if (v == 1) {
|
if (v == 0) {
|
||||||
*cmp = -1;
|
*cmp = -1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -334,7 +278,7 @@ PyObject_Cmp(PyObject *i1, PyObject *i2, int *cmp)
|
||||||
}
|
}
|
||||||
|
|
||||||
v = PyObject_RichCompareBool(i1, i2, Py_GT);
|
v = PyObject_RichCompareBool(i1, i2, Py_GT);
|
||||||
if (v == 1) {
|
if (v == 0) {
|
||||||
*cmp = 1;
|
*cmp = 1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -343,7 +287,7 @@ PyObject_Cmp(PyObject *i1, PyObject *i2, int *cmp)
|
||||||
}
|
}
|
||||||
|
|
||||||
v = PyObject_RichCompareBool(i1, i2, Py_EQ);
|
v = PyObject_RichCompareBool(i1, i2, Py_EQ);
|
||||||
if (v == 1) {
|
if (v == 0) {
|
||||||
*cmp = 0;
|
*cmp = 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -406,6 +350,12 @@ NpyCapsule_Check(PyObject *ptr)
|
||||||
return PyCapsule_CheckExact(ptr);
|
return PyCapsule_CheckExact(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static NPY_INLINE void
|
||||||
|
simple_capsule_dtor(PyObject *cap)
|
||||||
|
{
|
||||||
|
PyArray_free(PyCapsule_GetPointer(cap, NULL));
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static NPY_INLINE PyObject *
|
static NPY_INLINE PyObject *
|
||||||
|
@ -439,6 +389,25 @@ NpyCapsule_Check(PyObject *ptr)
|
||||||
return PyCObject_Check(ptr);
|
return PyCObject_Check(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static NPY_INLINE void
|
||||||
|
simple_capsule_dtor(void *ptr)
|
||||||
|
{
|
||||||
|
PyArray_free(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Hash value compatibility.
|
||||||
|
* As of Python 3.2 hash values are of type Py_hash_t.
|
||||||
|
* Previous versions use C long.
|
||||||
|
*/
|
||||||
|
#if PY_VERSION_HEX < 0x03020000
|
||||||
|
typedef long npy_hash_t;
|
||||||
|
#define NPY_SIZEOF_HASH_T NPY_SIZEOF_LONG
|
||||||
|
#else
|
||||||
|
typedef Py_hash_t npy_hash_t;
|
||||||
|
#define NPY_SIZEOF_HASH_T NPY_SIZEOF_INTP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -3,63 +3,6 @@
|
||||||
|
|
||||||
/* numpconfig.h is auto-generated */
|
/* numpconfig.h is auto-generated */
|
||||||
#include "numpyconfig.h"
|
#include "numpyconfig.h"
|
||||||
#ifdef HAVE_NPY_CONFIG_H
|
|
||||||
#include <npy_config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* gcc does not unroll even with -O3
|
|
||||||
* use with care, unrolling on modern cpus rarely speeds things up
|
|
||||||
*/
|
|
||||||
#ifdef HAVE_ATTRIBUTE_OPTIMIZE_UNROLL_LOOPS
|
|
||||||
#define NPY_GCC_UNROLL_LOOPS \
|
|
||||||
__attribute__((optimize("unroll-loops")))
|
|
||||||
#else
|
|
||||||
#define NPY_GCC_UNROLL_LOOPS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* highest gcc optimization level, enabled autovectorizer */
|
|
||||||
#ifdef HAVE_ATTRIBUTE_OPTIMIZE_OPT_3
|
|
||||||
#define NPY_GCC_OPT_3 __attribute__((optimize("O3")))
|
|
||||||
#else
|
|
||||||
#define NPY_GCC_OPT_3
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* mark an argument (starting from 1) that must not be NULL and is not checked
|
|
||||||
* DO NOT USE IF FUNCTION CHECKS FOR NULL!! the compiler will remove the check
|
|
||||||
*/
|
|
||||||
#ifdef HAVE_ATTRIBUTE_NONNULL
|
|
||||||
#define NPY_GCC_NONNULL(n) __attribute__((nonnull(n)))
|
|
||||||
#else
|
|
||||||
#define NPY_GCC_NONNULL(n)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined HAVE_XMMINTRIN_H && defined HAVE__MM_LOAD_PS
|
|
||||||
#define NPY_HAVE_SSE_INTRINSICS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined HAVE_EMMINTRIN_H && defined HAVE__MM_LOAD_PD
|
|
||||||
#define NPY_HAVE_SSE2_INTRINSICS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* give a hint to the compiler which branch is more likely or unlikely
|
|
||||||
* to occur, e.g. rare error cases:
|
|
||||||
*
|
|
||||||
* if (NPY_UNLIKELY(failure == 0))
|
|
||||||
* return NULL;
|
|
||||||
*
|
|
||||||
* the double !! is to cast the expression (e.g. NULL) to a boolean required by
|
|
||||||
* the intrinsic
|
|
||||||
*/
|
|
||||||
#ifdef HAVE___BUILTIN_EXPECT
|
|
||||||
#define NPY_LIKELY(x) __builtin_expect(!!(x), 1)
|
|
||||||
#define NPY_UNLIKELY(x) __builtin_expect(!!(x), 0)
|
|
||||||
#else
|
|
||||||
#define NPY_LIKELY(x) (x)
|
|
||||||
#define NPY_UNLIKELY(x) (x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#define NPY_INLINE __inline
|
#define NPY_INLINE __inline
|
||||||
|
@ -73,82 +16,14 @@
|
||||||
#define NPY_INLINE
|
#define NPY_INLINE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE___THREAD
|
/* Enable 64 bit file position support on win-amd64. Ticket #1660 */
|
||||||
#define NPY_TLS __thread
|
#if defined(_MSC_VER) && defined(_WIN64) && (_MSC_VER > 1400)
|
||||||
#else
|
|
||||||
#ifdef HAVE___DECLSPEC_THREAD_
|
|
||||||
#define NPY_TLS __declspec(thread)
|
|
||||||
#else
|
|
||||||
#define NPY_TLS
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WITH_CPYCHECKER_RETURNS_BORROWED_REF_ATTRIBUTE
|
|
||||||
#define NPY_RETURNS_BORROWED_REF \
|
|
||||||
__attribute__((cpychecker_returns_borrowed_ref))
|
|
||||||
#else
|
|
||||||
#define NPY_RETURNS_BORROWED_REF
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WITH_CPYCHECKER_STEALS_REFERENCE_TO_ARG_ATTRIBUTE
|
|
||||||
#define NPY_STEALS_REF_TO_ARG(n) \
|
|
||||||
__attribute__((cpychecker_steals_reference_to_arg(n)))
|
|
||||||
#else
|
|
||||||
#define NPY_STEALS_REF_TO_ARG(n)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* 64 bit file position support, also on win-amd64. Ticket #1660 */
|
|
||||||
#if defined(_MSC_VER) && defined(_WIN64) && (_MSC_VER > 1400) || \
|
|
||||||
defined(__MINGW32__) || defined(__MINGW64__)
|
|
||||||
#include <io.h>
|
|
||||||
|
|
||||||
/* mingw based on 3.4.5 has lseek but not ftell/fseek */
|
|
||||||
#if defined(__MINGW32__) || defined(__MINGW64__)
|
|
||||||
extern int __cdecl _fseeki64(FILE *, long long, int);
|
|
||||||
extern long long __cdecl _ftelli64(FILE *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define npy_fseek _fseeki64
|
#define npy_fseek _fseeki64
|
||||||
#define npy_ftell _ftelli64
|
#define npy_ftell _ftelli64
|
||||||
#define npy_lseek _lseeki64
|
|
||||||
#define npy_off_t npy_int64
|
|
||||||
|
|
||||||
#if NPY_SIZEOF_INT == 8
|
|
||||||
#define NPY_OFF_T_PYFMT "i"
|
|
||||||
#elif NPY_SIZEOF_LONG == 8
|
|
||||||
#define NPY_OFF_T_PYFMT "l"
|
|
||||||
#elif NPY_SIZEOF_LONGLONG == 8
|
|
||||||
#define NPY_OFF_T_PYFMT "L"
|
|
||||||
#else
|
|
||||||
#error Unsupported size for type off_t
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#ifdef HAVE_FSEEKO
|
|
||||||
#define npy_fseek fseeko
|
|
||||||
#else
|
#else
|
||||||
#define npy_fseek fseek
|
#define npy_fseek fseek
|
||||||
#endif
|
|
||||||
#ifdef HAVE_FTELLO
|
|
||||||
#define npy_ftell ftello
|
|
||||||
#else
|
|
||||||
#define npy_ftell ftell
|
#define npy_ftell ftell
|
||||||
#endif
|
#endif
|
||||||
#include <sys/types.h>
|
|
||||||
#define npy_lseek lseek
|
|
||||||
#define npy_off_t off_t
|
|
||||||
|
|
||||||
#if NPY_SIZEOF_OFF_T == NPY_SIZEOF_SHORT
|
|
||||||
#define NPY_OFF_T_PYFMT "h"
|
|
||||||
#elif NPY_SIZEOF_OFF_T == NPY_SIZEOF_INT
|
|
||||||
#define NPY_OFF_T_PYFMT "i"
|
|
||||||
#elif NPY_SIZEOF_OFF_T == NPY_SIZEOF_LONG
|
|
||||||
#define NPY_OFF_T_PYFMT "l"
|
|
||||||
#elif NPY_SIZEOF_OFF_T == NPY_SIZEOF_LONGLONG
|
|
||||||
#define NPY_OFF_T_PYFMT "L"
|
|
||||||
#else
|
|
||||||
#error Unsupported size for type off_t
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* enums for detected endianness */
|
/* enums for detected endianness */
|
||||||
enum {
|
enum {
|
||||||
|
@ -158,22 +33,15 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is to typedef npy_intp to the appropriate pointer size for this
|
* This is to typedef npy_intp to the appropriate pointer size for
|
||||||
* platform. Py_intptr_t, Py_uintptr_t are defined in pyport.h.
|
* this platform. Py_intptr_t, Py_uintptr_t are defined in pyport.h.
|
||||||
*/
|
*/
|
||||||
typedef Py_intptr_t npy_intp;
|
typedef Py_intptr_t npy_intp;
|
||||||
typedef Py_uintptr_t npy_uintp;
|
typedef Py_uintptr_t npy_uintp;
|
||||||
|
|
||||||
/*
|
|
||||||
* Define sizes that were not defined in numpyconfig.h.
|
|
||||||
*/
|
|
||||||
#define NPY_SIZEOF_CHAR 1
|
#define NPY_SIZEOF_CHAR 1
|
||||||
#define NPY_SIZEOF_BYTE 1
|
#define NPY_SIZEOF_BYTE 1
|
||||||
#define NPY_SIZEOF_DATETIME 8
|
|
||||||
#define NPY_SIZEOF_TIMEDELTA 8
|
|
||||||
#define NPY_SIZEOF_INTP NPY_SIZEOF_PY_INTPTR_T
|
#define NPY_SIZEOF_INTP NPY_SIZEOF_PY_INTPTR_T
|
||||||
#define NPY_SIZEOF_UINTP NPY_SIZEOF_PY_INTPTR_T
|
#define NPY_SIZEOF_UINTP NPY_SIZEOF_PY_INTPTR_T
|
||||||
#define NPY_SIZEOF_HALF 2
|
|
||||||
#define NPY_SIZEOF_CFLOAT NPY_SIZEOF_COMPLEX_FLOAT
|
#define NPY_SIZEOF_CFLOAT NPY_SIZEOF_COMPLEX_FLOAT
|
||||||
#define NPY_SIZEOF_CDOUBLE NPY_SIZEOF_COMPLEX_DOUBLE
|
#define NPY_SIZEOF_CDOUBLE NPY_SIZEOF_COMPLEX_DOUBLE
|
||||||
#define NPY_SIZEOF_CLONGDOUBLE NPY_SIZEOF_COMPLEX_LONGDOUBLE
|
#define NPY_SIZEOF_CLONGDOUBLE NPY_SIZEOF_COMPLEX_LONGDOUBLE
|
||||||
|
@ -182,8 +50,18 @@ typedef Py_uintptr_t npy_uintp;
|
||||||
#undef constchar
|
#undef constchar
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if (PY_VERSION_HEX < 0x02050000)
|
||||||
|
#ifndef PY_SSIZE_T_MIN
|
||||||
|
typedef int Py_ssize_t;
|
||||||
|
#define PY_SSIZE_T_MAX INT_MAX
|
||||||
|
#define PY_SSIZE_T_MIN INT_MIN
|
||||||
|
#endif
|
||||||
|
#define NPY_SSIZE_T_PYFMT "i"
|
||||||
|
#define constchar const char
|
||||||
|
#else
|
||||||
#define NPY_SSIZE_T_PYFMT "n"
|
#define NPY_SSIZE_T_PYFMT "n"
|
||||||
#define constchar char
|
#define constchar char
|
||||||
|
#endif
|
||||||
|
|
||||||
/* NPY_INTP_FMT Note:
|
/* NPY_INTP_FMT Note:
|
||||||
* Unlike the other NPY_*_FMT macros which are used with
|
* Unlike the other NPY_*_FMT macros which are used with
|
||||||
|
@ -265,9 +143,18 @@ typedef unsigned PY_LONG_LONG npy_ulonglong;
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# define NPY_LONGLONG_FMT "I64d"
|
# define NPY_LONGLONG_FMT "I64d"
|
||||||
# define NPY_ULONGLONG_FMT "I64u"
|
# define NPY_ULONGLONG_FMT "I64u"
|
||||||
# else
|
# elif defined(__APPLE__) || defined(__FreeBSD__)
|
||||||
|
/* "%Ld" only parses 4 bytes -- "L" is floating modifier on MacOS X/BSD */
|
||||||
# define NPY_LONGLONG_FMT "lld"
|
# define NPY_LONGLONG_FMT "lld"
|
||||||
# define NPY_ULONGLONG_FMT "llu"
|
# define NPY_ULONGLONG_FMT "llu"
|
||||||
|
/*
|
||||||
|
another possible variant -- *quad_t works on *BSD, but is deprecated:
|
||||||
|
#define LONGLONG_FMT "qd"
|
||||||
|
#define ULONGLONG_FMT "qu"
|
||||||
|
*/
|
||||||
|
# else
|
||||||
|
# define NPY_LONGLONG_FMT "Ld"
|
||||||
|
# define NPY_ULONGLONG_FMT "Lu"
|
||||||
# endif
|
# endif
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# define NPY_LONGLONG_SUFFIX(x) (x##i64)
|
# define NPY_LONGLONG_SUFFIX(x) (x##i64)
|
||||||
|
@ -316,19 +203,6 @@ typedef long npy_long;
|
||||||
typedef float npy_float;
|
typedef float npy_float;
|
||||||
typedef double npy_double;
|
typedef double npy_double;
|
||||||
|
|
||||||
/*
|
|
||||||
* Hash value compatibility.
|
|
||||||
* As of Python 3.2 hash values are of type Py_hash_t.
|
|
||||||
* Previous versions use C long.
|
|
||||||
*/
|
|
||||||
#if PY_VERSION_HEX < 0x03020000
|
|
||||||
typedef long npy_hash_t;
|
|
||||||
#define NPY_SIZEOF_HASH_T NPY_SIZEOF_LONG
|
|
||||||
#else
|
|
||||||
typedef Py_hash_t npy_hash_t;
|
|
||||||
#define NPY_SIZEOF_HASH_T NPY_SIZEOF_INTP
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Disabling C99 complex usage: a lot of C code in numpy/scipy rely on being
|
* Disabling C99 complex usage: a lot of C code in numpy/scipy rely on being
|
||||||
* able to do .real/.imag. Will have to convert code first.
|
* able to do .real/.imag. Will have to convert code first.
|
||||||
|
@ -431,6 +305,10 @@ typedef struct { npy_longdouble real, imag; } npy_clongdouble;
|
||||||
#define NPY_MIN_LONG LONG_MIN
|
#define NPY_MIN_LONG LONG_MIN
|
||||||
#define NPY_MAX_ULONG ULONG_MAX
|
#define NPY_MAX_ULONG ULONG_MAX
|
||||||
|
|
||||||
|
#define NPY_SIZEOF_HALF 2
|
||||||
|
#define NPY_SIZEOF_DATETIME 8
|
||||||
|
#define NPY_SIZEOF_TIMEDELTA 8
|
||||||
|
|
||||||
#define NPY_BITSOF_BOOL (sizeof(npy_bool) * CHAR_BIT)
|
#define NPY_BITSOF_BOOL (sizeof(npy_bool) * CHAR_BIT)
|
||||||
#define NPY_BITSOF_CHAR CHAR_BIT
|
#define NPY_BITSOF_CHAR CHAR_BIT
|
||||||
#define NPY_BITSOF_BYTE (NPY_SIZEOF_BYTE * CHAR_BIT)
|
#define NPY_BITSOF_BYTE (NPY_SIZEOF_BYTE * CHAR_BIT)
|
||||||
|
@ -1049,3 +927,4 @@ typedef npy_int64 npy_datetime;
|
||||||
/* End of typedefs for numarray style bit-width names */
|
/* End of typedefs for numarray style bit-width names */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
* NPY_CPU_AMD64
|
* NPY_CPU_AMD64
|
||||||
* NPY_CPU_PPC
|
* NPY_CPU_PPC
|
||||||
* NPY_CPU_PPC64
|
* NPY_CPU_PPC64
|
||||||
* NPY_CPU_PPC64LE
|
|
||||||
* NPY_CPU_SPARC
|
* NPY_CPU_SPARC
|
||||||
* NPY_CPU_S390
|
* NPY_CPU_S390
|
||||||
* NPY_CPU_IA64
|
* NPY_CPU_IA64
|
||||||
|
@ -20,7 +19,6 @@
|
||||||
#define _NPY_CPUARCH_H_
|
#define _NPY_CPUARCH_H_
|
||||||
|
|
||||||
#include "numpyconfig.h"
|
#include "numpyconfig.h"
|
||||||
#include <string.h> /* for memcpy */
|
|
||||||
|
|
||||||
#if defined( __i386__ ) || defined(i386) || defined(_M_IX86)
|
#if defined( __i386__ ) || defined(i386) || defined(_M_IX86)
|
||||||
/*
|
/*
|
||||||
|
@ -43,8 +41,6 @@
|
||||||
* _ARCH_PPC is used by at least gcc on AIX
|
* _ARCH_PPC is used by at least gcc on AIX
|
||||||
*/
|
*/
|
||||||
#define NPY_CPU_PPC
|
#define NPY_CPU_PPC
|
||||||
#elif defined(__ppc64le__)
|
|
||||||
#define NPY_CPU_PPC64LE
|
|
||||||
#elif defined(__ppc64__)
|
#elif defined(__ppc64__)
|
||||||
#define NPY_CPU_PPC64
|
#define NPY_CPU_PPC64
|
||||||
#elif defined(__sparc__) || defined(__sparc)
|
#elif defined(__sparc__) || defined(__sparc)
|
||||||
|
@ -70,23 +66,44 @@
|
||||||
#define NPY_CPU_MIPSEL
|
#define NPY_CPU_MIPSEL
|
||||||
#elif defined(__MIPSEB__)
|
#elif defined(__MIPSEB__)
|
||||||
#define NPY_CPU_MIPSEB
|
#define NPY_CPU_MIPSEB
|
||||||
#elif defined(__or1k__)
|
|
||||||
#define NPY_CPU_OR1K
|
|
||||||
#elif defined(__aarch64__)
|
#elif defined(__aarch64__)
|
||||||
#define NPY_CPU_AARCH64
|
#define NPY_CPU_AARCH64
|
||||||
#elif defined(__mc68000__)
|
|
||||||
#define NPY_CPU_M68K
|
|
||||||
#else
|
#else
|
||||||
#error Unknown CPU, please report this to numpy maintainers with \
|
#error Unknown CPU, please report this to numpy maintainers with \
|
||||||
information about your platform (OS, CPU and compiler)
|
information about your platform (OS, CPU and compiler)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NPY_COPY_PYOBJECT_PTR(dst, src) memcpy(dst, src, sizeof(PyObject *))
|
/*
|
||||||
|
This "white-lists" the architectures that we know don't require
|
||||||
|
pointer alignment. We white-list, since the memcpy version will
|
||||||
|
work everywhere, whereas assignment will only work where pointer
|
||||||
|
dereferencing doesn't require alignment.
|
||||||
|
|
||||||
#if (defined(NPY_CPU_X86) || defined(NPY_CPU_AMD64))
|
TODO: There may be more architectures we can white list.
|
||||||
#define NPY_CPU_HAVE_UNALIGNED_ACCESS 1
|
*/
|
||||||
|
#if defined(NPY_CPU_X86) || defined(NPY_CPU_AMD64)
|
||||||
|
#define NPY_COPY_PYOBJECT_PTR(dst, src) (*((PyObject **)(dst)) = *((PyObject **)(src)))
|
||||||
#else
|
#else
|
||||||
#define NPY_CPU_HAVE_UNALIGNED_ACCESS 0
|
#if NPY_SIZEOF_PY_INTPTR_T == 4
|
||||||
|
#define NPY_COPY_PYOBJECT_PTR(dst, src) \
|
||||||
|
((char*)(dst))[0] = ((char*)(src))[0]; \
|
||||||
|
((char*)(dst))[1] = ((char*)(src))[1]; \
|
||||||
|
((char*)(dst))[2] = ((char*)(src))[2]; \
|
||||||
|
((char*)(dst))[3] = ((char*)(src))[3];
|
||||||
|
#elif NPY_SIZEOF_PY_INTPTR_T == 8
|
||||||
|
#define NPY_COPY_PYOBJECT_PTR(dst, src) \
|
||||||
|
((char*)(dst))[0] = ((char*)(src))[0]; \
|
||||||
|
((char*)(dst))[1] = ((char*)(src))[1]; \
|
||||||
|
((char*)(dst))[2] = ((char*)(src))[2]; \
|
||||||
|
((char*)(dst))[3] = ((char*)(src))[3]; \
|
||||||
|
((char*)(dst))[4] = ((char*)(src))[4]; \
|
||||||
|
((char*)(dst))[5] = ((char*)(src))[5]; \
|
||||||
|
((char*)(dst))[6] = ((char*)(src))[6]; \
|
||||||
|
((char*)(dst))[7] = ((char*)(src))[7];
|
||||||
|
#else
|
||||||
|
#error Unknown architecture, please report this to numpy maintainers with \
|
||||||
|
information about your platform (OS, CPU and compiler)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
#ifndef _NPY_1_7_DEPRECATED_API_H
|
#ifndef _NPY_DEPRECATED_API_H
|
||||||
#define _NPY_1_7_DEPRECATED_API_H
|
#define _NPY_DEPRECATED_API_H
|
||||||
|
|
||||||
#ifndef NPY_DEPRECATED_INCLUDES
|
|
||||||
#error "Should never include npy_*_*_deprecated_api directly."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#define _WARN___STR2__(x) #x
|
#define _WARN___STR2__(x) #x
|
||||||
|
@ -12,19 +8,21 @@
|
||||||
#pragma message(_WARN___LOC__"Using deprecated NumPy API, disable it by " \
|
#pragma message(_WARN___LOC__"Using deprecated NumPy API, disable it by " \
|
||||||
"#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION")
|
"#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION")
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
#warning "Using deprecated NumPy API, disable it by " \
|
#warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
|
||||||
"#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
|
|
||||||
#endif
|
#endif
|
||||||
/* TODO: How to do this warning message for other compilers? */
|
/* TODO: How to do this warning message for other compilers? */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This header exists to collect all dangerous/deprecated NumPy API
|
* This header exists to collect all dangerous/deprecated NumPy API.
|
||||||
* as of NumPy 1.7.
|
|
||||||
*
|
*
|
||||||
* This is an attempt to remove bad API, the proliferation of macros,
|
* This is an attempt to remove bad API, the proliferation of macros,
|
||||||
* and namespace pollution currently produced by the NumPy headers.
|
* and namespace pollution currently produced by the NumPy headers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined(NPY_NO_DEPRECATED_API)
|
||||||
|
#error Should never include npy_deprecated_api directly.
|
||||||
|
#endif
|
||||||
|
|
||||||
/* These array flags are deprecated as of NumPy 1.7 */
|
/* These array flags are deprecated as of NumPy 1.7 */
|
||||||
#define NPY_CONTIGUOUS NPY_ARRAY_C_CONTIGUOUS
|
#define NPY_CONTIGUOUS NPY_ARRAY_C_CONTIGUOUS
|
||||||
#define NPY_FORTRAN NPY_ARRAY_F_CONTIGUOUS
|
#define NPY_FORTRAN NPY_ARRAY_F_CONTIGUOUS
|
||||||
|
@ -127,4 +125,5 @@
|
||||||
*/
|
*/
|
||||||
#include "old_defines.h"
|
#include "old_defines.h"
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -10,22 +10,10 @@
|
||||||
/* Use endian.h if available */
|
/* Use endian.h if available */
|
||||||
#include <endian.h>
|
#include <endian.h>
|
||||||
|
|
||||||
#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && defined(LITTLE_ENDIAN)
|
|
||||||
#define NPY_BYTE_ORDER BYTE_ORDER
|
|
||||||
#define NPY_LITTLE_ENDIAN LITTLE_ENDIAN
|
|
||||||
#define NPY_BIG_ENDIAN BIG_ENDIAN
|
|
||||||
#elif defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) && defined(_LITTLE_ENDIAN)
|
|
||||||
#define NPY_BYTE_ORDER _BYTE_ORDER
|
|
||||||
#define NPY_LITTLE_ENDIAN _LITTLE_ENDIAN
|
|
||||||
#define NPY_BIG_ENDIAN _BIG_ENDIAN
|
|
||||||
#elif defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN)
|
|
||||||
#define NPY_BYTE_ORDER __BYTE_ORDER
|
#define NPY_BYTE_ORDER __BYTE_ORDER
|
||||||
#define NPY_LITTLE_ENDIAN __LITTLE_ENDIAN
|
#define NPY_LITTLE_ENDIAN __LITTLE_ENDIAN
|
||||||
#define NPY_BIG_ENDIAN __BIG_ENDIAN
|
#define NPY_BIG_ENDIAN __BIG_ENDIAN
|
||||||
#endif
|
#else
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NPY_BYTE_ORDER
|
|
||||||
/* Set endianness info using target CPU */
|
/* Set endianness info using target CPU */
|
||||||
#include "npy_cpu.h"
|
#include "npy_cpu.h"
|
||||||
|
|
||||||
|
@ -39,8 +27,7 @@
|
||||||
|| defined(NPY_CPU_ARMEL) \
|
|| defined(NPY_CPU_ARMEL) \
|
||||||
|| defined(NPY_CPU_AARCH64) \
|
|| defined(NPY_CPU_AARCH64) \
|
||||||
|| defined(NPY_CPU_SH_LE) \
|
|| defined(NPY_CPU_SH_LE) \
|
||||||
|| defined(NPY_CPU_MIPSEL) \
|
|| defined(NPY_CPU_MIPSEL)
|
||||||
|| defined(NPY_CPU_PPC64LE)
|
|
||||||
#define NPY_BYTE_ORDER NPY_LITTLE_ENDIAN
|
#define NPY_BYTE_ORDER NPY_LITTLE_ENDIAN
|
||||||
#elif defined(NPY_CPU_PPC) \
|
#elif defined(NPY_CPU_PPC) \
|
||||||
|| defined(NPY_CPU_SPARC) \
|
|| defined(NPY_CPU_SPARC) \
|
||||||
|
@ -49,9 +36,7 @@
|
||||||
|| defined(NPY_CPU_PPC64) \
|
|| defined(NPY_CPU_PPC64) \
|
||||||
|| defined(NPY_CPU_ARMEB) \
|
|| defined(NPY_CPU_ARMEB) \
|
||||||
|| defined(NPY_CPU_SH_BE) \
|
|| defined(NPY_CPU_SH_BE) \
|
||||||
|| defined(NPY_CPU_MIPSEB) \
|
|| defined(NPY_CPU_MIPSEB)
|
||||||
|| defined(NPY_CPU_OR1K) \
|
|
||||||
|| defined(NPY_CPU_M68K)
|
|
||||||
#define NPY_BYTE_ORDER NPY_BIG_ENDIAN
|
#define NPY_BYTE_ORDER NPY_BIG_ENDIAN
|
||||||
#else
|
#else
|
||||||
#error Unknown CPU: can not set endianness
|
#error Unknown CPU: can not set endianness
|
||||||
|
|
|
@ -1,20 +1,12 @@
|
||||||
#ifndef __NPY_MATH_C99_H_
|
#ifndef __NPY_MATH_C99_H_
|
||||||
#define __NPY_MATH_C99_H_
|
#define __NPY_MATH_C99_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#ifdef __SUNPRO_CC
|
#ifdef __SUNPRO_CC
|
||||||
#include <sunmath.h>
|
#include <sunmath.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_NPY_CONFIG_H
|
|
||||||
#include <npy_config.h>
|
|
||||||
#endif
|
|
||||||
#include <numpy/npy_common.h>
|
#include <numpy/npy_common.h>
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NAN and INFINITY like macros (same behavior as glibc for NAN, same as C99
|
* NAN and INFINITY like macros (same behavior as glibc for NAN, same as C99
|
||||||
* for INFINITY)
|
* for INFINITY)
|
||||||
|
@ -118,12 +110,15 @@ double npy_tanh(double x);
|
||||||
double npy_asin(double x);
|
double npy_asin(double x);
|
||||||
double npy_acos(double x);
|
double npy_acos(double x);
|
||||||
double npy_atan(double x);
|
double npy_atan(double x);
|
||||||
|
double npy_aexp(double x);
|
||||||
|
double npy_alog(double x);
|
||||||
|
double npy_asqrt(double x);
|
||||||
|
double npy_afabs(double x);
|
||||||
|
|
||||||
double npy_log(double x);
|
double npy_log(double x);
|
||||||
double npy_log10(double x);
|
double npy_log10(double x);
|
||||||
double npy_exp(double x);
|
double npy_exp(double x);
|
||||||
double npy_sqrt(double x);
|
double npy_sqrt(double x);
|
||||||
double npy_cbrt(double x);
|
|
||||||
|
|
||||||
double npy_fabs(double x);
|
double npy_fabs(double x);
|
||||||
double npy_ceil(double x);
|
double npy_ceil(double x);
|
||||||
|
@ -144,8 +139,6 @@ double npy_log2(double x);
|
||||||
double npy_atan2(double x, double y);
|
double npy_atan2(double x, double y);
|
||||||
double npy_pow(double x, double y);
|
double npy_pow(double x, double y);
|
||||||
double npy_modf(double x, double* y);
|
double npy_modf(double x, double* y);
|
||||||
double npy_frexp(double x, int* y);
|
|
||||||
double npy_ldexp(double n, int y);
|
|
||||||
|
|
||||||
double npy_copysign(double x, double y);
|
double npy_copysign(double x, double y);
|
||||||
double npy_nextafter(double x, double y);
|
double npy_nextafter(double x, double y);
|
||||||
|
@ -154,52 +147,34 @@ double npy_spacing(double x);
|
||||||
/*
|
/*
|
||||||
* IEEE 754 fpu handling. Those are guaranteed to be macros
|
* IEEE 754 fpu handling. Those are guaranteed to be macros
|
||||||
*/
|
*/
|
||||||
|
#ifndef NPY_HAVE_DECL_ISNAN
|
||||||
/* use builtins to avoid function calls in tight loops
|
|
||||||
* only available if npy_config.h is available (= numpys own build) */
|
|
||||||
#if HAVE___BUILTIN_ISNAN
|
|
||||||
#define npy_isnan(x) __builtin_isnan(x)
|
|
||||||
#else
|
|
||||||
#ifndef NPY_HAVE_DECL_ISNAN
|
|
||||||
#define npy_isnan(x) ((x) != (x))
|
#define npy_isnan(x) ((x) != (x))
|
||||||
#else
|
#else
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1900)
|
#ifdef _MSC_VER
|
||||||
#define npy_isnan(x) _isnan((x))
|
#define npy_isnan(x) _isnan((x))
|
||||||
#else
|
#else
|
||||||
#define npy_isnan(x) isnan(x)
|
#define npy_isnan(x) isnan((x))
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef NPY_HAVE_DECL_ISFINITE
|
||||||
/* only available if npy_config.h is available (= numpys own build) */
|
|
||||||
#if HAVE___BUILTIN_ISFINITE
|
|
||||||
#define npy_isfinite(x) __builtin_isfinite(x)
|
|
||||||
#else
|
|
||||||
#ifndef NPY_HAVE_DECL_ISFINITE
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define npy_isfinite(x) _finite((x))
|
#define npy_isfinite(x) _finite((x))
|
||||||
#else
|
#else
|
||||||
#define npy_isfinite(x) !npy_isnan((x) + (-x))
|
#define npy_isfinite(x) !npy_isnan((x) + (-x))
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define npy_isfinite(x) isfinite((x))
|
#define npy_isfinite(x) isfinite((x))
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* only available if npy_config.h is available (= numpys own build) */
|
#ifndef NPY_HAVE_DECL_ISINF
|
||||||
#if HAVE___BUILTIN_ISINF
|
|
||||||
#define npy_isinf(x) __builtin_isinf(x)
|
|
||||||
#else
|
|
||||||
#ifndef NPY_HAVE_DECL_ISINF
|
|
||||||
#define npy_isinf(x) (!npy_isfinite(x) && !npy_isnan(x))
|
#define npy_isinf(x) (!npy_isfinite(x) && !npy_isnan(x))
|
||||||
#else
|
#else
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1900)
|
#ifdef _MSC_VER
|
||||||
#define npy_isinf(x) (!_finite((x)) && !_isnan((x)))
|
#define npy_isinf(x) (!_finite((x)) && !_isnan((x)))
|
||||||
#else
|
#else
|
||||||
#define npy_isinf(x) isinf((x))
|
#define npy_isinf(x) isinf((x))
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NPY_HAVE_DECL_SIGNBIT
|
#ifndef NPY_HAVE_DECL_SIGNBIT
|
||||||
|
@ -230,7 +205,6 @@ float npy_ceilf(float x);
|
||||||
float npy_rintf(float x);
|
float npy_rintf(float x);
|
||||||
float npy_truncf(float x);
|
float npy_truncf(float x);
|
||||||
float npy_sqrtf(float x);
|
float npy_sqrtf(float x);
|
||||||
float npy_cbrtf(float x);
|
|
||||||
float npy_log10f(float x);
|
float npy_log10f(float x);
|
||||||
float npy_logf(float x);
|
float npy_logf(float x);
|
||||||
float npy_expf(float x);
|
float npy_expf(float x);
|
||||||
|
@ -251,15 +225,13 @@ float npy_powf(float x, float y);
|
||||||
float npy_fmodf(float x, float y);
|
float npy_fmodf(float x, float y);
|
||||||
|
|
||||||
float npy_modff(float x, float* y);
|
float npy_modff(float x, float* y);
|
||||||
float npy_frexpf(float x, int* y);
|
|
||||||
float npy_ldexpf(float x, int y);
|
|
||||||
|
|
||||||
float npy_copysignf(float x, float y);
|
float npy_copysignf(float x, float y);
|
||||||
float npy_nextafterf(float x, float y);
|
float npy_nextafterf(float x, float y);
|
||||||
float npy_spacingf(float x);
|
float npy_spacingf(float x);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* long double C99 math functions
|
* float C99 math functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
npy_longdouble npy_sinl(npy_longdouble x);
|
npy_longdouble npy_sinl(npy_longdouble x);
|
||||||
|
@ -274,7 +246,6 @@ npy_longdouble npy_ceill(npy_longdouble x);
|
||||||
npy_longdouble npy_rintl(npy_longdouble x);
|
npy_longdouble npy_rintl(npy_longdouble x);
|
||||||
npy_longdouble npy_truncl(npy_longdouble x);
|
npy_longdouble npy_truncl(npy_longdouble x);
|
||||||
npy_longdouble npy_sqrtl(npy_longdouble x);
|
npy_longdouble npy_sqrtl(npy_longdouble x);
|
||||||
npy_longdouble npy_cbrtl(npy_longdouble x);
|
|
||||||
npy_longdouble npy_log10l(npy_longdouble x);
|
npy_longdouble npy_log10l(npy_longdouble x);
|
||||||
npy_longdouble npy_logl(npy_longdouble x);
|
npy_longdouble npy_logl(npy_longdouble x);
|
||||||
npy_longdouble npy_expl(npy_longdouble x);
|
npy_longdouble npy_expl(npy_longdouble x);
|
||||||
|
@ -295,8 +266,6 @@ npy_longdouble npy_powl(npy_longdouble x, npy_longdouble y);
|
||||||
npy_longdouble npy_fmodl(npy_longdouble x, npy_longdouble y);
|
npy_longdouble npy_fmodl(npy_longdouble x, npy_longdouble y);
|
||||||
|
|
||||||
npy_longdouble npy_modfl(npy_longdouble x, npy_longdouble* y);
|
npy_longdouble npy_modfl(npy_longdouble x, npy_longdouble* y);
|
||||||
npy_longdouble npy_frexpl(npy_longdouble x, int* y);
|
|
||||||
npy_longdouble npy_ldexpl(npy_longdouble x, int y);
|
|
||||||
|
|
||||||
npy_longdouble npy_copysignl(npy_longdouble x, npy_longdouble y);
|
npy_longdouble npy_copysignl(npy_longdouble x, npy_longdouble y);
|
||||||
npy_longdouble npy_nextafterl(npy_longdouble x, npy_longdouble y);
|
npy_longdouble npy_nextafterl(npy_longdouble x, npy_longdouble y);
|
||||||
|
@ -425,19 +394,6 @@ npy_cdouble npy_csqrt(npy_cdouble z);
|
||||||
|
|
||||||
npy_cdouble npy_ccos(npy_cdouble z);
|
npy_cdouble npy_ccos(npy_cdouble z);
|
||||||
npy_cdouble npy_csin(npy_cdouble z);
|
npy_cdouble npy_csin(npy_cdouble z);
|
||||||
npy_cdouble npy_ctan(npy_cdouble z);
|
|
||||||
|
|
||||||
npy_cdouble npy_ccosh(npy_cdouble z);
|
|
||||||
npy_cdouble npy_csinh(npy_cdouble z);
|
|
||||||
npy_cdouble npy_ctanh(npy_cdouble z);
|
|
||||||
|
|
||||||
npy_cdouble npy_cacos(npy_cdouble z);
|
|
||||||
npy_cdouble npy_casin(npy_cdouble z);
|
|
||||||
npy_cdouble npy_catan(npy_cdouble z);
|
|
||||||
|
|
||||||
npy_cdouble npy_cacosh(npy_cdouble z);
|
|
||||||
npy_cdouble npy_casinh(npy_cdouble z);
|
|
||||||
npy_cdouble npy_catanh(npy_cdouble z);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Single precision complex functions
|
* Single precision complex functions
|
||||||
|
@ -453,20 +409,6 @@ npy_cfloat npy_csqrtf(npy_cfloat z);
|
||||||
|
|
||||||
npy_cfloat npy_ccosf(npy_cfloat z);
|
npy_cfloat npy_ccosf(npy_cfloat z);
|
||||||
npy_cfloat npy_csinf(npy_cfloat z);
|
npy_cfloat npy_csinf(npy_cfloat z);
|
||||||
npy_cfloat npy_ctanf(npy_cfloat z);
|
|
||||||
|
|
||||||
npy_cfloat npy_ccoshf(npy_cfloat z);
|
|
||||||
npy_cfloat npy_csinhf(npy_cfloat z);
|
|
||||||
npy_cfloat npy_ctanhf(npy_cfloat z);
|
|
||||||
|
|
||||||
npy_cfloat npy_cacosf(npy_cfloat z);
|
|
||||||
npy_cfloat npy_casinf(npy_cfloat z);
|
|
||||||
npy_cfloat npy_catanf(npy_cfloat z);
|
|
||||||
|
|
||||||
npy_cfloat npy_cacoshf(npy_cfloat z);
|
|
||||||
npy_cfloat npy_casinhf(npy_cfloat z);
|
|
||||||
npy_cfloat npy_catanhf(npy_cfloat z);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Extended precision complex functions
|
* Extended precision complex functions
|
||||||
|
@ -482,44 +424,15 @@ npy_clongdouble npy_csqrtl(npy_clongdouble z);
|
||||||
|
|
||||||
npy_clongdouble npy_ccosl(npy_clongdouble z);
|
npy_clongdouble npy_ccosl(npy_clongdouble z);
|
||||||
npy_clongdouble npy_csinl(npy_clongdouble z);
|
npy_clongdouble npy_csinl(npy_clongdouble z);
|
||||||
npy_clongdouble npy_ctanl(npy_clongdouble z);
|
|
||||||
|
|
||||||
npy_clongdouble npy_ccoshl(npy_clongdouble z);
|
|
||||||
npy_clongdouble npy_csinhl(npy_clongdouble z);
|
|
||||||
npy_clongdouble npy_ctanhl(npy_clongdouble z);
|
|
||||||
|
|
||||||
npy_clongdouble npy_cacosl(npy_clongdouble z);
|
|
||||||
npy_clongdouble npy_casinl(npy_clongdouble z);
|
|
||||||
npy_clongdouble npy_catanl(npy_clongdouble z);
|
|
||||||
|
|
||||||
npy_clongdouble npy_cacoshl(npy_clongdouble z);
|
|
||||||
npy_clongdouble npy_casinhl(npy_clongdouble z);
|
|
||||||
npy_clongdouble npy_catanhl(npy_clongdouble z);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Functions that set the floating point error
|
* Functions that set the floating point error
|
||||||
* status word.
|
* status word.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* platform-dependent code translates floating point
|
|
||||||
* status to an integer sum of these values
|
|
||||||
*/
|
|
||||||
#define NPY_FPE_DIVIDEBYZERO 1
|
|
||||||
#define NPY_FPE_OVERFLOW 2
|
|
||||||
#define NPY_FPE_UNDERFLOW 4
|
|
||||||
#define NPY_FPE_INVALID 8
|
|
||||||
|
|
||||||
int npy_get_floatstatus(void);
|
|
||||||
int npy_clear_floatstatus(void);
|
|
||||||
void npy_set_floatstatus_divbyzero(void);
|
void npy_set_floatstatus_divbyzero(void);
|
||||||
void npy_set_floatstatus_overflow(void);
|
void npy_set_floatstatus_overflow(void);
|
||||||
void npy_set_floatstatus_underflow(void);
|
void npy_set_floatstatus_underflow(void);
|
||||||
void npy_set_floatstatus_invalid(void);
|
void npy_set_floatstatus_invalid(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -29,8 +29,5 @@
|
||||||
* #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
|
* #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
|
||||||
*/
|
*/
|
||||||
#define NPY_1_7_API_VERSION 0x00000007
|
#define NPY_1_7_API_VERSION 0x00000007
|
||||||
#define NPY_1_8_API_VERSION 0x00000008
|
|
||||||
#define NPY_1_9_API_VERSION 0x00000008
|
|
||||||
#define NPY_1_10_API_VERSION 0x00000008
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -7,8 +7,8 @@ Numpy Ufunc C-API
|
||||||
PyObject *
|
PyObject *
|
||||||
PyUFunc_FromFuncAndData(PyUFuncGenericFunction *func, void
|
PyUFunc_FromFuncAndData(PyUFuncGenericFunction *func, void
|
||||||
**data, char *types, int ntypes, int nin, int
|
**data, char *types, int ntypes, int nin, int
|
||||||
nout, int identity, const char *name, const
|
nout, int identity, char *name, char *doc, int
|
||||||
char *doc, int check_return)
|
check_return)
|
||||||
|
|
||||||
|
|
||||||
::
|
::
|
||||||
|
@ -229,9 +229,9 @@ owns a new reference to errobj.
|
||||||
PyUFunc_FromFuncAndDataAndSignature(PyUFuncGenericFunction *func, void
|
PyUFunc_FromFuncAndDataAndSignature(PyUFuncGenericFunction *func, void
|
||||||
**data, char *types, int
|
**data, char *types, int
|
||||||
ntypes, int nin, int nout, int
|
ntypes, int nin, int nout, int
|
||||||
identity, const char *name, const
|
identity, char *name, char
|
||||||
char *doc, int check_return, const
|
*doc, int check_return, const char
|
||||||
char *signature)
|
*signature)
|
||||||
|
|
||||||
|
|
||||||
::
|
::
|
||||||
|
@ -310,12 +310,3 @@ the output operands where provided.
|
||||||
|
|
||||||
Returns 0 on success, -1 (with exception raised) on validation failure.
|
Returns 0 on success, -1 (with exception raised) on validation failure.
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
int
|
|
||||||
PyUFunc_RegisterLoopForDescr(PyUFuncObject *ufunc, PyArray_Descr
|
|
||||||
*user_dtype, PyUFuncGenericFunction
|
|
||||||
function, PyArray_Descr
|
|
||||||
**arg_dtypes, void *data)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#define Py_UFUNCOBJECT_H
|
#define Py_UFUNCOBJECT_H
|
||||||
|
|
||||||
#include <numpy/npy_math.h>
|
#include <numpy/npy_math.h>
|
||||||
#include <numpy/npy_common.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -152,13 +151,13 @@ typedef struct _tagPyUFuncObject {
|
||||||
int check_return;
|
int check_return;
|
||||||
|
|
||||||
/* The name of the ufunc */
|
/* The name of the ufunc */
|
||||||
const char *name;
|
char *name;
|
||||||
|
|
||||||
/* Array of type numbers, of size ('nargs' * 'ntypes') */
|
/* Array of type numbers, of size ('nargs' * 'ntypes') */
|
||||||
char *types;
|
char *types;
|
||||||
|
|
||||||
/* Documentation string */
|
/* Documentation string */
|
||||||
const char *doc;
|
char *doc;
|
||||||
|
|
||||||
void *ptr;
|
void *ptr;
|
||||||
PyObject *obj;
|
PyObject *obj;
|
||||||
|
@ -213,20 +212,6 @@ typedef struct _tagPyUFuncObject {
|
||||||
* A function which returns a masked inner loop for the ufunc.
|
* A function which returns a masked inner loop for the ufunc.
|
||||||
*/
|
*/
|
||||||
PyUFunc_MaskedInnerLoopSelectionFunc *masked_inner_loop_selector;
|
PyUFunc_MaskedInnerLoopSelectionFunc *masked_inner_loop_selector;
|
||||||
|
|
||||||
/*
|
|
||||||
* List of flags for each operand when ufunc is called by nditer object.
|
|
||||||
* These flags will be used in addition to the default flags for each
|
|
||||||
* operand set by nditer object.
|
|
||||||
*/
|
|
||||||
npy_uint32 *op_flags;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* List of global flags used when ufunc is called by nditer object.
|
|
||||||
* These flags will be used in addition to the default global flags
|
|
||||||
* set by nditer object.
|
|
||||||
*/
|
|
||||||
npy_uint32 iter_flags;
|
|
||||||
} PyUFuncObject;
|
} PyUFuncObject;
|
||||||
|
|
||||||
#include "arrayobject.h"
|
#include "arrayobject.h"
|
||||||
|
@ -251,11 +236,22 @@ typedef struct _tagPyUFuncObject {
|
||||||
#define UFUNC_SHIFT_INVALID 9
|
#define UFUNC_SHIFT_INVALID 9
|
||||||
|
|
||||||
|
|
||||||
|
/* platform-dependent code translates floating point
|
||||||
|
status to an integer sum of these values
|
||||||
|
*/
|
||||||
|
#define UFUNC_FPE_DIVIDEBYZERO 1
|
||||||
|
#define UFUNC_FPE_OVERFLOW 2
|
||||||
|
#define UFUNC_FPE_UNDERFLOW 4
|
||||||
|
#define UFUNC_FPE_INVALID 8
|
||||||
|
|
||||||
|
/* Error mode that avoids look-up (no checking) */
|
||||||
|
#define UFUNC_ERR_DEFAULT 0
|
||||||
|
|
||||||
#define UFUNC_OBJ_ISOBJECT 1
|
#define UFUNC_OBJ_ISOBJECT 1
|
||||||
#define UFUNC_OBJ_NEEDS_API 2
|
#define UFUNC_OBJ_NEEDS_API 2
|
||||||
|
|
||||||
/* Default user error mode */
|
/* Default user error mode */
|
||||||
#define UFUNC_ERR_DEFAULT \
|
#define UFUNC_ERR_DEFAULT2 \
|
||||||
(UFUNC_ERR_WARN << UFUNC_SHIFT_DIVIDEBYZERO) + \
|
(UFUNC_ERR_WARN << UFUNC_SHIFT_DIVIDEBYZERO) + \
|
||||||
(UFUNC_ERR_WARN << UFUNC_SHIFT_OVERFLOW) + \
|
(UFUNC_ERR_WARN << UFUNC_SHIFT_OVERFLOW) + \
|
||||||
(UFUNC_ERR_WARN << UFUNC_SHIFT_INVALID)
|
(UFUNC_ERR_WARN << UFUNC_SHIFT_INVALID)
|
||||||
|
@ -309,8 +305,6 @@ typedef struct _loop1d_info {
|
||||||
void *data;
|
void *data;
|
||||||
int *arg_types;
|
int *arg_types;
|
||||||
struct _loop1d_info *next;
|
struct _loop1d_info *next;
|
||||||
int nargs;
|
|
||||||
PyArray_Descr **arg_dtypes;
|
|
||||||
} PyUFunc_Loop1d;
|
} PyUFunc_Loop1d;
|
||||||
|
|
||||||
|
|
||||||
|
@ -326,47 +320,126 @@ typedef struct _loop1d_info {
|
||||||
&(arg)->first))) \
|
&(arg)->first))) \
|
||||||
goto fail;} while (0)
|
goto fail;} while (0)
|
||||||
|
|
||||||
|
/* This code checks the IEEE status flags in a platform-dependent way */
|
||||||
|
/* Adapted from Numarray */
|
||||||
|
|
||||||
/* keep in sync with ieee754.c.src */
|
#if (defined(__unix__) || defined(unix)) && !defined(USG)
|
||||||
#if defined(sun) || defined(__BSD__) || defined(__OpenBSD__) || \
|
#include <sys/param.h>
|
||||||
(defined(__FreeBSD__) && (__FreeBSD_version < 502114)) || \
|
|
||||||
defined(__NetBSD__) || \
|
|
||||||
defined(__GLIBC__) || defined(__APPLE__) || \
|
|
||||||
defined(__CYGWIN__) || defined(__MINGW32__) || \
|
|
||||||
(defined(__FreeBSD__) && (__FreeBSD_version >= 502114)) || \
|
|
||||||
defined(_AIX) || \
|
|
||||||
defined(_MSC_VER) || \
|
|
||||||
defined(__osf__) && defined(__alpha)
|
|
||||||
#else
|
|
||||||
#define NO_FLOATING_POINT_SUPPORT
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* OSF/Alpha (Tru64) ---------------------------------------------*/
|
||||||
|
#if defined(__osf__) && defined(__alpha)
|
||||||
|
|
||||||
|
#include <machine/fpu.h>
|
||||||
|
|
||||||
|
#define UFUNC_CHECK_STATUS(ret) { \
|
||||||
|
unsigned long fpstatus; \
|
||||||
|
\
|
||||||
|
fpstatus = ieee_get_fp_control(); \
|
||||||
|
/* clear status bits as well as disable exception mode if on */ \
|
||||||
|
ieee_set_fp_control( 0 ); \
|
||||||
|
ret = ((IEEE_STATUS_DZE & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
|
||||||
|
| ((IEEE_STATUS_OVF & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \
|
||||||
|
| ((IEEE_STATUS_UNF & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
|
||||||
|
| ((IEEE_STATUS_INV & fpstatus) ? UFUNC_FPE_INVALID : 0); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/* MS Windows -----------------------------------------------------*/
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
|
/* Clear the floating point exception default of Borland C++ */
|
||||||
|
#if defined(__BORLANDC__)
|
||||||
|
#define UFUNC_NOFPE _control87(MCW_EM, MCW_EM);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define UFUNC_CHECK_STATUS(ret) { \
|
||||||
|
int fpstatus = (int) _clearfp(); \
|
||||||
|
\
|
||||||
|
ret = ((SW_ZERODIVIDE & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
|
||||||
|
| ((SW_OVERFLOW & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \
|
||||||
|
| ((SW_UNDERFLOW & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
|
||||||
|
| ((SW_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Solaris --------------------------------------------------------*/
|
||||||
|
/* --------ignoring SunOS ieee_flags approach, someone else can
|
||||||
|
** deal with that! */
|
||||||
|
#elif defined(sun) || defined(__BSD__) || defined(__OpenBSD__) || \
|
||||||
|
(defined(__FreeBSD__) && (__FreeBSD_version < 502114)) || \
|
||||||
|
defined(__NetBSD__)
|
||||||
|
#include <ieeefp.h>
|
||||||
|
|
||||||
|
#define UFUNC_CHECK_STATUS(ret) { \
|
||||||
|
int fpstatus; \
|
||||||
|
\
|
||||||
|
fpstatus = (int) fpgetsticky(); \
|
||||||
|
ret = ((FP_X_DZ & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
|
||||||
|
| ((FP_X_OFL & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \
|
||||||
|
| ((FP_X_UFL & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
|
||||||
|
| ((FP_X_INV & fpstatus) ? UFUNC_FPE_INVALID : 0); \
|
||||||
|
(void) fpsetsticky(0); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(__GLIBC__) || defined(__APPLE__) || \
|
||||||
|
defined(__CYGWIN__) || defined(__MINGW32__) || \
|
||||||
|
(defined(__FreeBSD__) && (__FreeBSD_version >= 502114))
|
||||||
|
|
||||||
|
#if defined(__GLIBC__) || defined(__APPLE__) || \
|
||||||
|
defined(__MINGW32__) || defined(__FreeBSD__)
|
||||||
|
#include <fenv.h>
|
||||||
|
#elif defined(__CYGWIN__)
|
||||||
|
#include "fenv/fenv.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define UFUNC_CHECK_STATUS(ret) { \
|
||||||
|
int fpstatus = (int) fetestexcept(FE_DIVBYZERO | FE_OVERFLOW | \
|
||||||
|
FE_UNDERFLOW | FE_INVALID); \
|
||||||
|
ret = ((FE_DIVBYZERO & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
|
||||||
|
| ((FE_OVERFLOW & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \
|
||||||
|
| ((FE_UNDERFLOW & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
|
||||||
|
| ((FE_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0); \
|
||||||
|
(void) feclearexcept(FE_DIVBYZERO | FE_OVERFLOW | \
|
||||||
|
FE_UNDERFLOW | FE_INVALID); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(_AIX)
|
||||||
|
|
||||||
|
#include <float.h>
|
||||||
|
#include <fpxcp.h>
|
||||||
|
|
||||||
|
#define UFUNC_CHECK_STATUS(ret) { \
|
||||||
|
fpflag_t fpstatus; \
|
||||||
|
\
|
||||||
|
fpstatus = fp_read_flag(); \
|
||||||
|
ret = ((FP_DIV_BY_ZERO & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
|
||||||
|
| ((FP_OVERFLOW & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \
|
||||||
|
| ((FP_UNDERFLOW & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
|
||||||
|
| ((FP_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0); \
|
||||||
|
fp_swap_flag(0); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define NO_FLOATING_POINT_SUPPORT
|
||||||
|
#define UFUNC_CHECK_STATUS(ret) { \
|
||||||
|
ret = 0; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* THESE MACROS ARE DEPRECATED.
|
* THESE MACROS ARE DEPRECATED.
|
||||||
* Use npy_set_floatstatus_* in the npymath library.
|
* Use npy_set_floatstatus_* in the npymath library.
|
||||||
*/
|
*/
|
||||||
#define UFUNC_FPE_DIVIDEBYZERO NPY_FPE_DIVIDEBYZERO
|
|
||||||
#define UFUNC_FPE_OVERFLOW NPY_FPE_OVERFLOW
|
|
||||||
#define UFUNC_FPE_UNDERFLOW NPY_FPE_UNDERFLOW
|
|
||||||
#define UFUNC_FPE_INVALID NPY_FPE_INVALID
|
|
||||||
|
|
||||||
#define UFUNC_CHECK_STATUS(ret) \
|
|
||||||
{ \
|
|
||||||
ret = npy_clear_floatstatus(); \
|
|
||||||
}
|
|
||||||
#define generate_divbyzero_error() npy_set_floatstatus_divbyzero()
|
#define generate_divbyzero_error() npy_set_floatstatus_divbyzero()
|
||||||
#define generate_overflow_error() npy_set_floatstatus_overflow()
|
#define generate_overflow_error() npy_set_floatstatus_overflow()
|
||||||
|
|
||||||
/* Make sure it gets defined if it isn't already */
|
/* Make sure it gets defined if it isn't already */
|
||||||
#ifndef UFUNC_NOFPE
|
#ifndef UFUNC_NOFPE
|
||||||
/* Clear the floating point exception default of Borland C++ */
|
|
||||||
#if defined(__BORLANDC__)
|
|
||||||
#define UFUNC_NOFPE _control87(MCW_EM, MCW_EM);
|
|
||||||
#else
|
|
||||||
#define UFUNC_NOFPE
|
#define UFUNC_NOFPE
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
cython < 0.24
|
cython<0.24
|
||||||
pathlib
|
pathlib
|
||||||
numpy
|
numpy>=1.7
|
||||||
cymem>=1.30,<1.32
|
cymem>=1.30,<1.32
|
||||||
preshed>=0.46.1,<0.47.0
|
preshed>=0.46.1,<0.47.0
|
||||||
thinc>=5.0.0,<5.1.0
|
thinc>=5.0.0,<5.1.0
|
||||||
|
|
9
setup.py
9
setup.py
|
@ -68,9 +68,6 @@ MOD_NAMES = [
|
||||||
'spacy.syntax.iterators']
|
'spacy.syntax.iterators']
|
||||||
|
|
||||||
|
|
||||||
# By subclassing build_extensions we have the actual compiler that will be used
|
|
||||||
# which is really known only after finalize_options
|
|
||||||
# http://stackoverflow.com/questions/724664/python-distutils-how-to-get-a-compiler-that-is-going-to-be-used
|
|
||||||
compile_options = {
|
compile_options = {
|
||||||
'msvc': ['/Ox', '/EHsc'],
|
'msvc': ['/Ox', '/EHsc'],
|
||||||
'mingw32' : ['-O3', '-Wno-strict-prototypes', '-Wno-unused-function'],
|
'mingw32' : ['-O3', '-Wno-strict-prototypes', '-Wno-unused-function'],
|
||||||
|
@ -94,6 +91,8 @@ if not sys.platform.startswith('darwin'):
|
||||||
link_options['other'].append('-fopenmp')
|
link_options['other'].append('-fopenmp')
|
||||||
|
|
||||||
|
|
||||||
|
# By subclassing build_extensions we have the actual compiler that will be used which is really known only after finalize_options
|
||||||
|
# http://stackoverflow.com/questions/724664/python-distutils-how-to-get-a-compiler-that-is-going-to-be-used
|
||||||
class build_ext_options:
|
class build_ext_options:
|
||||||
def build_options(self):
|
def build_options(self):
|
||||||
for e in self.extensions:
|
for e in self.extensions:
|
||||||
|
@ -186,9 +185,9 @@ def setup_package():
|
||||||
license=about['__license__'],
|
license=about['__license__'],
|
||||||
ext_modules=ext_modules,
|
ext_modules=ext_modules,
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'numpy',
|
'numpy>=1.7',
|
||||||
'murmurhash>=0.26,<0.27',
|
'murmurhash>=0.26,<0.27',
|
||||||
'cymem>=1.30,<1.32.0',
|
'cymem>=1.30,<1.32',
|
||||||
'preshed>=0.46.1,<0.47',
|
'preshed>=0.46.1,<0.47',
|
||||||
'thinc>=5.0.0,<5.1.0',
|
'thinc>=5.0.0,<5.1.0',
|
||||||
'plac',
|
'plac',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user