I am creating a function to solve differential equations. The structure of my package is the following:
package
|- integrate
|- signature.pxd
|- rk4.pyx
|- euler.pyx
signature.pxd contains the template of the function that has to be defined and given in input to rk4.pyx and euler.pyx.
The content of signature.pxd is:
import numpy as np
cimport numpy as np
ctypedef np.float64_t FLOAT
cdef class ProblemOde:
cpdef np.ndarray[FLOAT, ndim=1] evaluate(self, double t, np.ndarray[FLOAT, ndim=1] y):
return np.ndarray([])
My problem is that I am not able to import it in rk4.pyx and euler.pyx. I cannot use neither absolute or relative import and if I write:
cimport signature
from signature cimport ProblemOde
I get the error: 'signature.pxd' not found
What am I missing? How can I do that?
Thanks a lot!
EDIT: here the setup.py
# built-in/generic imports
import os
from distutils.core import setup
# third-party imports
from Cython.Build import cythonize
import numpy as np
# list of packages eopack
__module_dir__ = os.path.abspath(os.path.dirname(__file__))
packages_eopack = [os.path.join(__module_dir__, 'package', 'integrate', 'rk4.pyx'),
os.path.join(__module_dir__, 'package', 'integrate', 'euler.pyx')]
# compiler directives
directives = {'language_level': '3',
'always_allow_keywords': True}
# compile
setup(ext_modules=cythonize(packages_eopack, compiler_directives=directives, annotate=True),
include_dirs=[np.get_include()])