Re: [Numpy-discussion] how to efficiently build an array of x, y, z points

2010-03-02 Thread David Goldsmith
On Tue, Mar 2, 2010 at 6:59 PM, Brennan Williams < brennan.willi...@visualreservoir.com> wrote: > David Goldsmith wrote: > > > > On Tue, Mar 2, 2010 at 6:29 PM, Brennan Williams > > > > wrote: > > > > I'm reading a file which contains a grid defini

Re: [Numpy-discussion] how to efficiently build an array of x, y, z points

2010-03-02 Thread Brennan Williams
David Goldsmith wrote: > > > On Tue, Mar 2, 2010 at 6:29 PM, Brennan Williams > > wrote: > > I'm reading a file which contains a grid definition. Each cell in the > grid, apart from having an i,j,k index also has 8 x,y,z coordinates. > I'm

Re: [Numpy-discussion] how to efficiently build an array of x, y, z points

2010-03-02 Thread David Goldsmith
On Tue, Mar 2, 2010 at 6:29 PM, Brennan Williams < brennan.willi...@visualreservoir.com> wrote: > I'm reading a file which contains a grid definition. Each cell in the > grid, apart from having an i,j,k index also has 8 x,y,z coordinates. > I'm reading each set of coordinates into a numpy array. I

[Numpy-discussion] how to efficiently build an array of x, y, z points

2010-03-02 Thread Brennan Williams
I'm reading a file which contains a grid definition. Each cell in the grid, apart from having an i,j,k index also has 8 x,y,z coordinates. I'm reading each set of coordinates into a numpy array. I then want to add/append those coordinates to what will be my large "points" array. Due to the orient

Re: [Numpy-discussion] how to work with numpy.int8 in c

2010-03-02 Thread David Cournapeau
David Cournapeau wrote: > James Bergstra wrote: > >> >> Maybe I'm missing something... but I don't think I want to create an >> array. > > Ah, I misunderstood your question. There are at least two ways: > > PyObject *ret; > ret = PyArrayScalar_New(UInt8); > > Or > > PyObject *ret; > PyArray_D

Re: [Numpy-discussion] how to work with numpy.int8 in c

2010-03-02 Thread Travis Oliphant
PyArray_Scalar Is the one you want. Travis -- (mobile phone of) Travis Oliphant Enthought, Inc. 1-512-536-1057 http://www.enthought.com On Mar 2, 2010, at 6:46 PM, James Bergstra wrote: > On Tue, Mar 2, 2010 at 7:32 PM, David Warde-Farley > wrote: >> >> On 2-Mar-10, at 7:23 PM, James Ber

Re: [Numpy-discussion] how to work with numpy.int8 in c

2010-03-02 Thread David Cournapeau
James Bergstra wrote: > > Maybe I'm missing something... but I don't think I want to create an array. Ah, I misunderstood your question. There are at least two ways: PyObject *ret; ret = PyArrayScalar_New(UInt8); Or PyObject *ret; PyArray_Descr *typecode; typecode = PyArray_DescrFromType

Re: [Numpy-discussion] how to work with numpy.int8 in c

2010-03-02 Thread Christopher Barker
Warren Weckesser wrote: I want to create one of those numpy.int8 guys. >> np.int8 is a type, and so is numpy.ndarray. And they are different. >> There's lots of docs about how to make arrays, but how do I make a >> scalar? ah - I see -- you want to make a numpy scalar, not the s

Re: [Numpy-discussion] how to work with numpy.int8 in c

2010-03-02 Thread Warren Weckesser
James Bergstra wrote: > On Tue, Mar 2, 2010 at 7:18 PM, Warren Weckesser > wrote: > >> James Bergstra wrote: >> >>> On Tue, Mar 2, 2010 at 3:09 PM, Christopher Barker >>> wrote: >>> >>> James Bergstra wrote: > Maybe I'm missing something... but I don't t

Re: [Numpy-discussion] how to work with numpy.int8 in c

