summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-07-12 20:39:13 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-07-12 20:39:13 +0000
commite30882f573121d69bfbc86c83f704c8b4657659c (patch)
treed81825e7ec13e053bc66263ae55d8bb507fcb6b4 /numpy
parent1a9ba98fb2f0aa0475d12d3f8007e851525ccb30 (diff)
downloadnumpy-e30882f573121d69bfbc86c83f704c8b4657659c.tar.gz
Fix ticket #177
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/blasdot/_dotblas.c1
-rw-r--r--numpy/core/src/multiarraymodule.c10
2 files changed, 8 insertions, 3 deletions
diff --git a/numpy/core/blasdot/_dotblas.c b/numpy/core/blasdot/_dotblas.c
index 89ff6a353..a6dcd98c9 100644
--- a/numpy/core/blasdot/_dotblas.c
+++ b/numpy/core/blasdot/_dotblas.c
@@ -343,7 +343,6 @@ dotblas_matrixproduct(PyObject *dummy, PyObject *args)
subtype = ap1->ob_type;
}
- if (l==0) nd = 0;
ret = (PyArrayObject *)PyArray_New(subtype, nd, dimensions,
typenum, NULL, NULL, 0, 0,
(PyObject *)
diff --git a/numpy/core/src/multiarraymodule.c b/numpy/core/src/multiarraymodule.c
index bd2c1f2b2..42b699ed9 100644
--- a/numpy/core/src/multiarraymodule.c
+++ b/numpy/core/src/multiarraymodule.c
@@ -2712,8 +2712,14 @@ PyArray_MatrixProduct(PyObject *op1, PyObject *op2)
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) {