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, the '*' operator was interpreted as a matrix multiplication >>> a*a array([[ 1., 0., 0.], [ 0., 1., 16.], [ 0., 0., 1.]]) The return types of zeros() and eye() are both arrays. The even weird thing happened later. When I do the same thing in another program (obtaining an adjacency matrix and computing graph powers), my "matrix" was considered as an ''array." So, why could an element assignment turn an array into a matrix? And sometimes not? Cheers, Forrest
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion