[Numpy-svn] r3595 - trunk/numpy/core

numpy-svn@scip... numpy-svn@scip...
Sat Mar 24 18:14:10 CDT 2007


Author: charris
Date: 2007-03-24 18:14:07 -0500 (Sat, 24 Mar 2007)
New Revision: 3595

Modified:
   trunk/numpy/core/defmatrix.py
Log:
Fix matrix multiply to return error when has is a 1-D vector. Fixes ticket #473

Modified: trunk/numpy/core/defmatrix.py
===================================================================
--- trunk/numpy/core/defmatrix.py	2007-03-24 20:34:05 UTC (rev 3594)
+++ trunk/numpy/core/defmatrix.py	2007-03-24 23:14:07 UTC (rev 3595)
@@ -154,11 +154,12 @@
 
 
     def __mul__(self, other):
-        if isinstance(other, N.ndarray) or N.isscalar(other) or \
-               not hasattr(other, '__rmul__'):
-            return N.dot(self, other)
-        else:
+        try :
+            rhs = asmatrix(other)
+        except :
             return NotImplemented
+        else :
+            return N.dot(self, rhs)
 
     def __rmul__(self, other):
         return N.dot(other, self)



More information about the Numpy-svn mailing list