[Numpy-discussion] complex arrays and ctypes

Sven Schreiber svetosch at gmx.net
Mon May 28 12:11:46 EDT 2007


Albert Strasheim schrieb:
> Hello
> 
> On Sun, 27 May 2007, Sven Schreiber wrote:
> 
>> Hi,
>> I am wondering whether it's possible to pass (and get back) arrays of
>> complex floats via ctypes.
>>
>> To be concrete, I have managed to access lapack's dgges (Fortran)
>> function using ctypes (thanks to a related example on this list), and
>> now I would like to do the same with the complex version zgges.
> 
> An array just gets passed to the function as a pointer, so the answer is 
> definately yes. Do you need some specific code?
> 

Thanks for offering, but indeed it already seems to work! I asked first
(before trying), because getting a ready-to-use lapack dll for Windows
that actually includes zgges is not trivial. (It turned out that the one
from scilab has it.)

And being totally ignorant in Fortran I didn't know what the equivalent
of Fortran's COMPLEX*16 is in numpy (complex128 seems to work here).

The ctypes integration in numpy is really great!

Thanks,
Sven




More information about the NumPy-Discussion mailing list