[Numpy-discussion] Beginer question about Boost Python Numeric

2010-06-18 Thread Yongning Zhu
Hi, I am new to boost python, thanks for the list, and hopefully, I will find some one to help me. I am adding the boost python example: #include #include // sets the first element in a 2d numeric array void set_first_element(::boost::python::numeric::array& y, float value) { y[::boost::pyt

[Numpy-discussion] SciPy docs marathon: a little more info

2010-06-18 Thread David Goldsmith
On Mon, Jun 14, 2010 at 2:05 AM, David Goldsmith wrote: > Hi, all! The scipy doc marathon has gotten off to a very slow start this > summer. We are producing less than 1000 words a week, perhaps because > many universities are still finishing up spring classes. So, this is > a second appeal to

Re: [Numpy-discussion] checking for array type in C extension

2010-06-18 Thread Robert Kern
On Fri, Jun 18, 2010 at 10:22, Berthold Hoellmann wrote: > I now use 'sizeof' and 'c_int' from ctypes tp construct the dtype > description: > >  dtype('i%d' % sizeof(c_int)) > > Is there a way to avoid the usage of "ctypes" by using information > provided by numpy? np.intc -- Robert Kern "I h

Re: [Numpy-discussion] checking for array type in C extension

2010-06-18 Thread Berthold Hoellmann
Robert Kern writes: > On Fri, Jun 18, 2010 at 09:43, Berthold Hoellmann > wrote: >> Pauli Virtanen writes: >> >>> pe, 2010-06-18 kello 12:49 +0200, Berthold Hoellmann kirjoitti: >>> [clip] tst.inttestfunc(np.array((1,2),dtype=np.int)) tst.inttestfunc(np.array((1,2),dtype=np.int8)) >>>

Re: [Numpy-discussion] checking for array type in C extension

2010-06-18 Thread Pauli Virtanen
pe, 2010-06-18 kello 16:43 +0200, Berthold Hoellmann kirjoitti: [clip] > The documentation (i refere to NumPy User Guide, Release 1.5.0.dev8106) > claims that numpy.int is platform int and that "NPY_INT" is a C based > name, thus referring to int also. So if I want to use "int" platform > independe

Re: [Numpy-discussion] checking for array type in C extension

2010-06-18 Thread Robert Kern
On Fri, Jun 18, 2010 at 09:43, Berthold Hoellmann wrote: > Pauli Virtanen writes: > >> pe, 2010-06-18 kello 12:49 +0200, Berthold Hoellmann kirjoitti: >> [clip] >>> tst.inttestfunc(np.array((1,2),dtype=np.int)) >>> tst.inttestfunc(np.array((1,2),dtype=np.int8)) >>> tst.inttestfunc(np.array((1,2),

Re: [Numpy-discussion] reading big-endian uint16 into array on little-endian machine

2010-06-18 Thread Robert Kern
On Fri, Jun 18, 2010 at 09:39, Benjamin Root wrote: > Just for my own knowledge, would Robert's suggestion of using '>i2' as the > dtype be considered the "best" solution, mostly because of its simplicity, > but also because it does not assume the endian-ness of the host computer? It does come w

Re: [Numpy-discussion] checking for array type in C extension

2010-06-18 Thread Berthold Hoellmann
Pauli Virtanen writes: > pe, 2010-06-18 kello 12:49 +0200, Berthold Hoellmann kirjoitti: > [clip] >> tst.inttestfunc(np.array((1,2),dtype=np.int)) >> tst.inttestfunc(np.array((1,2),dtype=np.int8)) >> tst.inttestfunc(np.array((1,2),dtype=np.int16)) >> tst.inttestfunc(np.array((1,2),dtype=np.int32)

Re: [Numpy-discussion] reading big-endian uint16 into array on little-endian machine

2010-06-18 Thread Benjamin Root
On Fri, Jun 18, 2010 at 6:15 AM, Sturla Molden wrote: > Den 17.06.2010 16:29, skrev greg whittier: > > I have files (from an external source) that contain ~10 GB of > > big-endian uint16's that I need to read into a series of arrays. What > > I'm doing now is > > > > import numpy as np > > impor

Re: [Numpy-discussion] checking for array type in C extension

2010-06-18 Thread Pauli Virtanen
pe, 2010-06-18 kello 12:49 +0200, Berthold Hoellmann kirjoitti: [clip] > tst.inttestfunc(np.array((1,2),dtype=np.int)) > tst.inttestfunc(np.array((1,2),dtype=np.int8)) > tst.inttestfunc(np.array((1,2),dtype=np.int16)) > tst.inttestfunc(np.array((1,2),dtype=np.int32)) > tst.inttestfunc(np.array((1,2

Re: [Numpy-discussion] reading big-endian uint16 into array on little-endian machine

2010-06-18 Thread Sturla Molden
Den 17.06.2010 16:29, skrev greg whittier: > I have files (from an external source) that contain ~10 GB of > big-endian uint16's that I need to read into a series of arrays. What > I'm doing now is > > import numpy as np > import struct > > fd = open('file.raw', 'rb') > > for n in range(1) >

[Numpy-discussion] checking for array type in C extension

2010-06-18 Thread Berthold Hoellmann
Hello, I do have problems for checking for integer array types in a C extension under Windows. I've put together a small example to illustrate the problem: h...@pc090498 ~/pytest $ cat tst.c #include #include "Python.h" #i