Re: [Numpy-discussion] puzzle: generate index with many ranges

2009-02-01 Thread Raik Gruenberg
ning so that the cumsum starts with zero. > (Maybe there is a cleaner way to do that.) > > This does create a second array (via the repeat) that is the same > length as the result. If that uses too much memory, you could break > up the repeat and update of c into segments usi

Re: [Numpy-discussion] puzzle: generate index with many ranges

2009-01-30 Thread Raik Gruenberg
Pierre GM wrote: > On Jan 30, 2009, at 1:11 PM, Raik Gruenberg wrote: > >> Mhm, I got this far. But how do I get from here to a single index >> array >> >> [ 4, 5, 6, ... 10, 0, 1, 2, 3, 11, 12, 13, 14 ] ? > > np.concatenate([np.arange(aa,bb) for (aa,

Re: [Numpy-discussion] puzzle: generate index with many ranges

2009-01-30 Thread Raik Gruenberg
Jim Vickroy wrote: > Raik Gruenberg wrote: >> Hi there, >> >> perhaps someone has a bright idea for this one: >> >> I want to concatenate ranges of numbers into a single array (for indexing). >> So I >> have generated an array "a" with starti

[Numpy-discussion] puzzle: generate index with many ranges

2009-01-30 Thread Raik Gruenberg
Hi there, perhaps someone has a bright idea for this one: I want to concatenate ranges of numbers into a single array (for indexing). So I have generated an array "a" with starting positions, for example: a = [4, 0, 11] I have an array b with stop positions: b = [11, 4, 15] and I would like t