Re: [Numpy-discussion] C-API: multidimensional array indexing?

2016-03-31 Thread mpc
Cool! But I'm having trouble implementing this, could you provide an example on how exactly to do this? I'm not sure how to create the appropriate tuple and how to use it with PyObject_GetItem given an PyArrayObject, unless I'm misunderstood. Much appreciated, Matthew -- View this message in

Re: [Numpy-discussion] c api deprecations with NPY_NO_DEPRECATED_API

2014-03-11 Thread Nathaniel Smith
On 11 Mar 2014 14:25, "Paul Brossier" wrote: > > On 11/03/2014 10:49, Nathaniel Smith wrote: > > On 11 Mar 2014 13:28, "Paul Brossier" > > wrote: > >> If I understand correctly, the current version is the one installed on > >> the user system. So using NPY_API_VERSION would

Re: [Numpy-discussion] c api deprecations with NPY_NO_DEPRECATED_API

2014-03-11 Thread Paul Brossier
On 11/03/2014 10:49, Nathaniel Smith wrote: > On 11 Mar 2014 13:28, "Paul Brossier" > wrote: >> If I understand correctly, the current version is the one installed on >> the user system. So using NPY_API_VERSION would mean "this code should >> work with any version of numpy".

Re: [Numpy-discussion] c api deprecations with NPY_NO_DEPRECATED_API

