Re: [Numpy-discussion] How to call methods from a class with custom matrices parameters with numpy arrays ?

2007-04-20 Thread Matthieu Brucher
Well, that's easy ;) OK, I have to digg in for the transformations of numpy arrays, knowing that I have other parameters. But for this, the Cookbook at scipy should help me a lot. Thanks for the help ;) Matthieu Ok, I have a simple working example. It is actually much easier than I thought,

Re: [Numpy-discussion] How to call methods from a class with custom matrices parameters with numpy arrays ?

2007-04-20 Thread Matthieu Brucher
2007/4/20, Matthieu Brucher [EMAIL PROTECTED]: Well, that's easy ;) OK, I have to digg in for the transformations of numpy arrays, knowing that I have other parameters. But for this, the Cookbook at scipy should help me a lot. Thanks for the help ;) Matthieu Some news, I finished the

[Numpy-discussion] How to call methods from a class with custom matrices parameters with numpy arrays ?

2007-04-19 Thread Matthieu Brucher
Hi, I want to wrap some code I've done in the past with a custom array and pass numpy arrays to it. So I need to transform numpy arrays to my arrays at the construction of an instance of my class, as well as each call to a method (pass by value). Then, some method return by value an array I have

Re: [Numpy-discussion] How to call methods from a class with custom matrices parameters with numpy arrays ?

2007-04-19 Thread Matthieu Brucher
You should give ctypes a try, I find it much better than swig most of the time for wrapping. You can find some doc here: http://www.scipy.org/Cookbook/Ctypes2 Basically, once you get your dll/so with a function foo(double *a, int n), you can call it directly in numpy by passing

Re: [Numpy-discussion] How to call methods from a class with custom matrices parameters with numpy arrays ?

2007-04-19 Thread David Cournapeau
Matthieu Brucher wrote: You should give ctypes a try, I find it much better than swig most of the time for wrapping. You can find some doc here: http://www.scipy.org/Cookbook/Ctypes2 Basically, once you get your dll/so with a function foo(double *a, int n), you

Re: [Numpy-discussion] How to call methods from a class with custom matrices parameters with numpy arrays ?

2007-04-19 Thread David Cournapeau
On 4/19/07, Matthieu Brucher [EMAIL PROTECTED] wrote: I forgot you are using C++. Yes, all my code is in C++, and in fact the code I use in Python should be object-oriented as well, that's why it is not that easy to define how I'm going to do this... Doing the wrapping in an object

Re: [Numpy-discussion] How to call methods from a class with custom matrices parameters with numpy arrays ?

2007-04-19 Thread Bill Baxter
This may be of no help at all but I see mentions of C++/Python/OO/SWIG and it triggers me to mention something I heard about recently called PyCXX: http://cxx.sourceforge.net/ I /think/ the idea behind it is to basically make a C++ version of the Python C API. You still do all the wrapping

Re: [Numpy-discussion] How to call methods from a class with custom matrices parameters with numpy arrays ?

2007-04-19 Thread David Cournapeau
Matthieu Brucher wrote: Doing the wrapping in an object oriented way is difficult, and maybe not that useful. This does not prevent the API exposed to python to be OO, of course. I have some difficulties to do this in an automated way... I'm trying now to make a derived