Re: [Numpy-discussion] Example Usage of Neighborhood Iterator in Cython

2011-10-17 Thread T J
On Mon, Oct 17, 2011 at 12:45 PM, eat wrote: > > Just wondering what are the main benefits, of your approach, comparing to > simple: As I hinted, my goal was not to construct a "practical" example, but rather, to demonstrate how to use the neighborhood iterator in Cython. Roll and mod are quite

Re: [Numpy-discussion] Example Usage of Neighborhood Iterator in Cython

2011-10-17 Thread eat
Hi, On Mon, Oct 17, 2011 at 9:19 PM, T J wrote: > I recently put together a Cython example which uses the neighborhood > iterator. It was trickier than I thought it would be, so I thought to > share it with the community. The function takes a 1-dimensional array > and returns a 2-dimensional a

Re: [Numpy-discussion] float128 in fact float80

2011-10-17 Thread Matthew Brett
Hi, On Sun, Oct 16, 2011 at 6:22 PM, Charles R Harris wrote: > > > On Sun, Oct 16, 2011 at 6:13 PM, Nathaniel Smith wrote: >> >> On Sun, Oct 16, 2011 at 4:29 PM, Charles R Harris >> wrote: >> > On Sun, Oct 16, 2011 at 4:16 PM, Nathaniel Smith wrote: >> >> I understand the argument that you don

[Numpy-discussion] Example Usage of Neighborhood Iterator in Cython

2011-10-17 Thread T J
I recently put together a Cython example which uses the neighborhood iterator. It was trickier than I thought it would be, so I thought to share it with the community. The function takes a 1-dimensional array and returns a 2-dimensional array of neighborhoods in the original area. This is somewha

Re: [Numpy-discussion] yet another indexing question

2011-10-17 Thread Chris.Barker
On 10/14/11 5:04 AM, Neal Becker wrote: > suppose I have: > > In [10]: u > Out[10]: > array([[0, 1, 2, 3, 4], > [5, 6, 7, 8, 9]]) > > And I have a vector v: > v = np.array ((0,1,0,1,0)) > > I want to form an output vector which selects items from u where v is the > index > of the row of

Re: [Numpy-discussion] dtyping with .astype()

2011-10-17 Thread josef . pktd
On Mon, Oct 17, 2011 at 10:18 AM, Pauli Virtanen wrote: > 17.10.2011 15:48, josef.p...@gmail.com kirjoitti: >> On Mon, Oct 17, 2011 at 6:17 AM, Pauli Virtanen wrote: > [clip] What am I missing? How to do this? >>> >>> np.rec.fromarrays(arr.T, dtype=dt) >> >> y.astype(float16).view(dt) > > I

Re: [Numpy-discussion] dtyping with .astype()

2011-10-17 Thread Pauli Virtanen
17.10.2011 15:48, josef.p...@gmail.com kirjoitti: > On Mon, Oct 17, 2011 at 6:17 AM, Pauli Virtanen wrote: [clip] >>> What am I missing? How to do this? >> >> np.rec.fromarrays(arr.T, dtype=dt) > > y.astype(float16).view(dt) I think this will give surprises if the original array is not in C-orde

Re: [Numpy-discussion] dtyping with .astype()

2011-10-17 Thread josef . pktd
On Mon, Oct 17, 2011 at 6:17 AM, Pauli Virtanen wrote: > 13.10.2011 12:59, Alex van der Spek kirjoitti: >> gives me a confusing result. I only asked to name the columns and change >> their >> types to half precision floats. > > Structured arrays shouldn't be thought as an array with named columns

Re: [Numpy-discussion] float128 in fact float80

2011-10-17 Thread Charles R Harris
On Mon, Oct 17, 2011 at 2:20 AM, Dag Sverre Seljebotn < d.s.seljeb...@astro.uio.no> wrote: > On 10/17/2011 03:22 AM, Charles R Harris wrote: > > > > > > On Sun, Oct 16, 2011 at 6:13 PM, Nathaniel Smith > > wrote: > > > > The solution is just to call it 'longdouble', whi

Re: [Numpy-discussion] dtyping with .astype()

2011-10-17 Thread Pauli Virtanen
13.10.2011 12:59, Alex van der Spek kirjoitti: > gives me a confusing result. I only asked to name the columns and change > their > types to half precision floats. Structured arrays shouldn't be thought as an array with named columns, as they are somewhat different. > What am I missing? How to

[Numpy-discussion] dtyping with .astype()

2011-10-17 Thread Alex van der Spek
Beginner's question? I have this dictionary dtypes of names and types: >>>dtypes {'names': ['col1', 'col2', 'col3', 'col4', 'col5'], 'formats': [, , , , ]} and this array y >>> y array([[ 0, 1, 2, 3, 4], [ 5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19],

Re: [Numpy-discussion] float128 in fact float80

2011-10-17 Thread Dag Sverre Seljebotn
On 10/17/2011 03:22 AM, Charles R Harris wrote: > > > On Sun, Oct 16, 2011 at 6:13 PM, Nathaniel Smith > wrote: > > The solution is just to call it 'longdouble', which clearly > communicates 'this does some quirky thing that depends on your C > compiler and archi