summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-07-06 06:57:03 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-07-06 06:57:03 +0000
commit485f171d57748773f8f8d162e89cb668cfc55c11 (patch)
tree7763641a34502a816ce759204cce2d968fcd35be /numpy
parent823ca7e3c354849238f15f1117f7cc8911933fb8 (diff)
downloadnumpy-485f171d57748773f8f8d162e89cb668cfc55c11.tar.gz
Fix buffered reduce, accumulate, and reduceat.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/include/numpy/arrayobject.h2
-rw-r--r--numpy/core/src/ufuncobject.c5
-rw-r--r--numpy/linalg/linalg.py2
3 files changed, 7 insertions, 2 deletions
diff --git a/numpy/core/include/numpy/arrayobject.h b/numpy/core/include/numpy/arrayobject.h
index 438b2c5a3..e0726bb7c 100644
--- a/numpy/core/include/numpy/arrayobject.h
+++ b/numpy/core/include/numpy/arrayobject.h
@@ -1604,7 +1604,7 @@ typedef struct {
} while(0)
/* Copy should always return contiguous array */
-#define PyArray_Copy(obj) PyArray_NewCopy(obj, 0)
+#define PyArray_Copy(obj) PyArray_NewCopy(obj, PyArray_CORDER)
#define PyArray_FromObject(op, type, min_depth, max_depth) \
PyArray_FromAny(op, PyArray_DescrFromType(type), min_depth, \
diff --git a/numpy/core/src/ufuncobject.c b/numpy/core/src/ufuncobject.c
index 74a24e78b..cf6140e10 100644
--- a/numpy/core/src/ufuncobject.c
+++ b/numpy/core/src/ufuncobject.c
@@ -2097,6 +2097,8 @@ PyUFunc_Reduce(PyUFuncObject *self, PyArrayObject *arr, int axis, int otype)
loop->function((char **)loop->bufptr,
&i,
loop->steps, loop->funcdata);
+ loop->bufptr[1] += loop->steps[1]*i;
+ loop->bufptr[2] += loop->steps[2]*i;
UFUNC_CHECK_ERROR(loop);
}
PyArray_ITER_NEXT(loop->it);
@@ -2239,6 +2241,8 @@ PyUFunc_Accumulate(PyUFuncObject *self, PyArrayObject *arr, int axis,
loop->function((char **)loop->bufptr,
&i,
loop->steps, loop->funcdata);
+ loop->bufptr[1] += loop->steps[1]*i;
+ loop->bufptr[2] += loop->steps[2]*i;
UFUNC_CHECK_ERROR(loop);
}
PyArray_ITER_NEXT(loop->it);
@@ -2386,6 +2390,7 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind,
&j, loop->steps,
loop->funcdata);
UFUNC_CHECK_ERROR(loop);
+ loop->bufptr[1] += j*loop->steps[1];
}
loop->bufptr[1] += loop->ret->strides[axis];
ptr++;
diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py
index bcbcd3f8d..ab593ce93 100644
--- a/numpy/linalg/linalg.py
+++ b/numpy/linalg/linalg.py
@@ -19,7 +19,7 @@ from numpy.core import *
from numpy.lib import *
import lapack_lite
-fortran_int = int32
+fortran_int = intc
# Error object
class LinAlgError(Exception):