Skip to content
Browse files

Merge branch 'replace-noprefix'

* replace-noprefix: (30 commits)
  BUG: Fix typo npydouble.
  UPD: Remove now redundant typedef.
  UPD: Fix a few more spots missing prefixes.
  BUG: Fix scons build script so it works with umathmodule.c.
  STY: Cleanup some prefixing that crept into comments.
  UPD: Various fixes, Remove #define NPY_NO_PREFIX from files in core.
  ENH: Add some needed macros to include files.
  UPD: Use prefixed types in scalartypes.c.src.
  UPD: Make multiarray *.c files use prefixed macros.
  UPD: Use prefixed types in arraytypes.c.src.
  ENH: Add a few needed macros to npy_common.h.
  UPD: Include ndarrayobject.h instead of arrayobject.h in boolean_ops.c.src.
  UPD: Use prefixed types in lowlevel_strided_loops.c.src template headers.
  UPD: Use explicit prefixed types in einsum.c.src template headers.
  UPD: Use prefixed versions of double and int in multiarray_tests.c.src.
  UPD: Remove includes of noprefix.h in ufunc_object.c and _compiled_base.c.
  BUG: Fix unprefixed reference to cdouble in ndarrayobject.h.
  UPD: Use prefixed macros in numpy/core/src/scalarmathmodule.c.src.
  UPD: Use prefixed macros in numpy/core/src/umath/funcs.inc.src.
  MOV: Rename umathmodule.c.src umathmodule.c since it has no templates.
  ...
  • Loading branch information...
2 parents 096b436 + 87214fb commit ca258fc430fbcba6a3824dd3834f8e14259a62c8 @charris charris committed
Showing with 3,585 additions and 3,041 deletions.
  1. +0 −2 numpy/core/SConscript
  2. +1 −1 numpy/core/blasdot/_dotblas.c
  3. +1 −2 numpy/core/bscript
  4. +3 −2 numpy/core/include/numpy/arrayobject.h
  5. +3 −3 numpy/core/include/numpy/ndarraytypes.h
  6. +9 −2 numpy/core/include/numpy/noprefix.h
  7. +12 −2 numpy/core/include/numpy/npy_common.h
  8. +9 −9 numpy/core/include/numpy/npy_interrupt.h
  9. +2 −3 numpy/core/setup.py
  10. +20 −21 numpy/core/src/multiarray/arrayobject.c
  11. +654 −449 numpy/core/src/multiarray/arraytypes.c.src
  12. +1 −2 numpy/core/src/multiarray/buffer.c
  13. +5 −6 numpy/core/src/multiarray/calculation.c
  14. +18 −19 numpy/core/src/multiarray/common.c
  15. +73 −74 numpy/core/src/multiarray/conversion_utils.c
  16. +4 −4 numpy/core/src/multiarray/conversion_utils.h
  17. +2 −3 numpy/core/src/multiarray/convert.c
  18. +3 −4 numpy/core/src/multiarray/convert_datatype.c
  19. +11 −11 numpy/core/src/multiarray/ctors.c
  20. +10 −10 numpy/core/src/multiarray/ctors.h
  21. +46 −47 numpy/core/src/multiarray/descriptor.c
  22. +1 −1 numpy/core/src/multiarray/dtype_transfer.c
  23. +128 −124 numpy/core/src/multiarray/einsum.c.src
  24. +4 −5 numpy/core/src/multiarray/flagsobject.c
  25. +20 −21 numpy/core/src/multiarray/getset.c
  26. +1 −1 numpy/core/src/multiarray/hashdescr.c
  27. +86 −87 numpy/core/src/multiarray/item_selection.c
  28. +19 −20 numpy/core/src/multiarray/iterators.c
  29. +3 −3 numpy/core/src/multiarray/iterators.h
  30. +41 −21 numpy/core/src/multiarray/lowlevel_strided_loops.c.src
  31. +15 −16 numpy/core/src/multiarray/mapping.c
  32. +4 −4 numpy/core/src/multiarray/mapping.h
  33. +18 −18 numpy/core/src/multiarray/methods.c
  34. +14 −8 numpy/core/src/multiarray/multiarray_tests.c.src
  35. +19 −20 numpy/core/src/multiarray/multiarraymodule.c
  36. +1 −1 numpy/core/src/multiarray/nditer_impl.h
  37. +1 −1 numpy/core/src/multiarray/nditer_pywrap.c
  38. +1 −2 numpy/core/src/multiarray/number.c
  39. +0 −1 numpy/core/src/multiarray/numpymemoryview.c
  40. +0 −1 numpy/core/src/multiarray/numpyos.c
  41. +3 −4 numpy/core/src/multiarray/refcount.c
  42. +8 −9 numpy/core/src/multiarray/scalarapi.c
  43. +197 −137 numpy/core/src/multiarray/scalartypes.c.src
  44. +1 −1 numpy/core/src/multiarray/scalartypes.h
  45. +2 −3 numpy/core/src/multiarray/sequence.c
  46. +8 −9 numpy/core/src/multiarray/shape.c
  47. +19 −20 numpy/core/src/multiarray/ucsnarrow.c
  48. +3 −4 numpy/core/src/multiarray/usertypes.c
  49. +1 −1 numpy/core/src/npymath/ieee754.c.src
  50. +3 −3 numpy/core/src/npymath/npy_math.c.src
  51. +2 −2 numpy/core/src/npymath/npy_math_complex.c.src
  52. +511 −269 numpy/core/src/scalarmathmodule.c.src
  53. +72 −70 numpy/core/src/umath/funcs.inc.src
  54. +335 −319 numpy/core/src/umath/loops.c.src
  55. +1,004 −1,004 numpy/core/src/umath/loops.h
  56. +85 −90 numpy/core/src/umath/loops.h.src
  57. +15 −15 numpy/core/src/umath/ufunc_object.c
  58. +26 −26 numpy/core/src/umath/umath_tests.c.src
  59. +10 −7 numpy/core/src/umath/{umathmodule.c.src → umathmodule.c}
  60. +6 −6 numpy/f2py/doc/multiarray/array_from_pyobj.c
  61. +2 −2 numpy/lib/src/_compiled_base.c
  62. +9 −9 numpy/linalg/lapack_litemodule.c
