|
From: Soeren S. <pyt...@nn...> - 2005-07-27 22:02:22
|
On Mon, 2005-07-25 at 22:39 -0700, Robert Kern wrote: > Soeren Sonnenburg wrote: > > [snip] > > > In my eyes 'array broadcasting' is confusing and should rather be in a > > function like meshgrid and instead a*b should return > > matrixmultiply(a,b) ... > > Spend some time with it. It will probably grow on you. Numeric is not [...] > Again, Numeric is a package for arrays, not just linear algebra. Please > spend some more time with Python and Numeric before deciding that they > must be changed to match your preconceptions. I realize that I just need plain matrices and operations on them so I am probably better off with cvxopt at that point. > > I realize that with lists it is ok to grow them via slicing. > > > > x=[] > > x[0]=1 > > IndexError: list assignment index out of range > > x[0:0]=[1] > > x > > [1] > > > > that seems not to work with numarray ... or ? > > > > y=array() > > y[0]=1 > > TypeError: object does not support item assignment > > y[0:0]=array([1]) > > TypeError: object does not support item assignment > > Python lists are designed to grow dynamically. Their memory is > preallocated so that growing them is on average pretty cheap. Numeric > arrays are not, nor will they be. Well I don't claim that this is/must be efficient. It is just what I would have expected to work if I use standard python arrays and now numarrays. Soeren. |