Hi Arnar, On 9/17/07, Arnar Flatberg <[EMAIL PROTECTED]> wrote: > > Hi list > A pretty common use (for me) is to create arrays at the beginning of > my code and then fill in parts as I go along. Today, my code hit a > segmentation fault. The error was that an index-vector ,that usually > is a list with several members, now contained only one member and I > tried to insert a 1-dim vector. > > Here is a short example of what went wrong: > > Python 2.5.1 (r251:54863, May 2 2007, 16:56:35) > [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import numpy as n > >>> n.__version__ > '1.0.1' > >>> a = n.random.rand(4,2) > >>> a > array([[ 0.79561255, 0.4932522 ], > [ 0.84008255, 0.88258233], > [ 0.35143166, 0.82214487], > [ 0.12490114, 0.15799074]]) > > Let us insert [2,2] into the first row. > Correct use: > >>> a[0,:] = [2,2] > >>> a > array([[ 2. , 2. ], > [ 0.84008255, 0.88258233], > [ 0.35143166, 0.82214487], > [ 0.12490114, 0.15799074]]) > or: > a[[0],:] = [[2,2]] > > However, when I tried to to insert a 1-dim array with a 'two-dim' > index things went wrong: > >>> a[[0],:] = [2,2] > Segmentation fault
I don't see that here. Can you try a more recent version of Numpy? 1.0.1 is pretty old. Chuck
_______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
