13
13
/* ... otherwise a semi-smart identer (like emacs) tries to indent
14
14
everything when you're typing */
16
17
/* This is auto-generated by the installer */
17
18
#include "numpyconfig.h"
20
#ifdef NPY_ENABLE_SEPARATE_COMPILATION
21
#define NPY_NO_EXPORT NPY_VISIBILITY_HIDDEN
23
#define NPY_NO_EXPORT static
19
26
/* Only use thread if configured in config and python supports it */
20
27
#if defined WITH_THREAD && !NPY_NO_SMP
21
28
#define NPY_ALLOW_THREADS 1
46
53
whenever the C-API is changed such that binary compatibility is
47
54
broken, i.e. whenever a recompile of extension modules is
49
#define NPY_VERSION 0x01000009
56
#define NPY_VERSION NPY_ABI_VERSION
51
58
/* Minor API version. This number is increased whenever a change is
52
59
made to the C-API -- whether it breaks binary compatibility or not.
56
63
would be increased. Whenever binary compatibility is broken, both
57
64
NPY_VERSION and NPY_FEATURE_VERSION should be increased.
59
#define NPY_FEATURE_VERSION 0x00000001
66
#define NPY_FEATURE_VERSION NPY_API_VERSION
61
68
#include "npy_common.h"
206
#define NPY_DATETIME_NUMUNITS (NPY_FR_as + 1)
207
#define NPY_DATETIME_DEFAULTUNIT NPY_FR_us
209
#define NPY_STR_Y "Y"
210
#define NPY_STR_M "M"
211
#define NPY_STR_W "W"
212
#define NPY_STR_B "B"
213
#define NPY_STR_D "D"
214
#define NPY_STR_h "h"
215
#define NPY_STR_m "m"
216
#define NPY_STR_s "s"
217
#define NPY_STR_ms "ms"
218
#define NPY_STR_us "us"
219
#define NPY_STR_ns "ns"
220
#define NPY_STR_ps "ps"
221
#define NPY_STR_fs "fs"
222
#define NPY_STR_as "as"
179
225
/* This is to typedef npy_intp to the appropriate pointer size for this
180
226
* platform. Py_intptr_t, Py_uintptr_t are defined in pyport.h. */
234
280
/* We can only use C99 formats for npy_int_p if it is the same as intp_t, hence
235
281
* the condition on HAVE_UNITPTR_T */
236
282
#if (NPY_USE_C99_FORMATS) == 1 \
237
&& (defined HAVE_UINTPTR_T) \
238
&& (defined HAVE_INTTYPES_H)
239
#include <inttypes.h>
283
&& (defined HAVE_UINTPTR_T) \
284
&& (defined HAVE_INTTYPES_H)
285
#include <inttypes.h>
240
286
#undef NPY_INTP_FMT
241
287
#define NPY_INTP_FMT PRIdPTR
576
#define PyDataType_GetDatetimeMetaData(descr) ((descr->metadata == NULL) ? NULL : ((PyArray_DatetimeMetaData *)(PyCObject_AsVoidPtr(PyDict_GetItemString(descr->metadata, NPY_METADATA_DTSTR)))))
528
578
typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *);
530
580
/* Means c-style contiguous (last index varies the fastest). The
666
716
#define NPY_DISABLE_C_API
719
/*****************************
720
* Basic iterator object
721
*****************************/
723
/* FWD declaration */
724
typedef struct PyArrayIterObject_tag PyArrayIterObject;
726
/* type of the function which translates a set of coordinates to a pointer to
728
typedef char* (*npy_iter_get_dataptr_t)(PyArrayIterObject* iter, npy_intp*);
730
struct PyArrayIterObject_tag {
671
732
int nd_m1; /* number of dimensions - 1 */
672
733
npy_intp index, size;
678
739
PyArrayObject *ao;
679
740
char *dataptr; /* pointer to current item*/
680
741
npy_bool contiguous;
743
npy_intp bounds[NPY_MAXDIMS][2];
744
npy_intp limits[NPY_MAXDIMS][2];
745
npy_intp limits_sizes[NPY_MAXDIMS];
746
npy_iter_get_dataptr_t translate;
684
750
/* Iterator API */
689
755
_PyAIT(it)->index = 0; \
690
756
_PyAIT(it)->dataptr = _PyAIT(it)->ao->data; \
691
757
memset(_PyAIT(it)->coordinates, 0, \
692
(_PyAIT(it)->nd_m1+1)*sizeof(npy_intp)); \
758
(_PyAIT(it)->nd_m1+1)*sizeof(npy_intp)); \
695
761
#define _PyArray_ITER_NEXT1(it) { \
737
803
_PyArray_ITER_NEXT1(_PyAIT(it)); \
739
805
else if (_PyAIT(it)->contiguous) \
740
_PyAIT(it)->dataptr += _PyAIT(it)->ao->descr->elsize; \
806
_PyAIT(it)->dataptr += _PyAIT(it)->ao->descr->elsize; \
741
807
else if (_PyAIT(it)->nd_m1 == 1) { \
742
808
_PyArray_ITER_NEXT2(_PyAIT(it)); \
903
969
} PyArrayMapIterObject;
972
NPY_NEIGHBORHOOD_ITER_ZERO_PADDING,
973
NPY_NEIGHBORHOOD_ITER_ONE_PADDING,
974
NPY_NEIGHBORHOOD_ITER_CONSTANT_PADDING,
975
NPY_NEIGHBORHOOD_ITER_CIRCULAR_PADDING,
976
NPY_NEIGHBORHOOD_ITER_MIRROR_PADDING
983
* PyArrayIterObject part: keep this in this exact order
985
int nd_m1; /* number of dimensions - 1 */
986
npy_intp index, size;
987
npy_intp coordinates[NPY_MAXDIMS];/* N-dimensional loop */
988
npy_intp dims_m1[NPY_MAXDIMS]; /* ao->dimensions - 1 */
989
npy_intp strides[NPY_MAXDIMS]; /* ao->strides or fake */
990
npy_intp backstrides[NPY_MAXDIMS];/* how far to jump back */
991
npy_intp factors[NPY_MAXDIMS]; /* shape factors */
993
char *dataptr; /* pointer to current item*/
996
npy_intp bounds[NPY_MAXDIMS][2];
997
npy_intp limits[NPY_MAXDIMS][2];
998
npy_intp limits_sizes[NPY_MAXDIMS];
999
npy_iter_get_dataptr_t translate;
1006
/* Dimensions is the dimension of the array */
1007
npy_intp dimensions[NPY_MAXDIMS];
1009
/* Neighborhood points coordinates are computed relatively to the point pointed
1010
* by _internal_iter */
1011
PyArrayIterObject* _internal_iter;
1012
/* To keep a reference to the representation of the constant value for
1013
* constant padding */
1017
} PyArrayNeighborhoodIterObject;
1020
* Neighborhood iterator API
1023
/* General: those work for any mode */
1024
static NPY_INLINE int
1025
PyArrayNeighborhoodIter_Reset(PyArrayNeighborhoodIterObject* iter);
1026
static NPY_INLINE int
1027
PyArrayNeighborhoodIter_Next(PyArrayNeighborhoodIterObject* iter);
1029
static NPY_INLINE int
1030
PyArrayNeighborhoodIter_Next2D(PyArrayNeighborhoodIterObject* iter);
1033
/* Include inline implementations - functions defined there are not considered
1035
#define _NPY_INCLUDE_NEIGHBORHOOD_IMP
1036
#include "_neighborhood_iterator_imp.h"
1037
#undef _NPY_INCLUDE_NEIGHBORHOOD_IMP
905
1039
/* The default array type
907
1041
#define NPY_DEFAULT_TYPE NPY_DOUBLE
982
1116
#define PyTypeNum_ISFLEXIBLE(type) (((type) >=NPY_STRING) && \
983
1117
((type) <=NPY_VOID))
1119
#define PyTypeNum_ISDATETIME(type) (((type) >=NPY_DATETIME) && \
1120
((type) <=NPY_TIMEDELTA))
985
1122
#define PyTypeNum_ISUSERDEF(type) (((type) >= NPY_USERDEF) && \
986
1123
((type) < NPY_USERDEF+ \
987
1124
NPY_NUMUSERTYPES))
1002
1139
#define PyDataType_ISCOMPLEX(obj) PyTypeNum_ISCOMPLEX(((PyArray_Descr*)(obj))->type_num)
1003
1140
#define PyDataType_ISPYTHON(obj) PyTypeNum_ISPYTHON(((PyArray_Descr*)(obj))->type_num)
1004
1141
#define PyDataType_ISFLEXIBLE(obj) PyTypeNum_ISFLEXIBLE(((PyArray_Descr*)(obj))->type_num)
1142
#define PyDataType_ISDATETIME(obj) PyTypeNum_ISDATETIME(((PyArray_Descr*)(obj))->type_num)
1005
1143
#define PyDataType_ISUSERDEF(obj) PyTypeNum_ISUSERDEF(((PyArray_Descr*)(obj))->type_num)
1006
1144
#define PyDataType_ISEXTENDED(obj) PyTypeNum_ISEXTENDED(((PyArray_Descr*)(obj))->type_num)
1007
1145
#define PyDataType_ISOBJECT(obj) PyTypeNum_ISOBJECT(((PyArray_Descr*)(obj))->type_num)
1017
1155
#define PyArray_ISCOMPLEX(obj) PyTypeNum_ISCOMPLEX(PyArray_TYPE(obj))
1018
1156
#define PyArray_ISPYTHON(obj) PyTypeNum_ISPYTHON(PyArray_TYPE(obj))
1019
1157
#define PyArray_ISFLEXIBLE(obj) PyTypeNum_ISFLEXIBLE(PyArray_TYPE(obj))
1158
#define PyArray_ISDATETIME(obj) PyTypeNum_ISDATETIME(PyArray_TYPE(obj))
1020
1159
#define PyArray_ISUSERDEF(obj) PyTypeNum_ISUSERDEF(PyArray_TYPE(obj))
1021
1160
#define PyArray_ISEXTENDED(obj) PyTypeNum_ISEXTENDED(PyArray_TYPE(obj))
1022
1161
#define PyArray_ISOBJECT(obj) PyTypeNum_ISOBJECT(PyArray_TYPE(obj))
1137
1276
#define PyArray_CheckAnyScalar(obj) (PyArray_IsPythonScalar(obj) || \
1138
1277
PyArray_CheckScalar(obj))
1279
#define PyArray_IsIntegerScalar(obj) (PyInt_Check(obj) \
1280
|| PyLong_Check(obj) \
1281
|| PyArray_IsScalar((obj), Integer))
1140
1284
#define PyArray_GETCONTIGUOUS(m) (PyArray_ISCONTIGUOUS(m) ? \
1141
1285
Py_INCREF(m), (m) : \
1142
1286
(PyArrayObject *)(PyArray_Copy(m)))
1275
1419
#include "old_defines.h"
1278
Check to see if this key in the dictionary is the "title"
1422
Check to see if this key in the dictionary is the "title"
1279
1423
entry of the tuple (i.e. a duplicate dictionary entry in the fields
1283
1427
#define NPY_TITLE_KEY(key, value) ((PyTuple_GET_SIZE((value))==3) && \
1284
(PyTuple_GET_ITEM((value), 2) == (key)))
1428
(PyTuple_GET_ITEM((value), 2) == (key)))
1287
1431
/* Define python version independent deprecation macro */