python - How to use Efficient indexing (numpy) in cython in both .pxd and .pyx file -


suppose have .pxd , .pyx file, use function argument : np.ndarray[dtype_double_t, ndim=1] weight, ctypedef in both file(pyx , pxd) occur: 'dtype_int_t' redeclared

my code following in both file start part:

import numpy np cimport numpy np cimport cython dtype_double = np.float64 dtype_int = np.int32 ctypedef np.float64_t dtype_double_t ctypedef np.int32_t dtype_int_t 

from cython documentation on pxd files

when accompanying equally named pyx file, provide cython interface cython module other cython modules can communicate using more efficient protocol python one.

this means copying declarations .pxd file .pyx file error included automatically. compile code, must remove duplication.

you have not stated why wish duplicate code, if important purpose please explain why or others can resolve issue.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -