On Thu, Mar 5, 2009 at 10:40 AM, Robin <robi...@gmail.com> wrote:
> Hi,
>
> I have an indexing problem, and I know it's a bit lazy to ask the
> list, sometime when people do interesting tricks come up so I hope no
> one minds!
>
> I have a 2D array X.shape = (a,b)
>
> and I want to change it into new array which is shape (2,(a*b)) which
> has the following form:
> [  X[0,0], X[0,1]
>   X[1,0], X[1,1]
>   X[2,0], X[2,1]
>   ....
>   X[a,0], X[a,1]
>   X[0,1], X[0,2]
>   X[1,1], X[1,2]
> ...
> ]
>

Ah, so it's a bit easier than I thought at first glance:

X[ ix_( (b-1)*range(a), [0,1]) ]
does the trick I think

Sorry for the noise.

Robin
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to