Re: [Numpy-discussion] Scalar values with a matrix

2007-01-02 Thread Sven Schreiber
Charles R Harris schrieb: > > mat(5) is a 1x1 matrix: > > In [5]: mat(5) > Out[5]: matrix([[5]]) > > so the error is valid. If you want to do a scalar multiply try > > In [6]: amat*5 > Out[6]: > matrix([[ 0, 5, 10, 15], > [20, 25, 30, 35], > [40, 45, 50, 55]]) Or you can do m

Re: [Numpy-discussion] Scalar values with a matrix

2007-01-01 Thread Charles R Harris
On 1/1/07, Colin J. Williams <[EMAIL PROTECTED]> wrote: What is the best way to treat scalar values from a matrix? It seems that it's best to treat them as a simple Python values and not to leave them wrapped up in the ndarray structure. I would welcome advice. The problem is illustrated belo

[Numpy-discussion] Scalar values with a matrix

2007-01-01 Thread Colin J. Williams
What is the best way to treat scalar values from a matrix? It seems that it's best to treat them as a simple Python values and not to leave them wrapped up in the ndarray structure. I would welcome advice. The problem is illustrated below. Colin W. # tMul.py import numpy.core as _n a= _n.arang