summaryrefslogtreecommitdiff
path: root/numpy/core/src/multiarraymodule.c
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/core/src/multiarraymodule.c
parent1a9ba98fb2f0aa0475d12d3f8007e851525ccb30 (diff)
downloadnumpy-e30882f573121d69bfbc86c83f704c8b4657659c.tar.gz
Fix ticket #177
Diffstat (limited to 'numpy/core/src/multiarraymodule.c')
-rw-r--r--numpy/core/src/multiarraymodule.c10
1 files changed, 8 insertions, 2 deletions
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) {