[Numpy-svn] r2812 - in trunk/numpy/core: blasdot src
numpy-svn at scipy.org
numpy-svn at scipy.org
Wed Jul 12 16:39:17 EDT 2006
Author: oliphant
Date: 2006-07-12 15:39:13 -0500 (Wed, 12 Jul 2006)
New Revision: 2812
Modified:
trunk/numpy/core/blasdot/_dotblas.c
trunk/numpy/core/src/multiarraymodule.c
Log:
Fix ticket #177
Modified: trunk/numpy/core/blasdot/_dotblas.c
===================================================================
--- trunk/numpy/core/blasdot/_dotblas.c 2006-07-12 19:04:25 UTC (rev 2811)
+++ trunk/numpy/core/blasdot/_dotblas.c 2006-07-12 20:39:13 UTC (rev 2812)
@@ -343,7 +343,6 @@
subtype = ap1->ob_type;
}
- if (l==0) nd = 0;
ret = (PyArrayObject *)PyArray_New(subtype, nd, dimensions,
typenum, NULL, NULL, 0, 0,
(PyObject *)
Modified: trunk/numpy/core/src/multiarraymodule.c
===================================================================
--- trunk/numpy/core/src/multiarraymodule.c 2006-07-12 19:04:25 UTC (rev 2811)
+++ trunk/numpy/core/src/multiarraymodule.c 2006-07-12 20:39:13 UTC (rev 2812)
@@ -2712,9 +2712,15 @@
ret = new_array_for_sum(ap1, ap2, nd, dimensions, typenum);
if (ret == NULL) goto fail;
- /* Ensure that multiarray.dot([],[]) -> 0 */
- memset(PyArray_DATA(ret), 0, PyArray_ITEMSIZE(ret));
+ /* Ensure that multiarray.dot(<Nx0>,<0xM>) -> zeros((N,M)) */
+ if (PyArray_SIZE(ap1) == 0 && PyArray_SIZE(ap2) == 0) {
+ memset(PyArray_DATA(ret), 0, PyArray_NBYTES(ret));
+ }
+ else { /* Ensure that multiarray.dot([],[]) -> 0 */
+ memset(PyArray_DATA(ret), 0, PyArray_ITEMSIZE(ret));
+ }
+
dot = ret->descr->f->dotfunc;
if (dot == NULL) {
PyErr_SetString(PyExc_ValueError,
More information about the Numpy-svn
mailing list