Re: [Numpy-discussion] an array become a matrix after an element assignment

2011-04-16 Thread Forrest Sheng Bao
Oh yeah, my bad. Forget about it. I guess I was too tired. Cheers, Forrest On Sat, Apr 16, 2011 at 10:47 PM, Nathaniel Smith wrote: > On Sat, Apr 16, 2011 at 8:39 PM, Forrest Sheng Bao > wrote: > >>>> a=zeros((3,3)) + eye(3) > >>>> a*a > > array(

[Numpy-discussion] an array become a matrix after an element assignment

2011-04-16 Thread Forrest Sheng Bao
hi, I encountered a very weird problem tonight. First I created an array and did element-wise multiplication on it: >>> a=zeros((3,3)) + eye(3) >>> a*a array([[ 1., 0., 0.], [ 0., 1., 0.], [ 0., 0., 1.]]) Then i assigned a value to one of the element: >>> a[1,2]=4 Finally,