[Numpy-discussion] default float type of array not accepted by SWIG wrapped C functions
Spotz, William F
Thu Jan 22 11:09:01 CST 2009
Basic python only supports double precision floats, so that is not an option.
NumPy does not have, as far as I know, a way to set the default precision, although it might be a reasonable request.
As for the SWIG interface file, almost anything is possible. Can you give an example of a function prototype you are wrapping, the %apply directive you use and and example of python code accessing it?
From: email@example.com [firstname.lastname@example.org] On Behalf Of Rich E [email@example.com]
Sent: Thursday, January 22, 2009 11:45 AM
To: Discussion of Numerical Python
Subject: [Numpy-discussion] default float type of array not accepted by SWIG wrapped C functions
I have a SWIG wrapped C library that uses 32bit floating point arrays,
using the numpy.i typemapping system for passing the arrays. For
every array that I make, I have to convert it using astype('float32'),
else python complains that I tried to pass a double-precision array.
Is there any way to set the default floating point precision to 32bit,
in python or in the SWIG interface file?
Numpy-discussion mailing list
More information about the Numpy-discussion