How to use a C function with complex types in Python?

后端 未结 2 427
伪装坚强ぢ
伪装坚强ぢ 2021-01-15 07:57

I decided to port some of my Python functions to C, mostly following this simple tutorial. Problem is that my C function returns a complex float, and there\'s no correspondi

2条回答
  •  再見小時候
    2021-01-15 08:38

    Naively, perhaps split it into two arguments, Re(z), Im(z) If that's not an option, perhaps pass the argument to the python function complex().

    These are naive solutions; perhaps they don't work but if you haven't considered it and in lack of better responses, may be worth experimenting with.

    Good luck!

提交回复
热议问题