View
2 numpy/core/SConscript
@@ -386,8 +386,6 @@ boolean_ops_src = env.GenerateFromTemplate(
lowlevel_strided_loops_src = env.GenerateFromTemplate(
pjoin('src', 'multiarray', 'lowlevel_strided_loops.c.src'))
einsum_src = env.GenerateFromTemplate(pjoin('src', 'multiarray', 'einsum.c.src'))
-umathmodule_src = env.GenerateFromTemplate(pjoin('src', 'umath',
- 'umathmodule.c.src'))
umath_tests_src = env.GenerateFromTemplate(pjoin('src', 'umath',
'umath_tests.c.src'))
multiarray_tests_src = env.GenerateFromTemplate(pjoin('src', 'multiarray',
View
2 numpy/core/blasdot/_dotblas.c
@@ -3,7 +3,7 @@ static char module_doc[] =
#include "Python.h"
#include "npy_config.h"
-#include "numpy/ndarrayobject.h"
+#include "numpy/arrayobject.h"
#ifndef CBLAS_HEADER
#define CBLAS_HEADER "cblas.h"
#endif
View
3 numpy/core/bscript
@@ -475,7 +475,6 @@ def pbuild(context):
name="ufunc_api")
ufunc_templates = ["src/umath/loops.c.src",
- "src/umath/umathmodule.c.src",
"src/umath/funcs.inc.src"]
bld(target="ufunc_templates", source=ufunc_templates)
@@ -485,7 +484,7 @@ def pbuild(context):
includes = ["src/umath", "src/private"]
if ENABLE_SEPARATE_COMPILATION:
- sources = [pjoin("src", "umath", "umathmodule.c.src"),
+ sources = [pjoin("src", "umath", "umathmodule.c"),
pjoin("src", "umath", "ufunc_object.c"),
pjoin("src", "umath", "loops.c.src")]
else:
View
5 numpy/core/include/numpy/arrayobject.h
@@ -11,11 +11,12 @@
#ifndef Py_ARRAYOBJECT_H
#define Py_ARRAYOBJECT_H
+
#include "ndarrayobject.h"
+#include "npy_interrupt.h"
+
#ifdef NPY_NO_PREFIX
#include "noprefix.h"
#endif
-#include "npy_interrupt.h"
-
#endif
View
6 numpy/core/include/numpy/ndarraytypes.h
@@ -919,10 +919,10 @@ typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *);
/*
* Size of internal buffers used for alignment Make BUFSIZE a multiple
- * of sizeof(cdouble) -- usually 16 so that ufunc buffers are aligned
+ * of sizeof(npy_cdouble) -- usually 16 so that ufunc buffers are aligned
*/
-#define NPY_MIN_BUFSIZE ((int)sizeof(cdouble))
-#define NPY_MAX_BUFSIZE (((int)sizeof(cdouble))*1000000)
+#define NPY_MIN_BUFSIZE ((int)sizeof(npy_cdouble))
+#define NPY_MAX_BUFSIZE (((int)sizeof(npy_cdouble))*1000000)
#define NPY_BUFSIZE 8192
/* buffer stress test size: */
/*#define NPY_BUFSIZE 17*/
View
11 numpy/core/include/numpy/noprefix.h
@@ -1,12 +1,19 @@
#ifndef NPY_NOPREFIX_H
#define NPY_NOPREFIX_H
-/* You can directly include noprefix.h as a backward
-compatibility measure*/
+/*
+ * You can directly include noprefix.h as a backward
+ * compatibility measure
+ */
#ifndef NPY_NO_PREFIX
#include "ndarrayobject.h"
+#include "npy_interrupt.h"
#endif
+#define SIGSETJMP NPY_SIGSETJMP
+#define SIGLONGJMP NPY_SIGLONGJMP
+#define SIGJMP_BUF NPY_SIGJMP_BUF
+
#define MAX_DIMS NPY_MAXDIMS
#define longlong npy_longlong
View
14 numpy/core/include/numpy/npy_common.h
@@ -29,8 +29,13 @@ enum {
*/
typedef Py_intptr_t npy_intp;
typedef Py_uintptr_t npy_uintp;
+#define NPY_SIZEOF_CHAR 1
+#define NPY_SIZEOF_BYTE 1
#define NPY_SIZEOF_INTP NPY_SIZEOF_PY_INTPTR_T
#define NPY_SIZEOF_UINTP NPY_SIZEOF_PY_INTPTR_T
+#define NPY_SIZEOF_CFLOAT NPY_SIZEOF_COMPLEX_FLOAT
+#define NPY_SIZEOF_CDOUBLE NPY_SIZEOF_COMPLEX_DOUBLE
+#define NPY_SIZEOF_CLONGDOUBLE NPY_SIZEOF_COMPLEX_LONGDOUBLE
#ifdef constchar
#undef constchar
@@ -77,7 +82,7 @@ typedef Py_uintptr_t npy_uintp;
#define PyIntpArrType_Type PyLongArrType_Type
#define PyUIntpArrType_Type PyULongArrType_Type
#define NPY_MAX_INTP NPY_MAX_LONG
- #define NPY_MIN_INTP MIN_LONG
+ #define NPY_MIN_INTP NPY_MIN_LONG
#define NPY_MAX_UINTP NPY_MAX_ULONG
#define NPY_INTP_FMT "ld"
#elif defined(PY_LONG_LONG) && (NPY_SIZEOF_PY_INTPTR_T == NPY_SIZEOF_LONGLONG)
@@ -297,16 +302,21 @@ typedef struct { npy_longdouble real, imag; } npy_clongdouble;
#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_BYTE (NPY_SIZEOF_BYTE * CHAR_BIT)
#define NPY_BITSOF_SHORT (NPY_SIZEOF_SHORT * CHAR_BIT)
#define NPY_BITSOF_INT (NPY_SIZEOF_INT * CHAR_BIT)
#define NPY_BITSOF_LONG (NPY_SIZEOF_LONG * CHAR_BIT)
#define NPY_BITSOF_LONGLONG (NPY_SIZEOF_LONGLONG * CHAR_BIT)
+#define NPY_BITSOF_INTP (NPY_SIZEOF_INTP * CHAR_BIT)
#define NPY_BITSOF_HALF (NPY_SIZEOF_HALF * CHAR_BIT)
#define NPY_BITSOF_FLOAT (NPY_SIZEOF_FLOAT * CHAR_BIT)
#define NPY_BITSOF_DOUBLE (NPY_SIZEOF_DOUBLE * CHAR_BIT)
#define NPY_BITSOF_LONGDOUBLE (NPY_SIZEOF_LONGDOUBLE * CHAR_BIT)
+#define NPY_BITSOF_CFLOAT (NPY_SIZEOF_CFLOAT * CHAR_BIT)
+#define NPY_BITSOF_CDOUBLE (NPY_SIZEOF_CDOUBLE * CHAR_BIT)
+#define NPY_BITSOF_CLONGDOUBLE (NPY_SIZEOF_CLONGDOUBLE * CHAR_BIT)
#define NPY_BITSOF_DATETIME (NPY_SIZEOF_DATETIME * CHAR_BIT)
#define NPY_BITSOF_TIMEDELTA (NPY_SIZEOF_TIMEDELTA * CHAR_BIT)
View
18 numpy/core/include/numpy/npy_interrupt.h
@@ -85,22 +85,22 @@ Interrupt handling does not work well with threads.
#ifndef sigsetjmp
-#define SIGSETJMP(arg1, arg2) setjmp(arg1)
-#define SIGLONGJMP(arg1, arg2) longjmp(arg1, arg2)
-#define SIGJMP_BUF jmp_buf
+#define NPY_SIGSETJMP(arg1, arg2) setjmp(arg1)
+#define NPY_SIGLONGJMP(arg1, arg2) longjmp(arg1, arg2)
+#define NPY_SIGJMP_BUF jmp_buf
#else
-#define SIGSETJMP(arg1, arg2) sigsetjmp(arg1, arg2)
-#define SIGLONGJMP(arg1, arg2) siglongjmp(arg1, arg2)
-#define SIGJMP_BUF sigjmp_buf
+#define NPY_SIGSETJMP(arg1, arg2) sigsetjmp(arg1, arg2)
+#define NPY_SIGLONGJMP(arg1, arg2) siglongjmp(arg1, arg2)
+#define NPY_SIGJMP_BUF sigjmp_buf
#endif
# define NPY_SIGINT_ON { \
PyOS_sighandler_t _npy_sig_save; \
_npy_sig_save = PyOS_setsig(SIGINT, _PyArray_SigintHandler); \
- if (SIGSETJMP(*((SIGJMP_BUF *)_PyArray_GetSigintBuf()), \
+ if (NPY_SIGSETJMP(*((NPY_SIGJMP_BUF *)_PyArray_GetSigintBuf()), \
1) == 0) { \
# define NPY_SIGINT_OFF } \
@@ -109,8 +109,8 @@ Interrupt handling does not work well with threads.
#else /* NPY_NO_SIGNAL */
-# define NPY_SIGINT_ON
-# define NPY_SIGINT_OFF
+#define NPY_SIGINT_ON
+#define NPY_SIGINT_OFF
#endif /* HAVE_SIGSETJMP */
View
5 numpy/core/setup.py
@@ -829,8 +829,7 @@ def generate_umath_templated_sources(ext, build_dir):
subpath = join('src', 'umath')
# NOTE: For manual template conversion of loops.h.src, read the note
# in that file.
- sources = [join(local_dir, subpath, 'loops.c.src'),
- join(local_dir, subpath, 'umathmodule.c.src')]
+ sources = [join(local_dir, subpath, 'loops.c.src')]
# numpy.distutils generate .c from .c.src in weird directories, we have
# to add them there as they depend on the build_dir
@@ -854,7 +853,7 @@ def generate_umath_c(ext, build_dir):
return []
umath_src = [
- join('src', 'umath', 'umathmodule.c.src'),
+ join('src', 'umath', 'umathmodule.c'),
join('src', 'umath', 'funcs.inc.src'),
join('src', 'umath', 'loops.c.src'),
join('src', 'umath', 'ufunc_object.c'),
View
41 numpy/core/src/multiarray/arrayobject.c
@@ -27,7 +27,6 @@ maintainer email: oliphant.travis@ieee.org
/*#include <stdio.h>*/
#define NPY_NO_DEPRECATED_API
#define _MULTIARRAYMODULE
-#define NPY_NO_PREFIX
#include "numpy/arrayobject.h"
#include "numpy/arrayscalars.h"
@@ -426,7 +425,7 @@ dump_data(char **string, int *n, int *max_n, char *data, int nd,
#define CHECK_MEMORY do { if (*n >= *max_n-16) { \
*max_n *= 2; \
- *string = (char *)_pya_realloc(*string, *max_n); \
+ *string = (char *)PyArray_realloc(*string, *max_n); \
}} while (0)
if (nd == 0) {
@@ -513,17 +512,17 @@ PyArray_DebugPrint(PyArrayObject *obj)
printf(" flags :");
if (fobj->flags & NPY_ARRAY_C_CONTIGUOUS)
- printf(" C_CONTIGUOUS");
+ printf(" NPY_C_CONTIGUOUS");
if (fobj->flags & NPY_ARRAY_F_CONTIGUOUS)
- printf(" F_CONTIGUOUS");
+ printf(" NPY_F_CONTIGUOUS");
if (fobj->flags & NPY_ARRAY_OWNDATA)
- printf(" OWNDATA");
+ printf(" NPY_OWNDATA");
if (fobj->flags & NPY_ARRAY_ALIGNED)
- printf(" ALIGNED");
+ printf(" NPY_ALIGNED");
if (fobj->flags & NPY_ARRAY_WRITEABLE)
- printf(" WRITEABLE");
+ printf(" NPY_WRITEABLE");
if (fobj->flags & NPY_ARRAY_UPDATEIFCOPY)
- printf(" UPDATEIFCOPY");
+ printf(" NPY_UPDATEIFCOPY");
if (fobj->flags & NPY_ARRAY_MASKNA)
printf(" MASKNA");
if (fobj->flags & NPY_ARRAY_OWNMASKNA)
@@ -561,7 +560,7 @@ array_repr_builtin(PyArrayObject *self, int repr)
max_n = PyArray_NBYTES(self)*4*sizeof(char) + 7;
- if ((string = (char *)_pya_malloc(max_n)) == NULL) {
+ if ((string = (char *)PyArray_malloc(max_n)) == NULL) {
return PyErr_NoMemory();
}
@@ -575,7 +574,7 @@ array_repr_builtin(PyArrayObject *self, int repr)
if (dump_data(&string, &n, &max_n, PyArray_DATA(self),
PyArray_NDIM(self), PyArray_DIMS(self),
PyArray_STRIDES(self), self) < 0) {
- _pya_free(string);
+ PyArray_free(string);
return NULL;
}
@@ -595,7 +594,7 @@ array_repr_builtin(PyArrayObject *self, int repr)
ret = PyUString_FromStringAndSize(string, n);
}
- _pya_free(string);
+ PyArray_free(string);
return ret;
}
@@ -730,7 +729,7 @@ _myunincmp(npy_ucs4 *s1, npy_ucs4 *s2, int len1, int len2)
s2t = malloc(size);
memcpy(s2t, s2, size);
}
- val = PyArray_CompareUCS4(s1t, s2t, MIN(len1,len2));
+ val = PyArray_CompareUCS4(s1t, s2t, PyArray_MIN(len1,len2));
if ((val != 0) || (len1 == len2)) {
goto finish;
}
@@ -778,7 +777,7 @@ _mystrncmp(char *s1, char *s2, int len1, int len2)
int val;
int diff;
- val = memcmp(s1, s2, MIN(len1, len2));
+ val = memcmp(s1, s2, PyArray_MIN(len1, len2));
if ((val != 0) || (len1 == len2)) {
return val;
}
@@ -927,7 +926,7 @@ _compare_strings(PyArrayObject *result, PyArrayMultiIterObject *multi,
int cmp_op, void *func, int rstrip)
{
PyArrayIterObject *iself, *iother;
- Bool *dptr;
+ npy_bool *dptr;
npy_intp size;
int val;
int N1, N2;
@@ -936,7 +935,7 @@ _compare_strings(PyArrayObject *result, PyArrayMultiIterObject *multi,
char* (*stripfunc)(char *, char *, int);
compfunc = func;
- dptr = (Bool *)PyArray_DATA(result);
+ dptr = (npy_bool *)PyArray_DATA(result);
iself = multi->iters[0];
iother = multi->iters[1];
size = multi->size;
@@ -1163,7 +1162,7 @@ _void_compare(PyArrayObject *self, PyArrayObject *other, int cmp_op)
newdims.ptr = dimensions;
newdims.len = result_ndim+1;
memcpy(dimensions, PyArray_DIMS((PyArrayObject *)temp),
- sizeof(intp)*result_ndim);
+ sizeof(npy_intp)*result_ndim);
dimensions[result_ndim] = -1;
temp2 = PyArray_Newshape((PyArrayObject *)temp,
&newdims, NPY_ANYORDER);
@@ -1415,7 +1414,7 @@ PyArray_ElementStrides(PyObject *obj)
*/
/*NUMPY_API*/
-NPY_NO_EXPORT Bool
+NPY_NO_EXPORT npy_bool
PyArray_CheckStrides(int elsize, int nd, npy_intp numbytes, npy_intp offset,
npy_intp *dims, npy_intp *newstrides)
{
@@ -1432,10 +1431,10 @@ PyArray_CheckStrides(int elsize, int nd, npy_intp numbytes, npy_intp offset,
for (i = 0; i < nd; i++) {
byte_begin = newstrides[i]*(dims[i] - 1);
if ((byte_begin < begin) || (byte_begin > end)) {
- return FALSE;
+ return NPY_FALSE;
}
}
- return TRUE;
+ return NPY_TRUE;
}
@@ -1449,7 +1448,7 @@ array_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
PyArray_Dims dims = {NULL, 0};
PyArray_Dims strides = {NULL, 0};
PyArray_Chunk buffer;
- longlong offset = 0;
+ npy_longlong offset = 0;
NPY_ORDER order = NPY_CORDER;
int is_f_order = 0;
PyArrayObject *ret;
@@ -1608,7 +1607,7 @@ array_alloc(PyTypeObject *type, Py_ssize_t NPY_UNUSED(nitems))
{
PyObject *obj;
/* nitems will always be 0 */
- obj = (PyObject *)_pya_malloc(NPY_SIZEOF_PYARRAYOBJECT);
+ obj = (PyObject *)PyArray_malloc(NPY_SIZEOF_PYARRAYOBJECT);
PyObject_Init(obj, type);
return obj;
}
View
1,103 numpy/core/src/multiarray/arraytypes.c.src
654 additions, 449 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
3 numpy/core/src/multiarray/buffer.c
@@ -4,7 +4,6 @@
#define NPY_NO_DEPRECATED_API
#define _MULTIARRAYMODULE
-#define NPY_NO_PREFIX
#include "numpy/arrayobject.h"
#include "numpy/arrayscalars.h"
@@ -338,7 +337,7 @@ _buffer_format_string(PyArray_Descr *descr, _tmp_string_t *str,
if (is_native_only_type) {
/* It's not possible to express native-only data types
- in non-native byte orders */
+ in non-native npy_byte orders */
PyErr_Format(PyExc_ValueError,
"cannot expose native-only dtype '%c' in "
"non-native byte order '%c' via buffer interface",
View
11 numpy/core/src/multiarray/calculation.c
@@ -4,7 +4,6 @@
#define NPY_NO_DEPRECATED_API
#define _MULTIARRAYMODULE
-#define NPY_NO_PREFIX
#include "numpy/arrayobject.h"
#include "npy_config.h"
@@ -56,7 +55,7 @@ PyArray_ArgMax(PyArrayObject *op, int axis, PyArrayObject *out)
*/
if (axis != PyArray_NDIM(ap)-1) {
PyArray_Dims newaxes;
- npy_intp dims[MAX_DIMS];
+ npy_intp dims[NPY_MAXDIMS];
int j;
newaxes.ptr = dims;
@@ -155,8 +154,8 @@ PyArray_ArgMin(PyArrayObject *op, int axis, PyArrayObject *out)
PyArrayObject *ap = NULL, *rp = NULL;
PyArray_ArgFunc* arg_func;
char *ip;
- intp *rptr;
- intp i, n, m;
+ npy_intp *rptr;
+ npy_intp i, n, m;
int elsize;
NPY_BEGIN_THREADS_DEF;
@@ -169,7 +168,7 @@ PyArray_ArgMin(PyArrayObject *op, int axis, PyArrayObject *out)
*/
if (axis != PyArray_NDIM(ap)-1) {
PyArray_Dims newaxes;
- intp dims[MAX_DIMS];
+ npy_intp dims[NPY_MAXDIMS];
int i;
newaxes.ptr = dims;
@@ -237,7 +236,7 @@ PyArray_ArgMin(PyArrayObject *op, int axis, PyArrayObject *out)
NPY_BEGIN_THREADS_DESCR(PyArray_DESCR(ap));
n = PyArray_SIZE(ap)/m;
- rptr = (intp *)PyArray_DATA(rp);
+ rptr = (npy_intp *)PyArray_DATA(rp);
for (ip = PyArray_DATA(ap), i = 0; i < n; i++, ip += elsize*m) {
arg_func(ip, m, rptr, ap);
rptr += 1;
View
37 numpy/core/src/multiarray/common.c
@@ -3,7 +3,6 @@
#define NPY_NO_DEPRECATED_API
#define _MULTIARRAYMODULE
-#define NPY_NO_PREFIX
#include "numpy/arrayobject.h"
#include "npy_config.h"
@@ -372,7 +371,7 @@ _array_typedescr_fromstr(char *str)
size = atoi(str + 1);
switch (typechar) {
case 'b':
- if (size == sizeof(Bool)) {
+ if (size == sizeof(npy_bool)) {
type_num = NPY_BOOL;
}
else {
@@ -381,7 +380,7 @@ _array_typedescr_fromstr(char *str)
}
break;
case 'u':
- if (size == sizeof(uintp)) {
+ if (size == sizeof(npy_uintp)) {
type_num = NPY_UINTP;
}
else if (size == sizeof(char)) {
@@ -390,13 +389,13 @@ _array_typedescr_fromstr(char *str)
else if (size == sizeof(short)) {
type_num = NPY_USHORT;
}
- else if (size == sizeof(ulong)) {
+ else if (size == sizeof(npy_ulong)) {
type_num = NPY_ULONG;
}
else if (size == sizeof(int)) {
type_num = NPY_UINT;
}
- else if (size == sizeof(ulonglong)) {
+ else if (size == sizeof(npy_ulonglong)) {
type_num = NPY_ULONGLONG;
}
else {
@@ -405,7 +404,7 @@ _array_typedescr_fromstr(char *str)
}
break;
case 'i':
- if (size == sizeof(intp)) {
+ if (size == sizeof(npy_intp)) {
type_num = NPY_INTP;
}
else if (size == sizeof(char)) {
@@ -420,7 +419,7 @@ _array_typedescr_fromstr(char *str)
else if (size == sizeof(int)) {
type_num = NPY_INT;
}
- else if (size == sizeof(longlong)) {
+ else if (size == sizeof(npy_longlong)) {
type_num = NPY_LONGLONG;
}
else {
@@ -435,7 +434,7 @@ _array_typedescr_fromstr(char *str)
else if (size == sizeof(double)) {
type_num = NPY_DOUBLE;
}
- else if (size == sizeof(longdouble)) {
+ else if (size == sizeof(npy_longdouble)) {
type_num = NPY_LONGDOUBLE;
}
else {
@@ -450,7 +449,7 @@ _array_typedescr_fromstr(char *str)
else if (size == sizeof(double)*2) {
type_num = NPY_CDOUBLE;
}
- else if (size == sizeof(longdouble)*2) {
+ else if (size == sizeof(npy_longdouble)*2) {
type_num = NPY_CLONGDOUBLE;
}
else {
@@ -504,9 +503,9 @@ _array_typedescr_fromstr(char *str)
}
NPY_NO_EXPORT char *
-index2ptr(PyArrayObject *mp, intp i)
+index2ptr(PyArrayObject *mp, npy_intp i)
{
- intp dim0;
+ npy_intp dim0;
if (PyArray_NDIM(mp) == 0) {
PyErr_SetString(PyExc_IndexError, "0-d arrays can't be indexed");
@@ -539,7 +538,7 @@ _zerofill(PyArrayObject *ret)
}
}
else {
- intp n = PyArray_NBYTES(ret);
+ npy_intp n = PyArray_NBYTES(ret);
memset(PyArray_DATA(ret), 0, n);
}
return 0;
@@ -549,7 +548,7 @@ NPY_NO_EXPORT int
_IsAligned(PyArrayObject *ap)
{
int i, alignment, aligned = 1;
- intp ptr;
+ npy_intp ptr;
/* The special casing for STRING and VOID types was removed
* in accordance with http://projects.scipy.org/numpy/ticket/1227
@@ -562,7 +561,7 @@ _IsAligned(PyArrayObject *ap)
if (alignment == 1) {
return 1;
}
- ptr = (intp) PyArray_DATA(ap);
+ ptr = (npy_intp) PyArray_DATA(ap);
aligned = (ptr % alignment) == 0;
for (i = 0; i < PyArray_NDIM(ap); i++) {
aligned &= ((PyArray_STRIDES(ap)[i] % alignment) == 0);
@@ -570,7 +569,7 @@ _IsAligned(PyArrayObject *ap)
return aligned != 0;
}
-NPY_NO_EXPORT Bool
+NPY_NO_EXPORT npy_bool
_IsWriteable(PyArrayObject *ap)
{
PyObject *base=PyArray_BASE(ap);
@@ -579,7 +578,7 @@ _IsWriteable(PyArrayObject *ap)
/* If we own our own data, then no-problem */
if ((base == NULL) || (PyArray_FLAGS(ap) & NPY_ARRAY_OWNDATA)) {
- return TRUE;
+ return NPY_TRUE;
}
/*
* Get to the final base object
@@ -607,10 +606,10 @@ _IsWriteable(PyArrayObject *ap)
* -- could be abused --
*/
if (PyString_Check(base)) {
- return TRUE;
+ return NPY_TRUE;
}
if (PyObject_AsWriteBuffer(base, &dummy, &n) < 0) {
- return FALSE;
+ return NPY_FALSE;
}
- return TRUE;
+ return NPY_TRUE;
}
View
147 numpy/core/src/multiarray/conversion_utils.c
@@ -4,10 +4,9 @@
#define NPY_NO_DEPRECATED_API
#define _MULTIARRAYMODULE
-#define NPY_NO_PREFIX
#include "numpy/arrayobject.h"
#include "numpy/arrayscalars.h"
-#include "numpy/ndarrayobject.h"
+#include "numpy/arrayobject.h"
#include "npy_config.h"
#include "numpy/npy_3kcompat.h"
@@ -41,15 +40,15 @@ PyArray_Converter(PyObject *object, PyObject **address)
if (PyArray_Check(object) && !PyArray_HASMASKNA((PyArrayObject *)object)) {
*address = object;
Py_INCREF(object);
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
else {
*address = PyArray_FromAny(object, NULL, 0, 0,
NPY_ARRAY_CARRAY, NULL);
if (*address == NULL) {
- return PY_FAIL;
+ return NPY_FAIL;
}
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
}
@@ -72,15 +71,15 @@ PyArray_AllowNAConverter(PyObject *object, PyObject **address)
if (PyArray_Check(object)) {
*address = object;
Py_INCREF(object);
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
else {
*address = PyArray_FromAny(object, NULL, 0, 0,
NPY_ARRAY_CARRAY | NPY_ARRAY_ALLOWNA, NULL);
if (*address == NULL) {
- return PY_FAIL;
+ return NPY_FAIL;
}
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
}
@@ -93,7 +92,7 @@ PyArray_OutputConverter(PyObject *object, PyArrayObject **address)
{
if (object == NULL || object == Py_None) {
*address = NULL;
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
if (PyArray_Check(object)) {
if (PyArray_HASMASKNA((PyArrayObject *)object)) {
@@ -101,16 +100,16 @@ PyArray_OutputConverter(PyObject *object, PyArrayObject **address)
"this operation does not yet support output "
"arrays with NA support");
*address = NULL;
- return PY_FAIL;
+ return NPY_FAIL;
}
*address = (PyArrayObject *)object;
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
else {
PyErr_SetString(PyExc_TypeError,
"output must be an array");
*address = NULL;
- return PY_FAIL;
+ return NPY_FAIL;
}
}
@@ -123,17 +122,17 @@ PyArray_OutputAllowNAConverter(PyObject *object, PyArrayObject **address)
{
if (object == NULL || object == Py_None) {
*address = NULL;
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
if (PyArray_Check(object)) {
*address = (PyArrayObject *)object;
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
else {
PyErr_SetString(PyExc_TypeError,
"output must be an array");
*address = NULL;
- return PY_FAIL;
+ return NPY_FAIL;
}
}
@@ -155,7 +154,7 @@ PyArray_IntpConverter(PyObject *obj, PyArray_Dims *seq)
seq->ptr = NULL;
seq->len = 0;
if (obj == Py_None) {
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
len = PySequence_Size(obj);
if (len == -1) {
@@ -167,18 +166,18 @@ PyArray_IntpConverter(PyObject *obj, PyArray_Dims *seq)
if (len < 0) {
PyErr_SetString(PyExc_TypeError,
"expected sequence object with len >= 0");
- return PY_FAIL;
+ return NPY_FAIL;
}
if (len > NPY_MAXDIMS) {
PyErr_Format(PyExc_ValueError, "sequence too large; "
"must be smaller than %d", NPY_MAXDIMS);
- return PY_FAIL;
+ return NPY_FAIL;
}
if (len > 0) {
seq->ptr = PyDimMem_NEW(len);
if (seq->ptr == NULL) {
PyErr_NoMemory();
- return PY_FAIL;
+ return NPY_FAIL;
}
}
seq->len = len;
@@ -186,9 +185,9 @@ PyArray_IntpConverter(PyObject *obj, PyArray_Dims *seq)
if (nd == -1 || nd != len) {
PyDimMem_FREE(seq->ptr);
seq->ptr = NULL;
- return PY_FAIL;
+ return NPY_FAIL;
}
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
/*NUMPY_API
@@ -212,14 +211,14 @@ PyArray_BufferConverter(PyObject *obj, PyArray_Chunk *buf)
buf->flags = NPY_ARRAY_BEHAVED;
buf->base = NULL;
if (obj == Py_None) {
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
if (PyObject_AsWriteBuffer(obj, &(buf->ptr), &buflen) < 0) {
PyErr_Clear();
buf->flags &= ~NPY_ARRAY_WRITEABLE;
if (PyObject_AsReadBuffer(obj, (const void **)&(buf->ptr),
&buflen) < 0) {
- return PY_FAIL;
+ return NPY_FAIL;
}
}
buf->len = (npy_intp) buflen;
@@ -237,7 +236,7 @@ PyArray_BufferConverter(PyObject *obj, PyArray_Chunk *buf)
if (buf->base == NULL) {
buf->base = obj;
}
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
/*NUMPY_API
@@ -254,10 +253,10 @@ PyArray_AxisConverter(PyObject *obj, int *axis)
else {
*axis = (int) PyInt_AsLong(obj);
if (PyErr_Occurred()) {
- return PY_FAIL;
+ return NPY_FAIL;
}
}
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
/*
@@ -352,18 +351,18 @@ PyArray_ConvertMultiAxis(PyObject *axis_in, int ndim, npy_bool *out_axis_flags)
* Convert an object to true / false
*/
NPY_NO_EXPORT int
-PyArray_BoolConverter(PyObject *object, Bool *val)
+PyArray_BoolConverter(PyObject *object, npy_bool *val)
{
if (PyObject_IsTrue(object)) {
- *val = TRUE;
+ *val = NPY_TRUE;
}
else {
- *val = FALSE;
+ *val = NPY_FALSE;
}
if (PyErr_Occurred()) {
- return PY_FAIL;
+ return NPY_FAIL;
}
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
/*NUMPY_API
@@ -383,13 +382,13 @@ PyArray_ByteorderConverter(PyObject *obj, char *endian)
str = PyBytes_AsString(obj);
if (!str) {
Py_XDECREF(tmp);
- return PY_FAIL;
+ return NPY_FAIL;
}
if (strlen(str) < 1) {
PyErr_SetString(PyExc_ValueError,
"Byteorder string must be at least length 1");
Py_XDECREF(tmp);
- return PY_FAIL;
+ return NPY_FAIL;
}
*endian = str[0];
if (str[0] != NPY_BIG && str[0] != NPY_LITTLE
@@ -414,11 +413,11 @@ PyArray_ByteorderConverter(PyObject *obj, char *endian)
"%s is an unrecognized byteorder",
str);
Py_XDECREF(tmp);
- return PY_FAIL;
+ return NPY_FAIL;
}
}
Py_XDECREF(tmp);
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
/*NUMPY_API
@@ -438,13 +437,13 @@ PyArray_SortkindConverter(PyObject *obj, NPY_SORTKIND *sortkind)
str = PyBytes_AsString(obj);
if (!str) {
Py_XDECREF(tmp);
- return PY_FAIL;
+ return NPY_FAIL;
}
if (strlen(str) < 1) {
PyErr_SetString(PyExc_ValueError,
"Sort kind string must be at least length 1");
Py_XDECREF(tmp);
- return PY_FAIL;
+ return NPY_FAIL;
}
if (str[0] == 'q' || str[0] == 'Q') {
*sortkind = NPY_QUICKSORT;
@@ -460,10 +459,10 @@ PyArray_SortkindConverter(PyObject *obj, NPY_SORTKIND *sortkind)
"%s is an unrecognized kind of sort",
str);
Py_XDECREF(tmp);
- return PY_FAIL;
+ return NPY_FAIL;
}
Py_XDECREF(tmp);
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
/*NUMPY_API
@@ -485,7 +484,7 @@ PyArray_SearchsideConverter(PyObject *obj, void *addr)
PyErr_SetString(PyExc_ValueError,
"expected nonempty string for keyword 'side'");
Py_XDECREF(tmp);
- return PY_FAIL;
+ return NPY_FAIL;
}
if (str[0] == 'l' || str[0] == 'L') {
@@ -498,10 +497,10 @@ PyArray_SearchsideConverter(PyObject *obj, void *addr)
PyErr_Format(PyExc_ValueError,
"'%s' is an invalid value for keyword 'side'", str);
Py_XDECREF(tmp);
- return PY_FAIL;
+ return NPY_FAIL;
}
Py_XDECREF(tmp);
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
/*NUMPY_API
@@ -513,7 +512,7 @@ PyArray_OrderConverter(PyObject *object, NPY_ORDER *val)
char *str;
/* Leave the desired default from the caller for NULL/Py_None */
if (object == NULL || object == Py_None) {
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
else if (PyUnicode_Check(object)) {
PyObject *tmp;
@@ -531,9 +530,9 @@ PyArray_OrderConverter(PyObject *object, NPY_ORDER *val)
*val = NPY_CORDER;
}
if (PyErr_Occurred()) {
- return PY_FAIL;
+ return NPY_FAIL;
}
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
else {
str = PyBytes_AS_STRING(object);
@@ -552,10 +551,10 @@ PyArray_OrderConverter(PyObject *object, NPY_ORDER *val)
else {
PyErr_SetString(PyExc_TypeError,
"order not understood");
- return PY_FAIL;
+ return NPY_FAIL;
}
}
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
/*NUMPY_API
@@ -582,7 +581,7 @@ PyArray_ClipmodeConverter(PyObject *object, NPY_CLIPMODE *val)
else {
PyErr_SetString(PyExc_TypeError,
"clipmode not understood");
- return PY_FAIL;
+ return NPY_FAIL;
}
}
else if (PyUnicode_Check(object)) {
@@ -606,12 +605,12 @@ PyArray_ClipmodeConverter(PyObject *object, NPY_CLIPMODE *val)
goto fail;
}
}
- return PY_SUCCEED;
+ return NPY_SUCCEED;
fail:
PyErr_SetString(PyExc_TypeError,
"clipmode not understood");
- return PY_FAIL;
+ return NPY_FAIL;
}
/*NUMPY_API
@@ -629,32 +628,32 @@ PyArray_ConvertClipmodeSequence(PyObject *object, NPY_CLIPMODE *modes, int n)
PyErr_Format(PyExc_ValueError,
"list of clipmodes has wrong length (%d instead of %d)",
(int)PySequence_Size(object), n);
- return PY_FAIL;
+ return NPY_FAIL;
}
for (i = 0; i < n; ++i) {
PyObject *item = PySequence_GetItem(object, i);
if(item == NULL) {
- return PY_FAIL;
+ return NPY_FAIL;
}
- if(PyArray_ClipmodeConverter(item, &modes[i]) != PY_SUCCEED) {
+ if(PyArray_ClipmodeConverter(item, &modes[i]) != NPY_SUCCEED) {
Py_DECREF(item);
- return PY_FAIL;
+ return NPY_FAIL;
}
Py_DECREF(item);
}
}
- else if (PyArray_ClipmodeConverter(object, &modes[0]) == PY_SUCCEED) {
+ else if (PyArray_ClipmodeConverter(object, &modes[0]) == NPY_SUCCEED) {
for (i = 1; i < n; ++i) {
modes[i] = modes[0];
}
}
else {
- return PY_FAIL;
+ return NPY_FAIL;
}
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
/*NUMPY_API
@@ -773,7 +772,7 @@ PyArray_PyIntAsInt(PyObject *o)
#if (PY_VERSION_HEX >= 0x02050000)
if (PyIndex_Check(o)) {
PyObject* value = PyNumber_Index(o);
- long_value = (longlong) PyInt_AsSsize_t(value);
+ long_value = (npy_longlong) PyInt_AsSsize_t(value);
goto finish;
}
#endif
@@ -820,7 +819,7 @@ PyArray_PyIntAsInt(PyObject *o)
NPY_NO_EXPORT npy_intp
PyArray_PyIntAsIntp(PyObject *o)
{
- longlong long_value = -1;
+ npy_longlong long_value = -1;
PyObject *obj;
static char *msg = "an integer is required";
PyArrayObject *arr;
@@ -832,16 +831,16 @@ PyArray_PyIntAsIntp(PyObject *o)
return -1;
}
if (PyInt_Check(o)) {
- long_value = (longlong) PyInt_AS_LONG(o);
+ long_value = (npy_longlong) PyInt_AS_LONG(o);
goto finish;
} else if (PyLong_Check(o)) {
- long_value = (longlong) PyLong_AsLongLong(o);
+ long_value = (npy_longlong) PyLong_AsLongLong(o);
goto finish;
}
-#if SIZEOF_INTP == SIZEOF_LONG
+#if NPY_SIZEOF_INTP == SIZEOF_LONG
descr = &LONG_Descr;
-#elif SIZEOF_INTP == SIZEOF_INT
+#elif NPY_SIZEOF_INTP == SIZEOF_INT
descr = &INT_Descr;
#else
descr = &LONGLONG_Descr;
@@ -874,7 +873,7 @@ PyArray_PyIntAsIntp(PyObject *o)
if (value == NULL) {
return -1;
}
- long_value = (longlong) PyInt_AsSsize_t(value);
+ long_value = (npy_longlong) PyInt_AsSsize_t(value);
goto finish;
}
#endif
@@ -883,7 +882,7 @@ PyArray_PyIntAsIntp(PyObject *o)
Py_TYPE(o)->tp_as_number->nb_long != NULL) {
obj = Py_TYPE(o)->tp_as_number->nb_long(o);
if (obj != NULL) {
- long_value = (longlong) PyLong_AsLongLong(obj);
+ long_value = (npy_longlong) PyLong_AsLongLong(obj);
Py_DECREF(obj);
}
}
@@ -893,7 +892,7 @@ PyArray_PyIntAsIntp(PyObject *o)
Py_TYPE(o)->tp_as_number->nb_int != NULL) {
obj = Py_TYPE(o)->tp_as_number->nb_int(o);
if (obj != NULL) {
- long_value = (longlong) PyLong_AsLongLong(obj);
+ long_value = (npy_longlong) PyLong_AsLongLong(obj);
Py_DECREF(obj);
}
}
@@ -907,8 +906,8 @@ PyArray_PyIntAsIntp(PyObject *o)
return -1;
}
-#if (SIZEOF_LONGLONG > SIZEOF_INTP)
- if ((long_value < MIN_INTP) || (long_value > MAX_INTP)) {
+#if (NPY_SIZEOF_LONGLONG > NPY_SIZEOF_INTP)
+ if ((long_value < NPY_MIN_INTP) || (long_value > NPY_MAX_INTP)) {
PyErr_SetString(PyExc_ValueError,
"integer won't fit into a C intp");
return -1;
@@ -934,7 +933,7 @@ PyArray_IntpFromSequence(PyObject *seq, npy_intp *vals, int maxvals)
*/
if ((nd=PySequence_Length(seq)) == -1) {
if (PyErr_Occurred()) PyErr_Clear();
-#if SIZEOF_LONG >= SIZEOF_INTP && !defined(NPY_PY3K)
+#if SIZEOF_LONG >= NPY_SIZEOF_INTP && !defined(NPY_PY3K)
if (!(op = PyNumber_Int(seq))) {
return -1;
}
@@ -944,7 +943,7 @@ PyArray_IntpFromSequence(PyObject *seq, npy_intp *vals, int maxvals)
}
#endif
nd = 1;
-#if SIZEOF_LONG >= SIZEOF_INTP
+#if SIZEOF_LONG >= NPY_SIZEOF_INTP
vals[0] = (npy_intp ) PyInt_AsLong(op);
#else
vals[0] = (npy_intp ) PyLong_AsLongLong(op);
@@ -968,12 +967,12 @@ PyArray_IntpFromSequence(PyObject *seq, npy_intp *vals, int maxvals)
}
}
else {
- for (i = 0; i < MIN(nd,maxvals); i++) {
+ for (i = 0; i < PyArray_MIN(nd,maxvals); i++) {
op = PySequence_GetItem(seq, i);
if (op == NULL) {
return -1;
}
-#if SIZEOF_LONG >= SIZEOF_INTP
+#if SIZEOF_LONG >= NPY_SIZEOF_INTP
vals[i]=(npy_intp )PyInt_AsLong(op);
#else
vals[i]=(npy_intp )PyLong_AsLongLong(op);
@@ -1189,10 +1188,10 @@ PyArray_IntTupleFromIntp(int len, npy_intp *vals)
goto fail;
}
for (i = 0; i < len; i++) {
-#if SIZEOF_INTP <= SIZEOF_LONG
+#if NPY_SIZEOF_INTP <= SIZEOF_LONG
PyObject *o = PyInt_FromLong((long) vals[i]);
#else
- PyObject *o = PyLong_FromLongLong((longlong) vals[i]);
+ PyObject *o = PyLong_FromLongLong((npy_longlong) vals[i]);
#endif
if (!o) {
Py_DECREF(intTuple);
View
8 numpy/core/src/multiarray/conversion_utils.h
@@ -8,7 +8,7 @@ NPY_NO_EXPORT int
PyArray_BufferConverter(PyObject *obj, PyArray_Chunk *buf);
NPY_NO_EXPORT int
-PyArray_BoolConverter(PyObject *object, Bool *val);
+PyArray_BoolConverter(PyObject *object, npy_bool *val);
NPY_NO_EXPORT int
PyArray_ByteorderConverter(PyObject *obj, char *endian);
@@ -22,17 +22,17 @@ PyArray_SearchsideConverter(PyObject *obj, void *addr);
NPY_NO_EXPORT int
PyArray_PyIntAsInt(PyObject *o);
-NPY_NO_EXPORT intp
+NPY_NO_EXPORT npy_intp
PyArray_PyIntAsIntp(PyObject *o);
NPY_NO_EXPORT int
-PyArray_IntpFromSequence(PyObject *seq, intp *vals, int maxvals);
+PyArray_IntpFromSequence(PyObject *seq, npy_intp *vals, int maxvals);
NPY_NO_EXPORT int
PyArray_TypestrConvert(int itemsize, int gentype);
NPY_NO_EXPORT PyObject *
-PyArray_IntTupleFromIntp(int len, intp *vals);
+PyArray_IntTupleFromIntp(int len, npy_intp *vals);
/*
* Converts an axis parameter into an ndim-length C-array of
View
5 numpy/core/src/multiarray/convert.c
@@ -4,7 +4,6 @@
#define NPY_NO_DEPRECATED_API
#define _MULTIARRAYMODULE
-#define NPY_NO_PREFIX
#include "numpy/arrayobject.h"
#include "numpy/arrayscalars.h"
@@ -144,7 +143,7 @@ PyArray_ToFile(PyArrayObject *self, FILE *fp, char *sep, char *format)
NPY_END_THREADS;
PyErr_Format(PyExc_IOError,
"problem writing element"\
- " %"INTP_FMT" to file",
+ " %"NPY_INTP_FMT" to file",
it->index);
Py_DECREF(it);
return -1;
@@ -218,7 +217,7 @@ PyArray_ToFile(PyArrayObject *self, FILE *fp, char *sep, char *format)
#endif
if (n < n2) {
PyErr_Format(PyExc_IOError,
- "problem writing element %"INTP_FMT\
+ "problem writing element %"NPY_INTP_FMT\
" to file", it->index);
Py_DECREF(strobj);
Py_DECREF(it);
View
7 numpy/core/src/multiarray/convert_datatype.c
@@ -4,7 +4,6 @@
#define NPY_NO_DEPRECATED_API
#define _MULTIARRAYMODULE
-#define NPY_NO_PREFIX
#include "numpy/arrayobject.h"
#include "numpy/arrayscalars.h"
@@ -735,7 +734,7 @@ PyArray_CanCastScalar(PyTypeObject *from, PyTypeObject *to)
fromtype = _typenum_fromtypeobj((PyObject *)from, 0);
totype = _typenum_fromtypeobj((PyObject *)to, 0);
if (fromtype == NPY_NOTYPE || totype == NPY_NOTYPE) {
- return FALSE;
+ return NPY_FALSE;
}
return (npy_bool) PyArray_CanCastSafely(fromtype, totype);
}
@@ -1620,11 +1619,11 @@ NPY_NO_EXPORT int
PyArray_ValidType(int type)
{
PyArray_Descr *descr;
- int res=TRUE;
+ int res=NPY_TRUE;
descr = PyArray_DescrFromType(type);
if (descr == NULL) {
- res = FALSE;
+ res = NPY_FALSE;
}
Py_DECREF(descr);
return res;
View
22 numpy/core/src/multiarray/ctors.c
@@ -4,7 +4,6 @@
#define NPY_NO_DEPRECATED_API
#define _MULTIARRAYMODULE
-#define NPY_NO_PREFIX
#include "numpy/arrayobject.h"
#include "numpy/arrayscalars.h"
@@ -556,7 +555,7 @@ discover_itemsize(PyObject *s, int nd, int *itemsize)
int n, r, i;
if (PyArray_Check(s)) {
- *itemsize = MAX(*itemsize, PyArray_ITEMSIZE((PyArrayObject *)s));
+ *itemsize = PyArray_MAX(*itemsize, PyArray_ITEMSIZE((PyArrayObject *)s));
return 0;
}
@@ -574,7 +573,7 @@ discover_itemsize(PyObject *s, int nd, int *itemsize)
PyErr_Clear();
}
else {
- *itemsize = MAX(*itemsize, n);
+ *itemsize = PyArray_MAX(*itemsize, n);
}
return 0;
}
@@ -2161,8 +2160,8 @@ PyArray_FromStructInterface(PyObject *input)
inter->flags &= ~NPY_ARRAY_NOTSWAPPED;
}
- if (inter->flags & ARR_HAS_DESCR) {
- if (PyArray_DescrConverter(inter->descr, &thetype) == PY_FAIL) {
+ if (inter->flags & NPY_ARR_HAS_DESCR) {
+ if (PyArray_DescrConverter(inter->descr, &thetype) == NPY_FAIL) {
thetype = NULL;
PyErr_Clear();
}
@@ -2211,7 +2210,7 @@ PyArray_FromInterface(PyObject *input)
char *data;
Py_ssize_t buffer_len;
int res, i, n;
- intp dims[NPY_MAXDIMS], strides[NPY_MAXDIMS];
+ npy_intp dims[NPY_MAXDIMS], strides[NPY_MAXDIMS];
int dataflags = NPY_ARRAY_BEHAVED;
/* Get the memory from __array_data__ and __array_offset__ */
@@ -2266,7 +2265,7 @@ PyArray_FromInterface(PyObject *input)
}
attr = PyDict_GetItemString(inter, "offset");
if (attr) {
- longlong num = PyLong_AsLongLong(attr);
+ npy_longlong num = PyLong_AsLongLong(attr);
if (error_converting(num)) {
PyErr_SetString(PyExc_TypeError,
"__array_interface__ offset must be an integer");
@@ -3107,7 +3106,8 @@ PyArray_Arange(double start, double stop, double step, int type_num)
return (PyObject *)range;
}
if (!funcs->fill) {
- PyErr_SetString(PyExc_ValueError, "no fill-function for data-type.");
+ PyErr_SetString(PyExc_ValueError,
+ "no fill-function for data-type.");
Py_DECREF(range);
return NULL;
}
@@ -3170,7 +3170,7 @@ _calc_length(PyObject *start, PyObject *stop, PyObject *step, PyObject **next, i
"arange: overflow while computing length");
return -1;
}
- len = MIN(len, tmp);
+ len = PyArray_MIN(len, tmp);
}
else {
value = PyFloat_AsDouble(val);
@@ -3621,7 +3621,7 @@ PyArray_FromBuffer(PyObject *buf, PyArray_Descr *type,
if ((offset < 0) || (offset > ts)) {
PyErr_Format(PyExc_ValueError,
"offset must be non-negative and no greater than buffer "\
- "length (%" INTP_FMT ")", (npy_intp)ts);
+ "length (%" NPY_INTP_FMT ")", (npy_intp)ts);
Py_DECREF(buf);
Py_DECREF(type);
return NULL;
@@ -3702,7 +3702,7 @@ PyArray_FromString(char *data, npy_intp slen, PyArray_Descr *dtype,
{
int itemsize;
PyArrayObject *ret;
- Bool binary;
+ npy_bool binary;
if (dtype == NULL) {
dtype=PyArray_DescrFromType(NPY_DEFAULT_TYPE);
View
20 numpy/core/src/multiarray/ctors.h
@@ -3,11 +3,11 @@
NPY_NO_EXPORT PyObject *
PyArray_NewFromDescr(PyTypeObject *subtype, PyArray_Descr *descr, int nd,
- intp *dims, intp *strides, void *data,
+ npy_intp *dims, npy_intp *strides, void *data,
int flags, PyObject *obj);
-NPY_NO_EXPORT PyObject *PyArray_New(PyTypeObject *, int nd, intp *,
- int, intp *, void *, int, int, PyObject *);
+NPY_NO_EXPORT PyObject *PyArray_New(PyTypeObject *, int nd, npy_intp *,
+ int, npy_intp *, void *, int, int, PyObject *);
NPY_NO_EXPORT PyObject *
PyArray_FromAny(PyObject *op, PyArray_Descr *newtype, int min_depth,
@@ -52,22 +52,22 @@ PyArray_CopyAsFlat(PyArrayObject *dst, PyArrayObject *src,
/* FIXME: remove those from here */
NPY_NO_EXPORT size_t
-_array_fill_strides(intp *strides, intp *dims, int nd, size_t itemsize,
+_array_fill_strides(npy_intp *strides, npy_intp *dims, int nd, size_t itemsize,
int inflag, int *objflags);
NPY_NO_EXPORT void
-_unaligned_strided_byte_copy(char *dst, intp outstrides, char *src,
- intp instrides, intp N, int elsize);
+_unaligned_strided_byte_copy(char *dst, npy_intp outstrides, char *src,
+ npy_intp instrides, npy_intp N, int elsize);
NPY_NO_EXPORT void
-_strided_byte_swap(void *p, intp stride, intp n, int size);
+_strided_byte_swap(void *p, npy_intp stride, npy_intp n, int size);
NPY_NO_EXPORT void
-copy_and_swap(void *dst, void *src, int itemsize, intp numitems,
- intp srcstrides, int swap);
+copy_and_swap(void *dst, void *src, int itemsize, npy_intp numitems,
+ npy_intp srcstrides, int swap);
NPY_NO_EXPORT void
-byte_swap_vector(void *p, intp n, int size);
+byte_swap_vector(void *p, npy_intp n, int size);
NPY_NO_EXPORT int
PyArray_AssignFromSequence(PyArrayObject *self, PyObject *v);
View
93 numpy/core/src/multiarray/descriptor.c
@@ -6,7 +6,6 @@
#define NPY_NO_DEPRECATED_API
#define _MULTIARRAYMODULE
-#define NPY_NO_PREFIX
#include "numpy/arrayobject.h"
#include "numpy/arrayscalars.h"
@@ -47,7 +46,7 @@ _arraydescr_fromobj(PyObject *obj)
if (dtypedescr) {
ret = PyArray_DescrConverter(dtypedescr, &new);
Py_DECREF(dtypedescr);
- if (ret == PY_SUCCEED) {
+ if (ret == NPY_SUCCEED) {
return new;
}
PyErr_Clear();
@@ -58,7 +57,7 @@ _arraydescr_fromobj(PyObject *obj)
if (dtypedescr) {
ret = PyArray_DescrConverter(dtypedescr, &new);
Py_DECREF(dtypedescr);
- if (ret == PY_SUCCEED) {
+ if (ret == NPY_SUCCEED) {
PyObject *length;
length = PyObject_GetAttrString(obj, "_length_");
PyErr_Clear();
@@ -69,7 +68,7 @@ _arraydescr_fromobj(PyObject *obj)
newtup = Py_BuildValue("NO", new, length);
ret = PyArray_DescrConverter(newtup, &derived);
Py_DECREF(newtup);
- if (ret == PY_SUCCEED) {
+ if (ret == NPY_SUCCEED) {
return derived;
}
PyErr_Clear();
@@ -88,7 +87,7 @@ _arraydescr_fromobj(PyObject *obj)
if (dtypedescr) {
ret = PyArray_DescrAlignConverter(dtypedescr, &new);
Py_DECREF(dtypedescr);
- if (ret == PY_SUCCEED) {
+ if (ret == NPY_SUCCEED) {
return new;
}
PyErr_Clear();
@@ -250,7 +249,7 @@ _convert_from_tuple(PyObject *obj)
PyArray_Dims shape = {NULL, -1};
PyArray_Descr *newdescr;
- if (!(PyArray_IntpConverter(val, &shape)) || (shape.len > MAX_DIMS)) {
+ if (!(PyArray_IntpConverter(val, &shape)) || (shape.len > NPY_MAXDIMS)) {
PyDimMem_FREE(shape.ptr);
PyErr_SetString(PyExc_ValueError,
"invalid shape in fixed-type tuple.");
@@ -393,7 +392,7 @@ _convert_from_array_descr(PyObject *obj, int align)
else {
ret = PyArray_DescrConverter(PyTuple_GET_ITEM(item, 1), &conv);
}
- if (ret == PY_FAIL) {
+ if (ret == NPY_FAIL) {
PyObject_Print(PyTuple_GET_ITEM(item, 1), stderr, 0);
}
}
@@ -410,7 +409,7 @@ _convert_from_array_descr(PyObject *obj, int align)
else {
goto fail;
}
- if (ret == PY_FAIL) {
+ if (ret == NPY_FAIL) {
goto fail;
}
if ((PyDict_GetItem(fields, name) != NULL)
@@ -435,7 +434,7 @@ _convert_from_array_descr(PyObject *obj, int align)
if (_align > 1) {
totalsize = NPY_NEXT_ALIGNED_OFFSET(totalsize, _align);
}
- maxalign = MAX(maxalign, _align);
+ maxalign = PyArray_MAX(maxalign, _align);
}
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong((long) totalsize));
@@ -543,7 +542,7 @@ _convert_from_list(PyObject *obj, int align)
else {
ret = PyArray_DescrConverter(PyList_GET_ITEM(obj, i), &conv);
}
- if (ret == PY_FAIL) {
+ if (ret == NPY_FAIL) {
Py_DECREF(tup);
Py_DECREF(key);
goto fail;
@@ -557,7 +556,7 @@ _convert_from_list(PyObject *obj, int align)
if (_align > 1) {
totalsize = NPY_NEXT_ALIGNED_OFFSET(totalsize, _align);
}
- maxalign = MAX(maxalign, _align);
+ maxalign = PyArray_MAX(maxalign, _align);
}
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong((long) totalsize));
PyDict_SetItem(fields, key, tup);
@@ -919,7 +918,7 @@ _convert_from_dict(PyObject *obj, int align)
ret = PyArray_DescrConverter(descr, &newdescr);
}
Py_DECREF(descr);
- if (ret == PY_FAIL) {
+ if (ret == NPY_FAIL) {
Py_DECREF(tup);
Py_DECREF(ind);
goto fail;
@@ -927,7 +926,7 @@ _convert_from_dict(PyObject *obj, int align)
PyTuple_SET_ITEM(tup, 0, (PyObject *)newdescr);
if (align) {
_align = newdescr->alignment;
- maxalign = MAX(maxalign,_align);
+ maxalign = PyArray_MAX(maxalign,_align);
}
if (offsets) {
long offset;
@@ -948,7 +947,7 @@ _convert_from_dict(PyObject *obj, int align)
"not divisible by the field alignment %d "
"with align=True",
(int)offset, (int)newdescr->alignment);
- ret = PY_FAIL;
+ ret = NPY_FAIL;
}
else if (offset + newdescr->elsize > totalsize) {
totalsize = offset + newdescr->elsize;
@@ -976,14 +975,14 @@ _convert_from_dict(PyObject *obj, int align)
#endif
PyErr_SetString(PyExc_ValueError,
"field names must be strings");
- ret = PY_FAIL;
+ ret = NPY_FAIL;
}
/* Insert into dictionary */
if (PyDict_GetItem(fields, name) != NULL) {
PyErr_SetString(PyExc_ValueError,
"name already used as a name or title");
- ret = PY_FAIL;
+ ret = NPY_FAIL;
}
PyDict_SetItem(fields, name, tup);
Py_DECREF(name);
@@ -996,13 +995,13 @@ _convert_from_dict(PyObject *obj, int align)
if (PyDict_GetItem(fields, title) != NULL) {
PyErr_SetString(PyExc_ValueError,
"title already used as a name or title.");
- ret=PY_FAIL;
+ ret=NPY_FAIL;
}
PyDict_SetItem(fields, title, tup);
}
}
Py_DECREF(tup);
- if ((ret == PY_FAIL) || (newdescr->elsize == 0)) {
+ if ((ret == NPY_FAIL) || (newdescr->elsize == 0)) {
goto fail;
}
dtypeflags |= (newdescr->flags & NPY_FROM_FIELDS);
@@ -1117,7 +1116,7 @@ PyArray_DescrConverter2(PyObject *obj, PyArray_Descr **at)
{
if (obj == Py_None) {
*at = NULL;
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
else {
return PyArray_DescrConverter(obj, at);
@@ -1152,19 +1151,19 @@ PyArray_DescrConverter(PyObject *obj, PyArray_Descr **at)
/* default */
if (obj == Py_None) {
*at = PyArray_DescrFromType(NPY_DEFAULT_TYPE);
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
if (PyArray_DescrCheck(obj)) {
*at = (PyArray_Descr *)obj;
Py_INCREF(*at);
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
if (PyType_Check(obj)) {
if (PyType_IsSubtype((PyTypeObject *)obj, &PyGenericArrType_Type)) {
*at = PyArray_DescrFromTypeObject(obj);
- return (*at) ? PY_SUCCEED : PY_FAIL;
+ return (*at) ? NPY_SUCCEED : NPY_FAIL;
}
check_num = NPY_OBJECT;
#if !defined(NPY_PY3K)
@@ -1204,7 +1203,7 @@ PyArray_DescrConverter(PyObject *obj, PyArray_Descr **at)
else {
*at = _arraydescr_fromobj(obj);
if (*at) {
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
}
goto finish;
@@ -1218,7 +1217,7 @@ PyArray_DescrConverter(PyObject *obj, PyArray_Descr **at)
PyObject *obj2;
obj2 = PyUnicode_AsASCIIString(obj);
if (obj2 == NULL) {
- return PY_FAIL;
+ return NPY_FAIL;
}
retval = PyArray_DescrConverter(obj2, at);
Py_DECREF(obj2);
@@ -1242,7 +1241,7 @@ PyArray_DescrConverter(PyObject *obj, PyArray_Descr **at)
/* check for commas present or first (or second) element a digit */
if (_check_for_commastring(type, len)) {
*at = _convert_from_commastring(obj, 0);
- return (*at) ? PY_SUCCEED : PY_FAIL;
+ return (*at) ? NPY_SUCCEED : NPY_FAIL;
}
/* Process the endian character */
@@ -1270,7 +1269,7 @@ PyArray_DescrConverter(PyObject *obj, PyArray_Descr **at)
/* Check for datetime format */
if (is_datetime_typestr(type, len)) {
*at = parse_dtype_from_datetime_typestr(type, len);
- return (*at) ? PY_SUCCEED : PY_FAIL;
+ return (*at) ? NPY_SUCCEED : NPY_FAIL;
}
/* A typecode like 'd' */
@@ -1330,33 +1329,33 @@ PyArray_DescrConverter(PyObject *obj, PyArray_Descr **at)
*at = _convert_from_tuple(obj);
if (*at == NULL){
if (PyErr_Occurred()) {
- return PY_FAIL;
+ return NPY_FAIL;
}
goto fail;
}
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
else if (PyList_Check(obj)) {
/* or a list */
*at = _convert_from_array_descr(obj,0);
if (*at == NULL) {
if (PyErr_Occurred()) {
- return PY_FAIL;
+ return NPY_FAIL;
}
goto fail;
}
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
else if (PyDict_Check(obj)) {
/* or a dictionary */
*at = _convert_from_dict(obj,0);
if (*at == NULL) {
if (PyErr_Occurred()) {
- return PY_FAIL;
+ return NPY_FAIL;
}
goto fail;
}
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
else if (PyArray_Check(obj)) {
goto fail;
@@ -1364,10 +1363,10 @@ PyArray_DescrConverter(PyObject *obj, PyArray_Descr **at)
else {
*at = _arraydescr_fromobj(obj);
if (*at) {
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
if (PyErr_Occurred()) {
- return PY_FAIL;
+ return NPY_FAIL;
}
goto fail;
}
@@ -1411,7 +1410,7 @@ PyArray_DescrConverter(PyObject *obj, PyArray_Descr **at)
PyArray_DESCR_REPLACE(*at);
(*at)->byteorder = endian;
}
- return PY_SUCCEED;
+ return NPY_SUCCEED;
fail:
if (PyBytes_Check(obj)) {
@@ -1424,7 +1423,7 @@ PyArray_DescrConverter(PyObject *obj, PyArray_Descr **at)
error:
*at = NULL;
- return PY_FAIL;
+ return NPY_FAIL;
}
/** Array Descr Objects for dynamic types **/
@@ -1951,9 +1950,9 @@ arraydescr_new(PyTypeObject *NPY_UNUSED(subtype),
{
PyObject *odescr, *metadata=NULL;
PyArray_Descr *descr, *conv;
- npy_bool align = FALSE;
- npy_bool copy = FALSE;
- npy_bool copied = FALSE;
+ npy_bool align = NPY_FALSE;
+ npy_bool copy = NPY_FALSE;
+ npy_bool copied = NPY_FALSE;
static char *kwlist[] = {"dtype", "align", "copy", "metadata", NULL};
@@ -1983,7 +1982,7 @@ arraydescr_new(PyTypeObject *NPY_UNUSED(subtype),
descr = PyArray_DescrNew(conv);
Py_DECREF(conv);
conv = descr;
- copied = TRUE;
+ copied = NPY_TRUE;
}
if ((metadata != NULL)) {
@@ -1992,7 +1991,7 @@ arraydescr_new(PyTypeObject *NPY_UNUSED(subtype),
* underlying dictionary
*/
if (!copied) {
- copied = TRUE;
+ copied = NPY_TRUE;
descr = PyArray_DescrNew(conv);
Py_DECREF(conv);
conv = descr;
@@ -2518,9 +2517,9 @@ PyArray_DescrAlignConverter(PyObject *obj, PyArray_Descr **at)
PyErr_SetString(PyExc_ValueError,
"data-type-descriptor not understood");
}
- return PY_FAIL;
+ return NPY_FAIL;
}
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
/*NUMPY_API
@@ -2554,9 +2553,9 @@ PyArray_DescrAlignConverter2(PyObject *obj, PyArray_Descr **at)
PyErr_SetString(PyExc_ValueError,
"data-type-descriptor not understood");
}
- return PY_FAIL;
+ return NPY_FAIL;
}
- return PY_SUCCEED;
+ return NPY_SUCCEED;
}
@@ -3161,7 +3160,7 @@ arraydescr_richcompare(PyArray_Descr *self, PyObject *other, int cmp_op)
PyArray_Descr *new = NULL;
PyObject *result = Py_NotImplemented;
if (!PyArray_DescrCheck(other)) {
- if (PyArray_DescrConverter(other, &new) == PY_FAIL) {
+ if (PyArray_DescrConverter(other, &new) == NPY_FAIL) {
return NULL;
}
}
@@ -3249,7 +3248,7 @@ descr_repeat(PyObject *self, Py_ssize_t length)
PyArray_Descr *new;
if (length < 0) {
return PyErr_Format(PyExc_ValueError,
- "Array length must be >= 0, not %"INTP_FMT, length);
+ "Array length must be >= 0, not %"NPY_INTP_FMT, length);
}
tup = Py_BuildValue("O" NPY_SSIZE_T_PYFMT, self, length);
if (tup == NULL) {
View
2 numpy/core/src/multiarray/dtype_transfer.c
@@ -16,7 +16,7 @@
#define NPY_NO_DEPRECATED_API
#define _MULTIARRAYMODULE
-#include <numpy/ndarrayobject.h>
+#include <numpy/arrayobject.h>
#include <numpy/npy_cpu.h>
#include "numpy/npy_3kcompat.h"
View
252 numpy/core/src/multiarray/einsum.c.src
@@ -14,7 +14,7 @@
#define NPY_NO_DEPRECATED_API
#define _MULTIARRAYMODULE
-#include <numpy/ndarrayobject.h>
+#include <numpy/arrayobject.h>
#include <numpy/halffloat.h>
#include <numpy/npy_3kcompat.h>
@@ -75,10 +75,14 @@ typedef enum {
* ubyte, ushort, uint, ulong, ulonglong,
* half, float, double, longdouble,
* cfloat, cdouble, clongdouble#
- * #temp = byte, short, int, long, longlong,
- * ubyte, ushort, uint, ulong, ulonglong,
- * float, float, double, longdouble,
- * float, double, longdouble#
+ * #type = npy_byte, npy_short, npy_int, npy_long, npy_longlong,
+ * npy_ubyte, npy_ushort, npy_uint, npy_ulong, npy_ulonglong,
+ * npy_half, npy_float, npy_double, npy_longdouble,
+ * npy_cfloat, npy_cdouble, npy_clongdouble#
+ * #temptype = npy_byte, npy_short, npy_int, npy_long, npy_longlong,
+ * npy_ubyte, npy_ushort, npy_uint, npy_ulong, npy_ulonglong,
+ * npy_float, npy_float, npy_double, npy_longdouble,
+ * npy_float, npy_double, npy_longdouble#
* #to = ,,,,,
* ,,,,,
* npy_float_to_half,,,,
@@ -131,44 +135,44 @@ static void
while (count--) {
#if !@complex@
# if @nop@ == 1
- *(npy_@name@ *)data_out = @to@(@from@(*(npy_@name@ *)data0) +
- @from@(*(npy_@name@ *)data_out));
+ *(@type@ *)data_out = @to@(@from@(*(@type@ *)data0) +
+ @from@(*(@type@ *)data_out));
data0 += stride0;
data_out += stride_out;
# elif @nop@ == 2
- *(npy_@name@ *)data_out = @to@(@from@(*(npy_@name@ *)data0) *
- @from@(*(npy_@name@ *)data1) +
- @from@(*(npy_@name@ *)data_out));
+ *(@type@ *)data_out = @to@(@from@(*(@type@ *)data0) *
+ @from@(*(@type@ *)data1) +
+ @from@(*(@type@ *)data_out));
data0 += stride0;
data1 += stride1;
data_out += stride_out;
# elif @nop@ == 3
- *(npy_@name@ *)data_out = @to@(@from@(*(npy_@name@ *)data0) *
- @from@(*(npy_@name@ *)data1) *
- @from@(*(npy_@name@ *)data2) +
- @from@(*(npy_@name@ *)data_out));
+ *(@type@ *)data_out = @to@(@from@(*(@type@ *)data0) *
+ @from@(*(@type@ *)data1) *
+ @from@(*(@type@ *)data2) +
+ @from@(*(@type@ *)data_out));
data0 += stride0;
data1 += stride1;
data2 += stride2;
data_out += stride_out;
# else
- npy_@temp@ temp = @from@(*(npy_@name@ *)dataptr[0]);
+ @temptype@ temp = @from@(*(@type@ *)dataptr[0]);
int i;
for (i = 1; i < nop; ++i) {
- temp *= @from@(*(npy_@name@ *)dataptr[i]);
+ temp *= @from@(*(@type@ *)dataptr[i]);
}
- *(npy_@name@ *)dataptr[nop] = @to@(temp +
- @from@(*(npy_@name@ *)dataptr[i]));
+ *(@type@ *)dataptr[nop] = @to@(temp +
+ @from@(*(@type@ *)dataptr[i]));
for (i = 0; i <= nop; ++i) {
dataptr[i] += strides[i];