Re: Error compiling cython with numpy arrays
Justin <justdivs <at> gmail.com>
2012-04-01 16:28:04 GMT
Yes, I've always been in the habit of importing numpy as nu.
I've written another program just to see which aspects of cython are
working and which aren't, so I can just show that source here.
The original had no problems other than the type declarations, it
compiled once I removed any ndarray type declarations, but I'm
concerned about speed losses since my algorithm has a lot of looping
over the arrays.
Basically, I've written the following useless program to test
compilation and execution speed:
import numpy as nu
cimport numpy as nu
from libc.math cimport sqrt
cdef double sqrt(double x):
#cdef nu.ndarray[nu.float,ndim=1] start=nu.zeros(10000)
#cdef nu.ndarray start=nu.zeros(10000,dtype=nu.float)
def run_test(int n_loops):
int i, j, l