[SciPy-user] array += matrix leads to ValueError

Bastian Weber bastian.weber@gmx-topmail...
Fri Dec 19 11:31:33 CST 2008


I just stumbled across the following behaviour:

from scipy import *
a=array([0,1])
m=matrix([0,1])
# this works:
a=a+m
a
#[Out]# matrix([[0, 2]])
a=array([0,1])
# this works too
m+=a
m
#[Out]# matrix([[0, 2]])
# however, this does not work:
a+=m

I get:
<type 'exceptions.ValueError'>: invalid return array shape

Can anyone explain me why it is implemented this way? I mean, it is not
that intuitive.

Bastian


More information about the SciPy-user mailing list