Dag Sverre Seljebotn wrote:
It's for use during debugging -- also this is the behaviour Python gives.
Got it. However, this doesn't seem to work for me: #cython: nonecheck=True I get a bus error crash. If I use the decorator instead, it does work. real, useful code enclosed. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected]
import cython
import numpy as np
cimport numpy as np
#cython: nonecheck=True
@cython.boundscheck(False)
def halfsize(np.ndarray[np.uint8_t, ndim=3, mode="c"] a):
cdef unsigned int i, j, b, w, h, d
print "a test:", a[0,0,0]
w, h, d = a.shape[0], a.shape[1], a.shape[2]
cdef np.ndarray[np.uint8_t, ndim=3, mode="c"] a2 = np.ndarray((w/2, h/2,
3), np.uint8)
for i in range(w/2):
for j in range(h/2):
for b in range(d): # color band
a2[i,j,b] = (<int>a[2*i,2*j,b] + a[2*i+1,2*j,b] +
a[2*i,2*j+1,b] + a[2*i+1,2*j+1,b])/4
return a2
test_cython_none2.py
Description: application/python
_______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
