Re: [Numpy-discussion] [NumPy/Swig] Return NumPy array with same size as input array (no additional length argument)

2015-11-02 Thread Chris Barker
On Fri, Oct 30, 2015 at 11:15 PM, laurentes wrote: > Using Swig, I don't manage to (properly) create the Python Binding for the > following C-like function: > > void add_array(double* input_array1, double* input_array2, double* > output_array, int length); > > where the three arrays have all the

[Numpy-discussion] [NumPy/Swig] Return NumPy array with same size as input array (no additional length argument)

2015-10-30 Thread laurentes
Hello, Using Swig, I don't manage to (properly) create the Python Binding for the following C-like function: void add_array(double* input_array1, double* input_array2, double* output_array, int length); where the three arrays have all the same length. This is similar to this thread

Re: [Numpy-discussion] Numpy + SWIG

2012-06-04 Thread Chris Barker
HAVe you discovered the numpy.i interface files? I haven't done SWIG in a while, but they should take care of at least some of this for you. They used to be distributed with numpy (in docs?), but some googling should find then in any case. -Chris On Mon, Jun 4, 2012 at 2:00 PM, Gideon Simpson

[Numpy-discussion] Numpy + SWIG

2012-06-04 Thread Gideon Simpson
There are two types of swig problems that I was hoping to get some help with. First, suppose I have some C function void f(double *x, int nx, double *y, int ny); where we input one array, and we output another array, both of which should be the same size. I have used in my .i file: %apply(doub

[Numpy-discussion] Numpy, swig and docstring

2010-06-13 Thread Fabrice Silva
Hi folks, I am trying to wrap a library with swig, distutils and numpy, and am facing troubles. In fact, swig documentation mention that it is possible to mention a module docsstring in the %module directive : %module(docstring="This is the example module's docstring") example where example is t

Re: [Numpy-discussion] Numpy+SWIG with arrays in input and output of a function

2010-04-16 Thread Antoine Delmotte
Thank you very much for your help, Bill. It works perfectly now! On 16/04/10 02:07, Bill Spotz wrote: > Antoine, > > You want a python function with two python array arguments, therefore > you are dealing with two different typemaps, each of which requires > its own %apply directive: > > %apply (d

Re: [Numpy-discussion] Numpy+SWIG with arrays in input and output of a function

2010-04-15 Thread Bill Spotz
Antoine, You want a python function with two python array arguments, therefore you are dealing with two different typemaps, each of which requires its own %apply directive: %apply (double* IN_ARRAY1, int DIM1) {(double* vec , int m)}; %apply (double* ARGOUT_ARRAY1, int DIM1) {(double* vec

[Numpy-discussion] Numpy+SWIG with arrays in input and output of a function

2010-04-15 Thread Antoine Delmotte
Dear Numpy and SWIG users, I am currently trying to use SWIG and Numpy to launch C++ codes from python. My C++ code takes an array as an input (as well as integers, but this will be my next problem...) and returns a different array (with different dimensions). I have managed to make ve

Re: [Numpy-discussion] numpy, swig and TNT-Arrays

2008-11-12 Thread Ravi
On Tuesday 11 November 2008 04:19:26 am Rolf Wester wrote: > I'm not sure whether TNT is still actively maintained, the TNT home page > was last modified in 2004, so you are probably right. But the TNT Arrays > are just what I need and I know of no alternative. Use boost.python + boost.ublas + num

Re: [Numpy-discussion] numpy, swig and TNT-Arrays

2008-11-11 Thread Hoyt Koepke
Hi Rolf, Just curious -- have you considered using the blitz++ library (http://www.oonumerics.org/blitz/)? There seems to be a lot of overlap in terms of functionality. If you use blitz++, it's largely included in scipy as part of weave. Additionally, I already have code that generates wrappers

Re: [Numpy-discussion] numpy, swig and TNT-Arrays

2008-11-11 Thread Rolf Wester
Charles R Harris wrote: > On Tue, Nov 11, 2008 at 2:19 AM, Rolf Wester > <[EMAIL PROTECTED]>wrote: > >> Charles R Harris wrote: >>> On Tue, Nov 11, 2008 at 1:24 AM, Rolf Wester >>> <[EMAIL PROTECTED]>wrote: >>> Hi all, I would like to wrap some C++ classes that use TNT-Arrays. Is it

Re: [Numpy-discussion] numpy, swig and TNT-Arrays

2008-11-11 Thread Matthieu Brucher
Hi, Yes, you can, but it can be tricky. What you may need to do is to check if TNT is capable of accepting an array by pointer without handling the memory (delete when the array is destroyed). If there are tools to do this, then it will be easy. If not, you will have to add a specific handler eith

Re: [Numpy-discussion] numpy, swig and TNT-Arrays

2008-11-11 Thread Charles R Harris
On Tue, Nov 11, 2008 at 2:19 AM, Rolf Wester <[EMAIL PROTECTED]>wrote: > Charles R Harris wrote: > > On Tue, Nov 11, 2008 at 1:24 AM, Rolf Wester > > <[EMAIL PROTECTED]>wrote: > > > >> Hi all, > >> > >> I would like to wrap some C++ classes that use TNT-Arrays. Is it > >> possible to pass numpy ar

Re: [Numpy-discussion] numpy, swig and TNT-Arrays

2008-11-11 Thread Rolf Wester
Charles R Harris wrote: > On Tue, Nov 11, 2008 at 1:24 AM, Rolf Wester > <[EMAIL PROTECTED]>wrote: > >> Hi all, >> >> I would like to wrap some C++ classes that use TNT-Arrays. Is it >> possible to pass numpy arrays to C++ functions that expect TNT-Arrays as >> function parameter? Does anybody kno

Re: [Numpy-discussion] numpy, swig and TNT-Arrays

2008-11-11 Thread Charles R Harris
On Tue, Nov 11, 2008 at 1:24 AM, Rolf Wester <[EMAIL PROTECTED]>wrote: > Hi all, > > I would like to wrap some C++ classes that use TNT-Arrays. Is it > possible to pass numpy arrays to C++ functions that expect TNT-Arrays as > function parameter? Does anybody know how the wrappers could be > gener

[Numpy-discussion] numpy, swig and TNT-Arrays

2008-11-11 Thread Rolf Wester
Hi all, I would like to wrap some C++ classes that use TNT-Arrays. Is it possible to pass numpy arrays to C++ functions that expect TNT-Arrays as function parameter? Does anybody know how the wrappers could be generated using swig? I would be very appreciative for any help. With kind regards Rol