diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-06-22 23:44:33 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-06-22 23:44:33 +0000 |
commit | 696518364d950c63fc64ab026200c172b05342ee (patch) | |
tree | 256c5f13d2bb2037dfedc2306f3be2739e504262 /numpy | |
parent | bfd42747a6c3c35f2eb612490a50a2173ca945d9 (diff) | |
download | numpy-696518364d950c63fc64ab026200c172b05342ee.tar.gz |
Fix the problems with SciPy.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/include/numpy/arrayobject.h | 3 | ||||
-rw-r--r-- | numpy/core/src/arrayobject.c | 40 |
2 files changed, 4 insertions, 39 deletions
diff --git a/numpy/core/include/numpy/arrayobject.h b/numpy/core/include/numpy/arrayobject.h index d38c85845..7faf44c49 100644 --- a/numpy/core/include/numpy/arrayobject.h +++ b/numpy/core/include/numpy/arrayobject.h @@ -1060,9 +1060,10 @@ typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *); /* Size of internal buffers used for alignment */ /* Make BUFSIZE a multiple of sizeof(cdouble) -- ususally 16 */ /* So that ufunc buffers are aligned */ -#define PyArray_BUFSIZE 10000 #define PyArray_MIN_BUFSIZE sizeof(cdouble) #define PyArray_MAX_BUFSIZE sizeof(cdouble)*1000000 +#define PyArray_BUFSIZE 10000 + /* * C API: consists of Macros and functions. The MACROS are defined here. diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c index e89dcf8cc..a4eca38b6 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -6728,17 +6728,12 @@ _broadcast_cast(PyArrayObject *out, PyArrayObject *in, maxaxis = PyArray_RemoveLargest(multi); if (maxaxis < 0) return -1; maxdim = multi->dimensions[maxaxis]; - buffers[0] = malloc(PyArray_BUFSIZE*delsize); + buffers[0] = malloc(PyArray_BUFSIZE*(delsize+selsize)); if (buffers[0] == NULL) { PyErr_NoMemory(); return -1; } - buffers[1] = malloc(PyArray_BUFSIZE*selsize); - if (buffers[1] == NULL) { - PyErr_NoMemory(); - free(buffers[0]); - return -1; - } + buffers[1] = buffers[0] + PyArray_BUFSIZE*delsize; if (out->descr->hasobject == 1) memset(buffers[0], 0, PyArray_BUFSIZE*delsize); if (in->descr->hasobject == 1) @@ -6764,7 +6759,6 @@ _broadcast_cast(PyArrayObject *out, PyArrayObject *in, } Py_DECREF(multi); free(buffers[0]); - free(buffers[1]); return 0; } @@ -6810,36 +6804,6 @@ PyArray_CastTo(PyArrayObject *out, PyArrayObject *mp) iswap = PyArray_ISBYTESWAPPED(mp); oswap = PyArray_ISBYTESWAPPED(out); - if (same && mpsize < PyArray_BUFSIZE) { - PyArrayObject *mp2, *out2; - if (!PyArray_ISCARRAY_RO(mp)) { - mp2 = (PyArrayObject *)PyArray_NewCopy(mp, - PyArray_CORDER); - } - else { - mp2 = mp; - Py_INCREF(mp2); - } - if (mp2 == NULL) return -1; - if (!PyArray_ISCARRAY(out)) { - out2 = (PyArrayObject *)PyArray_NewCopy(out, - PyArray_CORDER); - } - else { - out2 = out; - Py_INCREF(out2); - } - if (out2 == NULL) { Py_DECREF(mp2); return -1;} - if (iswap) byte_swap_vector(mp2->data, mpsize, - PyArray_ITEMSIZE(mp2)); - castfunc(mp2->data, out2->data, mpsize, mp2, out2); - if (oswap) byte_swap_vector(out2->data, mpsize, - PyArray_ITEMSIZE(out2)); - Py_DECREF(out2); - Py_DECREF(mp2); - return 0; - } - return _broadcast_cast(out, mp, castfunc, iswap, oswap); } |