diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-07-18 08:10:31 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-07-18 08:10:31 +0000 |
commit | 958601cb55c15930a443057d61230a6aa5a45c02 (patch) | |
tree | cca97f94cbc8b13204f89b0a975676d05a8aab25 | |
parent | 3acb430d1422a16f9bf705fb31cef2c53b3ba9b0 (diff) | |
download | numpy-958601cb55c15930a443057d61230a6aa5a45c02.tar.gz |
Fix ticket #178 which was an error whenever multiple buffers needed to be used to cast.
-rw-r--r-- | numpy/core/include/numpy/arrayobject.h | 3 | ||||
-rw-r--r-- | numpy/core/src/arrayobject.c | 2 | ||||
-rw-r--r-- | numpy/core/src/multiarraymodule.c | 5 | ||||
-rw-r--r-- | numpy/linalg/linalg.py | 8 |
4 files changed, 12 insertions, 6 deletions
diff --git a/numpy/core/include/numpy/arrayobject.h b/numpy/core/include/numpy/arrayobject.h index 8f4f53bf9..f3db221c5 100644 --- a/numpy/core/include/numpy/arrayobject.h +++ b/numpy/core/include/numpy/arrayobject.h @@ -964,7 +964,8 @@ typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *); /* So that ufunc buffers are aligned */ #define NPY_MIN_BUFSIZE sizeof(cdouble) #define NPY_MAX_BUFSIZE sizeof(cdouble)*1000000 -#define NPY_BUFSIZE 10000 +#define NPY_BUFSIZE 10000 +/* #define NPY_BUFSIZE 80*/ #define PyArray_MAX(a,b) (((a)>(b))?(a):(b)) #define PyArray_MIN(a,b) (((a)<(b))?(a):(b)) diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c index 580932869..53867e1e0 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -7098,8 +7098,8 @@ _strided_buffered_cast(char *dptr, intp dstride, int delsize, int dswap, sptr+i*sstride, sstride, selsize, sswap, scopyfunc, newN, buffers, bufsize, castfunc, dest, src); + i += newN; N -= bufsize; - i++; } return; } diff --git a/numpy/core/src/multiarraymodule.c b/numpy/core/src/multiarraymodule.c index f2368ba88..1c56329c5 100644 --- a/numpy/core/src/multiarraymodule.c +++ b/numpy/core/src/multiarraymodule.c @@ -6383,6 +6383,11 @@ PyMODINIT_FUNC initmultiarray(void) { s = PyInt_FromLong(NPY_ALLOW_THREADS); PyDict_SetItemString(d, "ALLOW_THREADS", s); Py_DECREF(s); + + s = PyInt_FromLong(NPY_BUFSIZE); + PyDict_SetItemString(d, "BUFSIZE", s); + Py_DECREF(s); + Py_INCREF(&PyArray_Type); PyDict_SetItemString(d, "ndarray", (PyObject *)&PyArray_Type); Py_INCREF(&PyArrayIter_Type); diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py index 142de2340..a4b6dc5a7 100644 --- a/numpy/linalg/linalg.py +++ b/numpy/linalg/linalg.py @@ -154,7 +154,7 @@ def cholesky(a): _assertRank2(a) _assertSquareness(a) t, result_t = _commonType(a) - a = _castCopyAndTranspose(t, a) + a = _fastCopyAndTranspose(t, a) m = a.shape[0] n = a.shape[1] if isComplexType(t): @@ -215,7 +215,7 @@ def eigvalsh(a, UPLO='L'): _assertSquareness(a) t, result_t = _commonType(a) real_t = _linalgRealType(t) - a = _castCopyAndTranspose(t, a) + a = _fastCopyAndTranspose(t, a) n = a.shape[0] liwork = 5*n+3 iwork = zeros((liwork,), fortran_int) @@ -319,7 +319,7 @@ def eigh(a, UPLO='L'): _assertSquareness(a) t, result_t = _commonType(a) real_t = _linalgRealType(t) - a = _castCopyAndTranspose(t, a) + a = _fastCopyAndTranspose(t, a) n = a.shape[0] liwork = 5*n+3 iwork = zeros((liwork,), fortran_int) @@ -514,7 +514,7 @@ Singular values less than s[0]*rcond are treated as zero. real_t = _linalgRealType(t) bstar = zeros((ldb,n_rhs),t) bstar[:b.shape[0],:n_rhs] = b.copy() - a, bstar = _castCopyAndTranspose(t, a, bstar) + a, bstar = _fastCopyAndTranspose(t, a, bstar) s = zeros((min(m,n),),real_t) nlvl = max( 0, int( math.log( float(min( m,n ))/2. ) ) + 1 ) iwork = zeros((3*min(m,n)*nlvl+11*min(m,n),), fortran_int) |