Re: [Numpy-discussion] access ndarray in C++

2008-12-10 Thread Ravi
Oops, please ignore my previous message. I just started using a new mail client which marked some of my old messages (which I had tagged interesting) the same as new messages and I just blindly replied to them without checking the date. Sorry about the spam. Ravi _

Re: [Numpy-discussion] access ndarray in C++

2008-12-10 Thread Ravi
On Wednesday 23 April 2008 15:48:23 Christopher Barker wrote: > > - Boost Python [1]. Especially if you want usable C++ integration. (ie. > > more than basic templates, etc.) > > What's the status of the Boost array object? maintained? updated for > recent numpy? The boost.python array object is s

Re: [Numpy-discussion] access ndarray in C++

2008-04-26 Thread Hoyt Koepke
Let me say also that I tried using boost.python a while back to interface numpy with c++, and, while I got some things working, I found the distribution and packaging end of things an order of magnitude more complicated than what I found with weave. Since weave is built into scipy, as well as blit

Re: [Numpy-discussion] access ndarray in C++

2008-04-26 Thread Gael Varoquaux
On Wed, Apr 23, 2008 at 09:47:46PM -0400, Andreas Klöckner wrote: > > Any numpy-specific stuff for sip? > Not as far as I'm aware. In fact, I don't know of any uses of sip outside of > Qt/KDE-related things. Airbus uses it for heavy numerical work. They claim they have benchmarked all the tools

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread Andreas Klöckner
On Mittwoch 23 April 2008, Christopher Barker wrote: > What's the status of the Boost array object? maintained? updated for > recent numpy? The numeric.hpp included in Boost.Python is a joke. It does not use the native API. PyUblas [1] fills this gap, by allowing you to use Boost.Ublas on the C+

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread Robert Kern
On Wed, Apr 23, 2008 at 3:46 PM, Thomas Hrabe <[EMAIL PROTECTED]> wrote: > I have discovered a bug in ndarrayobject.h by the way. I do not know which > numpy version we have installed here, but when compiling my c code with > -pendantic I got this error: > > > /home/global/python32/lib/python2.4/s

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread Thomas Hrabe
] on behalf of Christopher Barker Sent: Wed 4/23/2008 1:15 PM To: Discussion of Numerical Python Subject: Re: [Numpy-discussion] access ndarray in C++ Christopher Barker wrote: > Thomas Hrabe wrote: > I'd poke around the wiki, and this mailing list archives, for more examples. Th

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread Christopher Barker
Christopher Barker wrote: > Thomas Hrabe wrote: > I'd poke around the wiki, and this mailing list archives, for more examples. This may help: http://scipy.org/Cookbook/C_Extensions -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread Hoyt Koepke
Just to add something from personal experience in case it's useful... I write a lot of code that works on numpy arrays that goes between python and c++ (too used to OO to stick with pure c). I've been using scipy.weave to interface to blitz++ arrays in my c++ code. The blitz++ library has been wo

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread Christopher Barker
Andreas Klöckner wrote: > IMO, all of these deal better with C than they do with C++. True, though SWIG works OK with C++. > There is also a > number of more C++-affine solutions: > > - Boost Python [1]. Especially if you want usable C++ integration. (ie. more > than basic templates, etc.) W

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread Andreas Klöckner
On Mittwoch 23 April 2008, Christopher Barker wrote: > NOTE: > Most folks now think that the pain of writing extensions completely by > hand is not worth it -- it's just too easy to make reference counting > mistakes, etc. Most folks are now using one of: > > Cython (or Pyrex) > SWIG > ctypes IMO,

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread Christopher Barker
Thomas Hrabe wrote: > One can find multiple approaches to arrays, the old numeric array and > the new ndarray. The new stuff seems to be backward compatible. mostly, yes. numpy (ndarray) is the only option going forward, as it's the only one being maintained. > However, where is a free documen

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread Thomas Hrabe
thout using a custom hack. Finally, my primary aim is to access 3dimensional arrays of floats in C. Best, Thomas -Original Message- From: [EMAIL PROTECTED] on behalf of Thomas Hrabe Sent: Tue 4/22/2008 2:38 PM To: numpy-discussion@scipy.org Subject: [Numpy-discussion] access ndarray in C

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread Joris De Ridder
On 23 Apr 2008, at 17:50, Tommy Grav wrote: > > On Apr 23, 2008, at 11:26 AM, Joris De Ridder wrote: > >> >> They are attached to the wiki page. Click on "Attachments" in the >> menu >> on the left. >> >> Joris > > Thanks. Didn't know that wiki's had that :) > > I tried you example on a Mac OS

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread Bill Spotz
On Apr 23, 2008, at 9:50 AM, Tommy Grav wrote: > > On Apr 23, 2008, at 11:26 AM, Joris De Ridder wrote: > >> >> They are attached to the wiki page. Click on "Attachments" in the >> menu >> on the left. >> >> Joris > > Thanks. Didn't know that wiki's had that :) > > I tried you example on a Mac OS

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread Tommy Grav
On Apr 23, 2008, at 11:26 AM, Joris De Ridder wrote: > > They are attached to the wiki page. Click on "Attachments" in the menu > on the left. > > Joris Thanks. Didn't know that wiki's had that :) I tried you example on a Mac OS X 10.5.2 (I am not using Scons) and got [skathi:~/Work/myCode/pyC

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread Andreas Klöckner
On Mittwoch 23 April 2008, Albert Strasheim wrote: > Hello, > > On Tue, Apr 22, 2008 at 11:38 PM, Thomas Hrabe <[EMAIL PROTECTED]> wrote: > > I am currently developing a python module in C/C++ which is supposed to > > access nd arrays as defined by the following command in python > > You might als

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread Stéfan van der Walt
2008/4/23 Tommy Grav <[EMAIL PROTECTED]>: > > On Apr 22, 2008, at 9:56 PM, Joris De Ridder wrote: > > > > > On http://www.scipy.org/JorisDeRidder I've just put an example how I > > passed multidimensional Numpy arrays to C++ using ctypes. Perhaps > > it's helpful for your application. I didn't

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread Joris De Ridder
They are attached to the wiki page. Click on "Attachments" in the menu on the left. Joris On 23 Apr 2008, at 17:19, Tommy Grav wrote: > > On Apr 22, 2008, at 9:56 PM, Joris De Ridder wrote: > >> >> On http://www.scipy.org/JorisDeRidder I've just put an example how I >> passed multidimensiona

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread Tommy Grav
On Apr 22, 2008, at 9:56 PM, Joris De Ridder wrote: > > On http://www.scipy.org/JorisDeRidder I've just put an example how I > passed multidimensional Numpy arrays to C++ using ctypes. Perhaps > it's helpful for your application. I didn't put it in the cookbook > yet, because I would first

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread Albert Strasheim
Hello, On Tue, Apr 22, 2008 at 11:38 PM, Thomas Hrabe <[EMAIL PROTECTED]> wrote: > I am currently developing a python module in C/C++ which is supposed to > access nd arrays as defined by the following command in python You might also be interested in: http://mathema.tician.de/software/pyublas

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread Joris De Ridder
Hi Sebastian, > this is a great ( short ) recipe ! Thanks! > Could you elaborate on the line > "You need to compile myextension.cpp and make a shared library from > it. The easiest way is to use Scons with the constructor file: !? David already gave the answer. Scons allows you to make shared

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread Matthieu Brucher
> > the compiler, the compiler flags, the linker, the linker flags, the > location of Python.h, etc... > > > > With a simple extension builder, we didn't encountered any bug > > although we have a fair number of extensions. > > > Building a helloworld like extension or say numpy.core is kind of the

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread David Cournapeau
Matthieu Brucher wrote: > > Having a good python extension builder is also more difficult than I > first expected, too (you can't retrieve options for MS compilers from > distutils, for example and I would like to support building with and > without distutils' help). > > > What are

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread Matthieu Brucher
> > Having a good python extension builder is also more difficult than I > first expected, too (you can't retrieve options for MS compilers from > distutils, for example and I would like to support building with and > without distutils' help). What are these options that must be retrieved? With a

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread David Cournapeau
Matthieu Brucher wrote: > Hi David ! > > Is it possible to construct a Python module with Scons without > tampering with different flags? I think you built your own builder > (just like I did), but did you manage to put it in Scons 0.98 ? Unfortunately, no. I had to make a choice on which featur

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread Matthieu Brucher
Hi David ! Is it possible to construct a Python module with Scons without tampering with different flags? I think you built your own builder (just like I did), but did you manage to put it in Scons 0.98 ? Matthieu 2008/4/23, David Cournapeau <[EMAIL PROTECTED]>: > > Sebastian Haase wrote: > > >

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread David Cournapeau
Sebastian Haase wrote: > > Hi Joris, > this is a great ( short ) recipe ! Could you elaborate on the line > "You need to compile myextension.cpp and make a shared library from > it. The easiest way is to use Scons with the constructor file:" > !? > How do you call Scons in your example !? On Window

Re: [Numpy-discussion] access ndarray in C++

2008-04-23 Thread Sebastian Haase
On Wed, Apr 23, 2008 at 3:56 AM, Joris De Ridder <[EMAIL PROTECTED]> wrote: > > > On http://www.scipy.org/JorisDeRidder I've just put an example how I passed > multidimensional Numpy arrays to C++ using ctypes. Perhaps it's helpful for > your application. I didn't put it in the cookbook yet, becaus

Re: [Numpy-discussion] access ndarray in C++

2008-04-22 Thread Robert Kern
On Tue, Apr 22, 2008 at 4:38 PM, Thomas Hrabe <[EMAIL PROTECTED]> wrote: > > Hi all! > > I am currently developing a python module in C/C++ which is supposed to > access nd arrays as defined by the following command in python > > a = numpy.array([1,1,1]) > > I want to access the array the follow

Re: [Numpy-discussion] access ndarray in C++

2008-04-22 Thread Joris De Ridder
On http://www.scipy.org/JorisDeRidder I've just put an example how I passed multidimensional Numpy arrays to C++ using ctypes. Perhaps it's helpful for your application. I didn't put it in the cookbook yet, because I would first like to test it a bit more. Up to now I didn't experience an

[Numpy-discussion] access ndarray in C++

2008-04-22 Thread Thomas Hrabe
Hi all! I am currently developing a python module in C/C++ which is supposed to access nd arrays as defined by the following command in python a = numpy.array([1,1,1]) I want to access the array the following way and use the nd array data for further processing in C. mymod.doSthg(a) The exam