[Numpy-svn] r2832 - in trunk/numpy: core/include/numpy core/src linalg

numpy-svn at scipy.org numpy-svn at scipy.org
Tue Jul 18 04:10:36 EDT 2006


Author: oliphant
Date: 2006-07-18 03:10:31 -0500 (Tue, 18 Jul 2006)
New Revision: 2832

Modified:
   trunk/numpy/core/include/numpy/arrayobject.h
   trunk/numpy/core/src/arrayobject.c
   trunk/numpy/core/src/multiarraymodule.c
   trunk/numpy/linalg/linalg.py
Log:
Fix ticket #178 which was an error whenever multiple buffers needed to be used to cast.

Modified: trunk/numpy/core/include/numpy/arrayobject.h
===================================================================
--- trunk/numpy/core/include/numpy/arrayobject.h	2006-07-18 07:14:06 UTC (rev 2831)
+++ trunk/numpy/core/include/numpy/arrayobject.h	2006-07-18 08:10:31 UTC (rev 2832)
@@ -964,7 +964,8 @@
 /* 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))

Modified: trunk/numpy/core/src/arrayobject.c
===================================================================
--- trunk/numpy/core/src/arrayobject.c	2006-07-18 07:14:06 UTC (rev 2831)
+++ trunk/numpy/core/src/arrayobject.c	2006-07-18 08:10:31 UTC (rev 2832)
@@ -7098,8 +7098,8 @@
 				       sptr+i*sstride, sstride, selsize, 
 				       sswap, scopyfunc,
 				       newN, buffers, bufsize, castfunc, dest, src);
+		i += newN;
 		N -= bufsize;
-		i++;
 	}
 	return;
 }

Modified: trunk/numpy/core/src/multiarraymodule.c
===================================================================
--- trunk/numpy/core/src/multiarraymodule.c	2006-07-18 07:14:06 UTC (rev 2831)
+++ trunk/numpy/core/src/multiarraymodule.c	2006-07-18 08:10:31 UTC (rev 2832)
@@ -6383,6 +6383,11 @@
 	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);

Modified: trunk/numpy/linalg/linalg.py
===================================================================
--- trunk/numpy/linalg/linalg.py	2006-07-18 07:14:06 UTC (rev 2831)
+++ trunk/numpy/linalg/linalg.py	2006-07-18 08:10:31 UTC (rev 2832)
@@ -154,7 +154,7 @@
     _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 @@
     _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 @@
     _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 @@
     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)




More information about the Numpy-svn mailing list