2010-03-02 Thread James Bergstra
On Tue, Mar 2, 2010 at 7:32 PM, David Warde-Farley wrote: > > On 2-Mar-10, at 7:23 PM, James Bergstra wrote: > >> Sorry... again... how do I make such a scalar... *in C* ?  What would >> be the recommended C equivalent of this python code?  Are there C >> type-checking functions for instances of t

Re: [Numpy-discussion] how to work with numpy.int8 in c

2010-03-02 Thread David Warde-Farley
On 2-Mar-10, at 7:23 PM, James Bergstra wrote: > Sorry... again... how do I make such a scalar... *in C* ? What would > be the recommended C equivalent of this python code? Are there C > type-checking functions for instances of these objects? Are there C > functions for converting to and from

Re: [Numpy-discussion] how to work with numpy.int8 in c

2010-03-02 Thread James Bergstra
On Tue, Mar 2, 2010 at 7:18 PM, Warren Weckesser wrote: > James Bergstra wrote: >> On Tue, Mar 2, 2010 at 3:09 PM, Christopher Barker >> wrote: >> >>> James Bergstra wrote: >>> Maybe I'm missing something... but I don't think I want to create an array. In [3]: import numpy >>>

Re: [Numpy-discussion] how to work with numpy.int8 in c

2010-03-02 Thread Warren Weckesser
James Bergstra wrote: > On Tue, Mar 2, 2010 at 3:09 PM, Christopher Barker > wrote: > >> James Bergstra wrote: >> >>> Maybe I'm missing something... but I don't think I want to create an array. >>> >>> In [3]: import numpy >>> >>> In [4]: type(numpy.int8()) >>> Out[4]: >>> >>> In [5]: isi

Re: [Numpy-discussion] how to work with numpy.int8 in c

2010-03-02 Thread James Bergstra
On Tue, Mar 2, 2010 at 3:09 PM, Christopher Barker wrote: > James Bergstra wrote: >> Maybe I'm missing something... but I don't think I want to create an array. >> >> In [3]: import numpy >> >> In [4]: type(numpy.int8()) >> Out[4]: >> >> In [5]: isinstance(numpy.int8(), numpy.ndarray) >> Out[5]:

Re: [Numpy-discussion] how to work with numpy.int8 in c

2010-03-02 Thread Christopher Barker
James Bergstra wrote: > Maybe I'm missing something... but I don't think I want to create an array. > > In [3]: import numpy > > In [4]: type(numpy.int8()) > Out[4]: > > In [5]: isinstance(numpy.int8(), numpy.ndarray) > Out[5]: False right, it's a type object: In [13]: type(np.uint8) Out[13]:

Re: [Numpy-discussion] how to work with numpy.int8 in c

2010-03-02 Thread James Bergstra
On Mon, Mar 1, 2010 at 1:44 AM, David Cournapeau wrote: > On Mon, Mar 1, 2010 at 1:35 PM, James Bergstra > wrote: >> Could someone point me to documentation (or even numpy src) that shows >> how to allocate a numpy.int8 in C, or check to see if a PyObject is a >> numpy.int8? > > In numpy, the typ

[Numpy-discussion] EPD 6.1 & Upcoming Webinars

2010-03-02 Thread Amenity Applewhite
March is shaping up to be as busy as ever: planning SciPy 2010 (http://conference.scipy.org/scipy2010), two great webinars...and a new release of EPD! * Enthought Python Distribution 6.1 * In EPD 6.1, NumPy and SciPy are dynamically linked against the MKL linear algebra routines. This allows EPD

Re: [Numpy-discussion] Iterative Matrix Multiplication

2010-03-02 Thread Friedrich Romstedt
I'm learning too by answering your questions. 2010/3/2 Ian Mallett : > 1  v_array #array of beautifully transformed vertices from last step > 2  n_array #array of beautifully transformed normals from last step > 3  f_list  #list of vec4s, where every vec4 is three vertex indices and a > 4