Cython: can't convert Python object to 'double *'

前端 未结 3 1507
心在旅途
心在旅途 2021-02-06 04:26

I\'m writting a Cython wrapper to a C function. I have a pxd file with the following signature:

double contr_hrr(int lena, double xa, double ya, double za, doubl         


        
3条回答
  •  春和景丽
    2021-02-06 05:15

    What I finally did was to make sure that the anorms arrays were maintained as arrays in the python part of the code, and then followed Nikita's recipe to convert them on the fly to doubles using the .data.as_doubles property. If I do this, it appears to have very little overhead compared to doing everything natively in C.

    Haven't yet experimented with the numpy approach, for a variety of mundane reasons.

提交回复
热议问题