[Numpy-discussion] numpy.i and std::complex

Glen Mabey gmabey at swri.org
Mon Oct 27 12:04:47 EDT 2014


On Oct 27, 2014, at 10:45 AM, Sturla Molden <sturla.molden at gmail.com>
 wrote:

> Glen Mabey <gmabey at swri.org> wrote:
> 
>> I'd really like for this to be included alongside numpy.i -- but maybe I
>> overestimate the number of numpy users who use complex data (let your
>> voice be heard!) and who also end up using std::complex in C++ land.
> 
> I don't think you do. But perhaps you overestimate the number of NumPy
> users who use Swig?

Likely so.

> Cython seems to be the preferred wrapping tool today, and it understands
> complex numbers:
> 
>    cdef double complex J = 0.0 + 1j
> 
> If you tell Cython to emit C++, this will result in code that uses
> std::complex<double>. 

I chose swig after reviewing the options listed here, and I didn't see cython on the list:

http://docs.scipy.org/doc/numpy/user/c-info.python-as-glue.html

I guess that's because cython is different language, right?  So, if I want to interactively call C++ functions from say ipython, then is cython really an option?

Thanks for the feedback --
Glen


More information about the NumPy-Discussion mailing list