Closed JamesPino closed 6 years ago
@JamesPino I've implemented Cython compiling for ScipyOdeSimulator using cython.inline
rather than an extension as above, in pysb/pysb#320. It's slightly slower than weave (but not by much). If you have any performance tips for that PR that'd be helpful. Thanks.
scipy_weave is deprecated. http://docs.scipy.org/doc/scipy/reference/weave.html
So I propose to create a RHS.pyx and compile with cython. Then we can pass ode this function. Similar example of creating a cython file and compiling from within a python file is found in https://github.com/LoLab-VU/LogicalModel/main_attractor_synch_cython.py
Example. pyxfile = open(prefix+'.pyx','w') outstring = \ 'from future import division\ \nimport numpy as np\ \ncimport numpy as np\ \ncimport cython\ \n\nDTYPE = np.int\ \nctypedef np.int_t DTYPE_t\ \n@cython.boundscheck(False)\ \ndef function(np.ndarray[DTYPE_t, ndim=1] x):\ \n\tcdef unsigned int vectorsize = %d\ \n\tcdef np.ndarray[DTYPE_t, ndim=1] vector = np.zeros([vectorsize],dtype=int)\n'%numNodes for line in functions:
Replace function name