2014-03-11 Thread Nathaniel Smith
On 11 Mar 2014 13:28, "Paul Brossier" wrote: > If I understand correctly, the current version is the one installed on > the user system. So using NPY_API_VERSION would mean "this code should > work with any version of numpy". I guess this is what I want (I would > even expect this to be the defaul

Re: [Numpy-discussion] c api deprecations with NPY_NO_DEPRECATED_API

2014-03-11 Thread Paul Brossier
On 08/03/2014 19:25, Charles R Harris wrote: > Thanks for your quick reply Charles. > On Sat, Mar 8, 2014 at 2:54 PM, Paul Brossier > wrote: > > > > 2. When defining NPY_NO_DEPRECATED_API, as mentioned in the above > > warning and in the documentation, I get this error

Re: [Numpy-discussion] c api deprecations with NPY_NO_DEPRECATED_API

2014-03-08 Thread Charles R Harris
On Sat, Mar 8, 2014 at 2:54 PM, Paul Brossier wrote: > hi all, > > I'm trying to understand how to use the deprecation mechanism. > > 1. When not defining NPY_NO_DEPRECATED_API, I get warnings (as expected): > > #warning "Using deprecated NumPy API, disable it by #defining > NPY_NO_DEPREC

[Numpy-discussion] c api deprecations with NPY_NO_DEPRECATED_API

2014-03-08 Thread Paul Brossier
hi all, I'm trying to understand how to use the deprecation mechanism. 1. When not defining NPY_NO_DEPRECATED_API, I get warnings (as expected): #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" 2. When defining NPY_NO_DEPRECATED_AP

Re: [Numpy-discussion] c api, ndarray creation

2013-11-05 Thread Sergey Petrov
On Tue, 05 Nov 2013 23:22:37 +0500, Robert Kern wrote:numpy is not a C library. It is a Python extension module. You can use its C API from other Python extension modules, not C main programs. You have not started a Python interpreter or imported the numpy module. Only then will the numpy API be

Re: [Numpy-discussion] c api, ndarray creation

2013-11-05 Thread Sergey Petrov
On Tue, 05 Nov 2013 23:20:45 +0500, Jaime Fernández del Río wrote:On Tue, Nov 5, 2013 at 10:10 AM, Sergey Petrov wrote: Rather stupid question here, but I can't figure out by myself: Why does the following c program segfaults? And how can I avoid it?You need to call import_

Re: [Numpy-discussion] c api, ndarray creation

2013-11-05 Thread Robert Kern
On Tue, Nov 5, 2013 at 6:10 PM, Sergey Petrov wrote: > > Rather stupid question here, but I can't figure out by myself: > Why does the following c program segfaults? And how can I avoid it? > > #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION > > #include > #include > > int main(int argc, char

Re: [Numpy-discussion] c api, ndarray creation

2013-11-05 Thread Jaime Fernández del Río
On Tue, Nov 5, 2013 at 10:10 AM, Sergey Petrov wrote: > Rather stupid question here, but I can't figure out by myself: > Why does the following c program segfaults? And how can I avoid it? > You need to call import_array before using the C-API, see here: http://docs.scipy.org/doc/numpy/user/c-i

[Numpy-discussion] c api, ndarray creation

2013-11-05 Thread Sergey Petrov
Rather stupid question here, but I can't figure out by myself: Why does the following c program segfaults? And how can I avoid it? #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION #include #include int main(int argc, char *argv[]) { int nd=1; npy_intp dims[] = {3}; npy_intp data[] =

[Numpy-discussion] C-API: Subclassing array for numpy 1.7 (with #define NPY_NO_DEPRECATED_API 0x00000007)

2013-03-24 Thread Marc Gronle
Hello together, we embedded Python 3 in a C++ environment. In this application I created a new class, that is a subclass from numpy array. Until now (numpy 1.6 or numpy 1.7 without the deprecation define (NPY_NO_DEPRECATED_API) the typedef for my class describing the object was something like typ

[Numpy-discussion] C api doc shortcomings

2011-08-01 Thread Robert Elsner
Hey Everybody, I noticed that the c-api docs (2.0.dev-72ab385) lack a clear statement what the preferred entry point into the c-api is (from a users point of view). Normally I would expect a sentence or two stating that the api entry point is arrayobject.h (or whatever). Instead the docs ponder ab

Re: [Numpy-discussion] c-api return two arrays

2011-07-29 Thread Yoshi Rokuko
+-- Pauli Virtanen ---+ > Fri, 29 Jul 2011 10:52:12 +0200, Yoshi Rokuko wrote: > [clip] > A, B = mod.meth(C, prob=.95) > > > > is it possible to return two arrays? > > The way to do this in Python is to build a tuple with > Py_BuildValue("OO", A, B) and retur

Re: [Numpy-discussion] c-api return two arrays

2011-07-29 Thread Pauli Virtanen
Fri, 29 Jul 2011 10:52:12 +0200, Yoshi Rokuko wrote: [clip] A, B = mod.meth(C, prob=.95) > > is ith possible to return two arrays? The way to do this in Python is to build a tuple with Py_BuildValue("OO", A, B) and return that. ___ NumPy-Discussi

Re: [Numpy-discussion] c-api return two arrays

2011-07-29 Thread Yoshi Rokuko
+ Peter ---+ > On Fri, Jul 29, 2011 at 9:52 AM, Yoshi Rokuko wrote: > > > > hey, i have an algorithm that computes two matrices like that: > > > > A(i,k) = (x(i,k) + y(i,k))/norm > > B(i,k) = (x(i,k) - y(i,k))/norm > > > > it would be convenient

Re: [Numpy-discussion] c-api return two arrays

2011-07-29 Thread Peter
On Fri, Jul 29, 2011 at 9:52 AM, Yoshi Rokuko wrote: > > hey, i have an algorithm that computes two matrices like that: > > A(i,k) = (x(i,k) + y(i,k))/norm > B(i,k) = (x(i,k) - y(i,k))/norm > > it would be convenient to have the method like that: > A, B = mod.meth(C, prob=.95) > > is ith poss

[Numpy-discussion] c-api return two arrays

2011-07-29 Thread Yoshi Rokuko
hey, i have an algorithm that computes two matrices like that: A(i,k) = (x(i,k) + y(i,k))/norm B(i,k) = (x(i,k) - y(i,k))/norm it would be convenient to have the method like that: >>> A, B = mod.meth(C, prob=.95) is ith possible to return two arrays? best regards _

Re: [Numpy-discussion] C-API: PyTypeObject* for NumPy scalar types

2011-07-29 Thread Johan Råde
On 2011-07-28 07:50, Johan Råde wrote: > How do I get the PyTypeObject* for a NumPy scalar type such as np.uint8? > > (The reason I'm asking is the following: > I'm writing a C++ extension module. The Python interface to the module > has a function f that takes a NumPy scalar type as an argument, f

[Numpy-discussion] C-API: PyTypeObject* for NumPy scalar types

2011-07-28 Thread Johan Råde
How do I get the PyTypeObject* for a NumPy scalar type such as np.uint8? (The reason I'm asking is the following: I'm writing a C++ extension module. The Python interface to the module has a function f that takes a NumPy scalar type as an argument, for instance f(np.uint8). Then the correspondin

Re: [Numpy-discussion] C-API: multidimensional array indexing?

2011-07-27 Thread Johann Bauer
Thanks, Mark! Problem solved. Johann ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] C-API: multidimensional array indexing?

2011-07-27 Thread Mark Wiebe
Probably the easiest way is to emulate what Python is doing in M[i,:] and M[:,i]. You can create the : with PySlice_New(NULL, NULL, NULL), and the i with PyInt_FromLong. Then create a tuple with Py_BuildValue and use PyObject_GetItem to do the slicing. It is possible to do the same thing directly

[Numpy-discussion] C-API: multidimensional array indexing?

2011-07-27 Thread Johann Bauer
Dear experts, is there a C-API function for numpy which implements Python's multidimensional indexing? Say, I have a 2d-array PyArrayObject * M; and an index int i; how do I extract the i-th row or column M[i,:] respectively M[:,i]? I am looking for a function which gives again a PyArr

Re: [Numpy-discussion] C API freeze and review

2011-03-10 Thread Ralf Gommers
On Thu, Mar 10, 2011 at 10:10 PM, Charles R Harris wrote: > > > On Thu, Mar 10, 2011 at 12:25 AM, Charles R Harris > wrote: >> >> >> On Thu, Mar 10, 2011 at 12:15 AM, Ralf Gommers >> wrote: >>> >>> Hi all, >>> >>> In preparation for making a 1.6.x branch, I just updated the C API >>> version. Pl

Re: [Numpy-discussion] C API freeze and review

2011-03-10 Thread Charles R Harris
On Thu, Mar 10, 2011 at 12:25 AM, Charles R Harris < charlesr.har...@gmail.com> wrote: > > > On Thu, Mar 10, 2011 at 12:15 AM, Ralf Gommers < > ralf.gomm...@googlemail.com> wrote: > >> Hi all, >> >> In preparation for making a 1.6.x branch, I just updated the C API >> version. Please do not add an

Re: [Numpy-discussion] C API freeze and review

2011-03-09 Thread Charles R Harris
On Thu, Mar 10, 2011 at 12:15 AM, Ralf Gommers wrote: > Hi all, > > In preparation for making a 1.6.x branch, I just updated the C API > version. Please do not add any more functions before the branch is > created. > > Over 70 new functions and types were added, we should also review if > all thos

[Numpy-discussion] C API freeze and review

2011-03-09 Thread Ralf Gommers
Hi all, In preparation for making a 1.6.x branch, I just updated the C API version. Please do not add any more functions before the branch is created. Over 70 new functions and types were added, we should also review if all those are necessary and if they are documented. Below is a list of all ne

Re: [Numpy-discussion] C-api and masked arrays

2010-03-01 Thread Matt Knox
Martin Raspaud smhi.se> writes: > We are using at the moment a c extension which should manipulate masked > arrays. > What we do is to fill the masked array with a given value (say 65535 if we run > uint16 arrays), do the manipulation, and convert back to masked arrays when we > go back to pytho

Re: [Numpy-discussion] C-api and masked arrays

2010-03-01 Thread Pierre GM
On Mar 1, 2010, at 10:39 AM, Martin Raspaud wrote: > Hi, > > We're talking map projections, so that means that the values will move around, > including masked ones... > > So filling the array with a given value is a way of projecting the array and > the > mask in one shot... OK then. Just make

Re: [Numpy-discussion] C-api and masked arrays

2010-03-01 Thread Martin Raspaud
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Pierre GM skrev: > On Mar 1, 2010, at 10:04 AM, Martin Raspaud wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> Hi all, >> >> We are using at the moment a c extension which should manipulate masked >> arrays. >> What we do is to fill t

Re: [Numpy-discussion] C-api and masked arrays

2010-03-01 Thread Pierre GM
On Mar 1, 2010, at 10:04 AM, Martin Raspaud wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi all, > > We are using at the moment a c extension which should manipulate masked > arrays. > What we do is to fill the masked array with a given value (say 65535 if we run > uint16 arrays)

[Numpy-discussion] C-api and masked arrays

2010-03-01 Thread Martin Raspaud
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all, We are using at the moment a c extension which should manipulate masked arrays. What we do is to fill the masked array with a given value (say 65535 if we run uint16 arrays), do the manipulation, and convert back to masked arrays when we go ba

Re: [Numpy-discussion] C-API: How is data filling done in PyArray_SimpleNewFromData ?

2009-10-27 Thread Travis Oliphant
On Oct 27, 2009, at 7:43 AM, Raspaud Martin wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello, I’m using numpy v1.2.0, and I have the following codes that provide different results : - - cal = (PyArrayObject *)PyArray_SimpleNew(2,dims,NPY_FLOAT); for(i=0;iAs you

[Numpy-discussion] C-API: How is data filling done in PyArray_SimpleNewFromData ?

2009-10-27 Thread Raspaud Martin
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello, I’m using numpy v1.2.0, and I have the following codes that provide different results : - - cal = (PyArrayObject *)PyArray_SimpleNew(2,dims,NPY_FLOAT); for(i=0;ihttp://enigmail.mozdev.org/ iQEcBAEBAgAGBQJK5usJAAoJEBdvyODiy

Re: [Numpy-discussion] C API refcount question

2009-07-06 Thread Charles R Harris
On Mon, Jul 6, 2009 at 7:30 AM, Dag Sverre Seljebotn < da...@student.matnat.uio.no> wrote: > I'm trying to fledge out Cython's numpy.pxd, and have a question: > > Is there documentation anywhere, or a simple-to-remember rule, on > whether the return value of a NumPy C API is incref-ed or not? > >

[Numpy-discussion] C API refcount question

2009-07-06 Thread Dag Sverre Seljebotn
I'm trying to fledge out Cython's numpy.pxd, and have a question: Is there documentation anywhere, or a simple-to-remember rule, on whether the return value of a NumPy C API is incref-ed or not? E.g. PyArray_BASE, PyArray_DESCR obviously does not incref; while I'm assuming that PyArray_New* mus

Re: [Numpy-discussion] C-API change for 1.2

2008-08-19 Thread Jarrod Millman
On Sun, Aug 17, 2008 at 5:33 AM, Peter <[EMAIL PROTECTED]> wrote: > I don't know if this constitutes "major opposition", but is keeping > the same C-API for NumPy 1.2 unchanged still a possibility? Please? Sorry I haven't commented on this yet; I have been busy and am still thinking about the iss

Re: [Numpy-discussion] C-API change for 1.2

2008-08-19 Thread Andrew Straw
Andrew Straw wrote: > Robert Kern wrote: >> On Sat, Aug 16, 2008 at 04:34, Jon Wright <[EMAIL PROTECTED]> wrote: >> >>> Travis, Stéfan, >>> >>> I missed Travis mail previously. Are you *really* sure you want force >>> all C code which uses numpy arrays to be recompiled? If you mean that >>> all

Re: [Numpy-discussion] C-API change for 1.2

2008-08-18 Thread David Cournapeau
On Mon, Aug 18, 2008 at 10:04 AM, Charles R Harris <[EMAIL PROTECTED]> wrote: > >If you could figure out how to add a new flags field > without affecting the old one or requiring existion applications to be > recompiled, that would be good. Adding a member to a struct does not break ABI as long as

Re: [Numpy-discussion] C-API change for 1.2

2008-08-18 Thread Charles R Harris
On Mon, Aug 18, 2008 at 10:26 AM, Travis E. Oliphant <[EMAIL PROTECTED] > wrote: > Charles R Harris wrote: > > > > > > On Sat, Aug 16, 2008 at 11:21 PM, David Cournapeau <[EMAIL PROTECTED] > > > wrote: > > > > On Sat, Aug 16, 2008 at 11:59 PM, David Cournapeau > >

Re: [Numpy-discussion] C-API change for 1.2

2008-08-18 Thread Travis E. Oliphant
Charles R Harris wrote: > > > On Sat, Aug 16, 2008 at 11:21 PM, David Cournapeau <[EMAIL PROTECTED] > > wrote: > > On Sat, Aug 16, 2008 at 11:59 PM, David Cournapeau > <[EMAIL PROTECTED] > wrote: > > On Sat, Aug 16, 2008 at 11:16 PM,

Re: [Numpy-discussion] C-API change for 1.2

2008-08-18 Thread Travis E. Oliphant
David Cournapeau wrote: > On Sat, Aug 16, 2008 at 11:59 PM, David Cournapeau <[EMAIL PROTECTED]> wrote: > >> On Sat, Aug 16, 2008 at 11:16 PM, Charles R Harris >> <[EMAIL PROTECTED]> wrote: >> >>> I'm slowly coming to the conviction that there should be no C-ABI changes in >>> 1.2. >>>

Re: [Numpy-discussion] C-API change for 1.2

2008-08-17 Thread Peter
> David Cournapeau wrote: >> Does that mean we will continue breaking the ABI from time to time >> during the 1.* cycle ? > Jon Wright wrote: > Can someone help me to understand me what is the compelling reason for > this change? If it only means everyone recompiles, it is hard to see > what we, a

Re: [Numpy-discussion] C-API change for 1.2

2008-08-17 Thread David Cournapeau
On Sun, Aug 17, 2008 at 12:51 AM, Charles R Harris <[EMAIL PROTECTED]> wrote: > > > > I have nothing against extensions when they can be made to serve. If a > dictionary gets added to ndarrays I hope it is done that way, likewise for > generalized ufuncs. But that's a totally different matter. You

Re: [Numpy-discussion] C-API change for 1.2

2008-08-17 Thread Stéfan van der Walt
2008/8/17 Charles R Harris <[EMAIL PROTECTED]>: > I have nothing against extensions when they can be made to serve. If a > dictionary gets added to ndarrays I hope it is done that way, likewise for > generalized ufuncs. In the present case I think Travis wants to preserve the > functionality while

Re: [Numpy-discussion] C-API change for 1.2

2008-08-16 Thread Charles R Harris
On Sat, Aug 16, 2008 at 11:21 PM, David Cournapeau <[EMAIL PROTECTED]>wrote: > On Sat, Aug 16, 2008 at 11:59 PM, David Cournapeau <[EMAIL PROTECTED]> > wrote: > > On Sat, Aug 16, 2008 at 11:16 PM, Charles R Harris > > <[EMAIL PROTECTED]> wrote: > >> > >> I'm slowly coming to the conviction that th

Re: [Numpy-discussion] C-API change for 1.2

2008-08-16 Thread David Cournapeau
On Sat, Aug 16, 2008 at 11:59 PM, David Cournapeau <[EMAIL PROTECTED]> wrote: > On Sat, Aug 16, 2008 at 11:16 PM, Charles R Harris > <[EMAIL PROTECTED]> wrote: >> >> I'm slowly coming to the conviction that there should be no C-ABI changes in >> 1.2. > > It does not make sense to revert those chang

Re: [Numpy-discussion] C-API change for 1.2

2008-08-16 Thread David Cournapeau
On Sat, Aug 16, 2008 at 11:16 PM, Charles R Harris <[EMAIL PROTECTED]> wrote: > > I'm slowly coming to the conviction that there should be no C-ABI changes in > 1.2. It does not make sense to revert those changes anymore, but we keep having those discussions, and I still don't understand whether t

Re: [Numpy-discussion] C-API change for 1.2

2008-08-16 Thread Charles R Harris
On Sat, Aug 16, 2008 at 3:02 PM, Jon Wright <[EMAIL PROTECTED]> wrote: > > > Try to look 12 months into the future and ask yourselves if it was > really a good idea to break the ABI. > I'm slowly coming to the conviction that there should be no C-ABI changes in 1.2. And maybe not in 1.3 either,

Re: [Numpy-discussion] C-API change for 1.2

2008-08-16 Thread Jon Wright
Robert Kern wrote: > > FWIW, neither PIL nor PyOpenGL have C code which uses numpy arrays, so > they are entirely unaffected. OK, so here are some projects which might notice a 1.2 installation, in as much as they turn up on a google code search for: #include "numpy/arrayobject.h" -scipy -enth

Re: [Numpy-discussion] C-API change for 1.2

2008-08-16 Thread David Cournapeau
On Sat, Aug 16, 2008 at 12:44 PM, Jon Wright <[EMAIL PROTECTED]> wrote: > David Cournapeau wrote: >> Does that mean we will continue breaking the ABI from time to time >> during the 1.* cycle ? > > > Can someone help me to understand me what is the compelling reason for > this change? If it only me

Re: [Numpy-discussion] C-API change for 1.2

2008-08-16 Thread Charles R Harris
On Sat, Aug 16, 2008 at 1:26 PM, Fernando Perez <[EMAIL PROTECTED]>wrote: > On Sat, Aug 16, 2008 at 10:56 AM, Charles R Harris > <[EMAIL PROTECTED]> wrote: > > > Turns out that ipython needs to be recompiled also because of the newly > > added version checking. > > I'm sorry, can you clarify this?

Re: [Numpy-discussion] C-API change for 1.2

2008-08-16 Thread Fernando Perez
On Sat, Aug 16, 2008 at 10:56 AM, Charles R Harris <[EMAIL PROTECTED]> wrote: > Turns out that ipython needs to be recompiled also because of the newly > added version checking. I'm sorry, can you clarify this? ipython has no C code at all, so I'm not sure what you mean here. Cheers, f ___

Re: [Numpy-discussion] C-API change for 1.2

2008-08-16 Thread Charles R Harris
On Sat, Aug 16, 2008 at 12:05 PM, Charles R Harris < [EMAIL PROTECTED]> wrote: > > > On Sat, Aug 16, 2008 at 11:56 AM, Charles R Harris < > [EMAIL PROTECTED]> wrote: > >> >> >> On Sat, Aug 16, 2008 at 11:44 AM, Jon Wright <[EMAIL PROTECTED]> wrote: >> >>> David Cournapeau wrote: >>> > Does that me

Re: [Numpy-discussion] C-API change for 1.2

2008-08-16 Thread Charles R Harris
On Sat, Aug 16, 2008 at 11:56 AM, Charles R Harris < [EMAIL PROTECTED]> wrote: > > > On Sat, Aug 16, 2008 at 11:44 AM, Jon Wright <[EMAIL PROTECTED]> wrote: > >> David Cournapeau wrote: >> > Does that mean we will continue breaking the ABI from time to time >> > during the 1.* cycle ? >> >> >> Can

Re: [Numpy-discussion] C-API change for 1.2

2008-08-16 Thread Charles R Harris
On Sat, Aug 16, 2008 at 11:44 AM, Jon Wright <[EMAIL PROTECTED]> wrote: > David Cournapeau wrote: > > Does that mean we will continue breaking the ABI from time to time > > during the 1.* cycle ? > > > Can someone help me to understand me what is the compelling reason for > this change? If it only

Re: [Numpy-discussion] C-API change for 1.2

2008-08-16 Thread Jon Wright
David Cournapeau wrote: > Does that mean we will continue breaking the ABI from time to time > during the 1.* cycle ? Can someone help me to understand me what is the compelling reason for this change? If it only means everyone recompiles, it is hard to see what we, as users, are gaining by doi

Re: [Numpy-discussion] C-API change for 1.2

2008-08-16 Thread David Cournapeau
On Sat, Aug 16, 2008 at 10:47 AM, Travis E. Oliphant <[EMAIL PROTECTED]> wrote: > > Re-compilation is necessary at some point. We have not required > recompilation for a long time now.Yes, it is a pain for > distribution, but those who don't want to re-compile can point people to > 1.1.1 which

Re: [Numpy-discussion] C-API change for 1.2

2008-08-16 Thread Travis E. Oliphant
Jon Wright wrote: > Travis, Stéfan, > > I missed Travis mail previously. Are you *really* sure you want force > all C code which uses numpy arrays to be recompiled? Re-compilation is necessary at some point. We have not required recompilation for a long time now.Yes, it is a pain for distr

Re: [Numpy-discussion] C-API change for 1.2

2008-08-16 Thread Charles R Harris
On Sat, Aug 16, 2008 at 3:43 AM, Robert Kern <[EMAIL PROTECTED]> wrote: > On Sat, Aug 16, 2008 at 04:34, Jon Wright <[EMAIL PROTECTED]> wrote: > > Travis, Stéfan, > > > > I missed Travis mail previously. Are you *really* sure you want force > > all C code which uses numpy arrays to be recompiled?

Re: [Numpy-discussion] C-API change for 1.2

2008-08-16 Thread Andrew Straw
Robert Kern wrote: > On Sat, Aug 16, 2008 at 04:34, Jon Wright <[EMAIL PROTECTED]> wrote: > >> Travis, Stéfan, >> >> I missed Travis mail previously. Are you *really* sure you want force >> all C code which uses numpy arrays to be recompiled? If you mean that >> all your matplotlib/PIL/pyopengl/

Re: [Numpy-discussion] C-API change for 1.2

2008-08-16 Thread Robert Kern
On Sat, Aug 16, 2008 at 04:34, Jon Wright <[EMAIL PROTECTED]> wrote: > Travis, Stéfan, > > I missed Travis mail previously. Are you *really* sure you want force > all C code which uses numpy arrays to be recompiled? If you mean that > all your matplotlib/PIL/pyopengl/etc users are going to have to

Re: [Numpy-discussion] C-API change for 1.2

2008-08-16 Thread Jon Wright
Travis, Stéfan, I missed Travis mail previously. Are you *really* sure you want force all C code which uses numpy arrays to be recompiled? If you mean that all your matplotlib/PIL/pyopengl/etc users are going to have to make a co-ordinated upgrade, then this seems to be a grave mistake. Does S

Re: [Numpy-discussion] C-API change for 1.2

2008-08-08 Thread Jarrod Millman
On Fri, Aug 8, 2008 at 7:22 PM, Travis E. Oliphant <[EMAIL PROTECTED]> wrote: > The 1.2 version of NumPy is going to be tagged. There is at least one > change I'd like to add: The hasobject member of the PyArray_Descr > structure should be renamed to "flags" and converted to a 32-bit > integer.

[Numpy-discussion] C-API change for 1.2

2008-08-08 Thread Travis E. Oliphant
Hi all, The 1.2 version of NumPy is going to be tagged. There is at least one change I'd like to add: The hasobject member of the PyArray_Descr structure should be renamed to "flags" and converted to a 32-bit integer. What does everybody think about this change? It should have minimal

[Numpy-discussion] C API : slicing?

2008-05-29 Thread Rahul Garg
Hi. Does the C api have some convenience functions for creating slices? For example : if I have a PyArrayObject *A, which represents lets say a 2d ndarray A in Python, is there a C api function to easily do the equivalent of A[a:b:c,d:e:f] ? thanks, rahul _

Re: [Numpy-discussion] C API

2008-05-22 Thread Charles R Harris
On Thu, May 22, 2008 at 6:36 PM, Travis E. Oliphant <[EMAIL PROTECTED]> wrote: > Charles R Harris wrote: > > > > > > On Thu, May 22, 2008 at 3:55 PM, Charles R Harris > > <[EMAIL PROTECTED] > wrote: > > > > > > > > On Thu, May 22, 2008 at 3:34 PM, Travis E. Oliphant >

Re: [Numpy-discussion] C API

2008-05-22 Thread Travis E. Oliphant
Charles R Harris wrote: > > > On Thu, May 22, 2008 at 3:55 PM, Charles R Harris > <[EMAIL PROTECTED] > wrote: > > > > On Thu, May 22, 2008 at 3:34 PM, Travis E. Oliphant > <[EMAIL PROTECTED] > wrote: > > Charles R Harris wrote: >

Re: [Numpy-discussion] C API

2008-05-22 Thread Charles R Harris
On Thu, May 22, 2008 at 3:55 PM, Charles R Harris <[EMAIL PROTECTED]> wrote: > > > On Thu, May 22, 2008 at 3:34 PM, Travis E. Oliphant < > [EMAIL PROTECTED]> wrote: > >> Charles R Harris wrote: >> > All, >> > >> > I added a function to array_api_order.txt and apparently this changed >> > the order

Re: [Numpy-discussion] C API

2008-05-22 Thread Charles R Harris
On Thu, May 22, 2008 at 3:34 PM, Travis E. Oliphant <[EMAIL PROTECTED]> wrote: > Charles R Harris wrote: > > All, > > > > I added a function to array_api_order.txt and apparently this changed > > the order of the pointers in the API, which caused ctypes to segfault > > until I removed the build di

Re: [Numpy-discussion] C API

2008-05-22 Thread Travis E. Oliphant
Charles R Harris wrote: > All, > > I added a function to array_api_order.txt and apparently this changed > the order of the pointers in the API, which caused ctypes to segfault > until I removed the build directory and did a complete rebuild. It > seems to me that if we really want to make addin

[Numpy-discussion] C API

2008-05-22 Thread Charles R Harris
All, I added a function to array_api_order.txt and apparently this changed the order of the pointers in the API, which caused ctypes to segfault until I removed the build directory and did a complete rebuild. It seems to me that if we really want to make adding these API functions safe, then we sh

Re: [Numpy-discussion] C-api to slicing?

2008-02-08 Thread Neal Becker
Robert Kern wrote: > Neal Becker wrote: >> Is there a C-api to array slicing? > > PyObject_GetItem(), PySlice_New(), and friends, for the most part. > I tried PySequence_GetItem on my array, and it seems the refcount isn't working. inline object test_slice3 (object const& in_obj, int r) { if

Re: [Numpy-discussion] C-api to slicing?

2008-02-05 Thread Robert Kern
Neal Becker wrote: > Is there a C-api to array slicing? PyObject_GetItem(), PySlice_New(), and friends, for the most part. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had

[Numpy-discussion] C-api to slicing?

2008-02-05 Thread Neal Becker
Is there a C-api to array slicing? ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] C-API for non-contiguous arrays

2007-10-26 Thread Oliver Kranz
David Cournapeau wrote: > Oliver Kranz wrote: >> Hi, >> >> I am working on a Python extension module using of the NumPy C-API. The >> extension module is an interface to an image processing and analysis >> library written in C++. The C++ functions are exported with >> boos::python. Currently I a

Re: [Numpy-discussion] C-API for non-contiguous arrays

2007-10-25 Thread David Cournapeau
Oliver Kranz wrote: > Hi, > > I am working on a Python extension module using of the NumPy C-API. The > extension module is an interface to an image processing and analysis > library written in C++. The C++ functions are exported with > boos::python. Currently I am implementing the support of >

Re: [Numpy-discussion] C-API for non-contiguous arrays

2007-10-25 Thread Oliver Kranz
Timothy Hochberg wrote: > > > On 10/25/07, *Oliver Kranz* <[EMAIL PROTECTED] > > wrote: > > Hi, > > I am working on a Python extension module using of the NumPy C-API. The > extension module is an interface to an image processing and analysis > library

Re: [Numpy-discussion] C-API for non-contiguous arrays

2007-10-25 Thread Timothy Hochberg
On 10/25/07, Oliver Kranz <[EMAIL PROTECTED]> wrote: > > Hi, > > I am working on a Python extension module using of the NumPy C-API. The > extension module is an interface to an image processing and analysis > library written in C++. The C++ functions are exported with > boos::python. Currently I a

[Numpy-discussion] C-API for non-contiguous arrays

2007-10-25 Thread Oliver Kranz
Hi, I am working on a Python extension module using of the NumPy C-API. The extension module is an interface to an image processing and analysis library written in C++. The C++ functions are exported with boos::python. Currently I am implementing the support of three-dimensional data sets whic

Re: [Numpy-discussion] C-API Documentation?

2007-09-25 Thread David M. Cooke
On Mon, Sep 24, 2007 at 06:07:29PM +0300, dmitrey wrote: > I don't know anything about C API, but scipy documentation from the website > http://www.scipy.org/doc/api_docs/ > is dated 14 August 2007, so scipy 0.6.0 doc differs significantly. > D. I was confused until I checked that page -- you mean

Re: [Numpy-discussion] C-API Documentation?

2007-09-24 Thread Bill Baxter
On 9/25/07, Thomas Schreiner <[EMAIL PROTECTED]> wrote: > > Andrew Straw schrieb: > > Thomas Schreiner wrote: > >> Am I doing anything wrong in this program? It's crashing immediately > >> after the "before" line, using Borland C++ Builder 6 and > >> numpy-1.0.3.1.win32-py2.4. > > You have to call

Re: [Numpy-discussion] C-API Documentation?

2007-09-24 Thread Eric Firing
Thomas Schreiner wrote: > Hi, > > is there any more documentation about the numpy C API than the one at > http://projects.scipy.org/scipy/numpy/wiki/NumPyCAPI If you have not already done so, I recommend following the suggestion at the bottom of that page, and buying Travis's book (http://www.t

Re: [Numpy-discussion] C-API Documentation?

2007-09-24 Thread Thomas Schreiner
Andrew Straw schrieb: > Thomas Schreiner wrote: >> Am I doing anything wrong in this program? It's crashing immediately >> after the "before" line, using Borland C++ Builder 6 and >> numpy-1.0.3.1.win32-py2.4. > You have to call import_array() before using the C API. Thanks a lot, that was the p

Re: [Numpy-discussion] C-API Documentation?

2007-09-24 Thread Andrew Straw
Thomas Schreiner wrote: > Am I doing anything wrong in this program? It's crashing immediately > after the "before" line, using Borland C++ Builder 6 and > numpy-1.0.3.1.win32-py2.4. You have to call import_array() before using the C API. ___ Numpy-disc

Re: [Numpy-discussion] C-API Documentation?

2007-09-24 Thread Thomas Schreiner
Hi. dmitrey wrote: > Thomas Schreiner wrote: >> is there any more documentation about the numpy C API than the one >> at http://projects.scipy.org/scipy/numpy/wiki/NumPyCAPI ? > > I don't know anything about C API, but scipy documentation from the > website > http://www.scipy.org/doc/api_docs/ i

Re: [Numpy-discussion] C-API Documentation?

2007-09-24 Thread dmitrey
I don't know anything about C API, but scipy documentation from the website http://www.scipy.org/doc/api_docs/ is dated 14 August 2007, so scipy 0.6.0 doc differs significantly. D. Thomas Schreiner wrote: > Hi, > > is there any more documentation about the numpy C API than the one at > http://proj

[Numpy-discussion] C-API Documentation?

2007-09-24 Thread Thomas Schreiner
Hi, is there any more documentation about the numpy C API than the one at http://projects.scipy.org/scipy/numpy/wiki/NumPyCAPI ? This one deals mostly with creating NumPy arrays in C, but I'm more interested in manually filling the arrays with actual data, because wrapping of memory is not poss

Re: [Numpy-discussion] C-API creating new copy of C data

2007-04-21 Thread Bill Baxter
On 4/22/07, Travis Oliphant <[EMAIL PROTECTED]> wrote: > Bill Baxter wrote: > > What's the right way to make a new numpy array that's a copy of some C data? > > > What do you mean by /copies/ the void * data pointer for you? Do you > mean the API would > > 1) Create new memory for the array > 2)

Re: [Numpy-discussion] C-API creating new copy of C data

2007-04-21 Thread Sebastian Haase
On 4/21/07, Travis Oliphant <[EMAIL PROTECTED]> wrote: > Bill Baxter wrote: > > What's the right way to make a new numpy array that's a copy of some C data? > > > > There doesn't seem to be any API like PyArray_NewFromDescr that > > /copies/ the void*data pointer for you. Do I have to write my own

Re: [Numpy-discussion] C-API creating new copy of C data

2007-04-21 Thread Travis Oliphant
Bill Baxter wrote: > What's the right way to make a new numpy array that's a copy of some C data? > > There doesn't seem to be any API like PyArray_NewFromDescr that > /copies/ the void*data pointer for you. Do I have to write my own > loops for this? I can do that, it just seems like it should b

Re: [Numpy-discussion] C-API creating new copy of C data

2007-04-21 Thread Sebastian Haase
On 4/19/07, Bill Baxter <[EMAIL PROTECTED]> wrote: > What's the right way to make a new numpy array that's a copy of some C data? > > There doesn't seem to be any API like PyArray_NewFromDescr that > /copies/ the void*data pointer for you. Do I have to write my own > loops for this? I can do that

[Numpy-discussion] C-API creating new copy of C data

2007-04-19 Thread Bill Baxter
What's the right way to make a new numpy array that's a copy of some C data? There doesn't seem to be any API like PyArray_NewFromDescr that /copies/ the void*data pointer for you. Do I have to write my own loops for this? I can do that, it just seems like it should be a library function already

Re: [Numpy-discussion] C-API: deallocating a partial ly filled object array

2007-01-26 Thread Martin Wiechert
On Friday 26 January 2007 21:45, Travis Oliphant wrote: > Martin Wiechert wrote: > >On Friday 26 January 2007 21:03, Robert Kern wrote: > >>Martin Wiechert wrote: > >>>Hi gurus, > >>> > >>>is it (in C) safe to deallocate an array of type NPY_OBJECT, which > >>>carries NULL pointers? > >> > >>Possib

Re: [Numpy-discussion] C-API: deallocating a partially filled object array

2007-01-26 Thread Travis Oliphant
Martin Wiechert wrote: >On Friday 26 January 2007 21:03, Robert Kern wrote: > > >>Martin Wiechert wrote: >> >> >>>Hi gurus, >>> >>>is it (in C) safe to deallocate an array of type NPY_OBJECT, which >>>carries NULL pointers? >>> >>> >>Possibly, I'm not sure without doing some more code-

Re: [Numpy-discussion] C-API: deallocating a partially filled object array

2007-01-26 Thread Martin Wiechert
On Friday 26 January 2007 21:03, Robert Kern wrote: > Martin Wiechert wrote: > > Hi gurus, > > > > is it (in C) safe to deallocate an array of type NPY_OBJECT, which > > carries NULL pointers? > > Possibly, I'm not sure without doing some more code-diving. However, I > strongly doubt that many othe

Re: [Numpy-discussion] C-API: deallocating a partially filled object array

2007-01-26 Thread Robert Kern
Martin Wiechert wrote: > Hi gurus, > > is it (in C) safe to deallocate an array of type NPY_OBJECT, which carries > NULL pointers? Possibly, I'm not sure without doing some more code-diving. However, I strongly doubt that many other operations are safe. Depending on how you got such an array and

[Numpy-discussion] C-API: deallocating a partially filled object array

2007-01-26 Thread Martin Wiechert
Hi gurus, is it (in C) safe to deallocate an array of type NPY_OBJECT, which carries NULL pointers? TIA, Martin ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] C-API: datatype for arrays of indices

2007-01-24 Thread Martin Wiechert
On Wednesday 24 January 2007 16:44, Travis Oliphant wrote: > Martin Wiechert wrote: > >Hi list, > > > >does anybody know, what datatype arrays C-API functions like > > > >PyArray_SearchSorted > >PyArray_ArgSort > > > >return? Can I rely on them being npy_intp? > > Yes. > > -Travis > Thanks! > ___

  1   2   >