from cython cimport locals
ctypedef double[:] Vector
ctypedef double[:,:] Matrix
@locals(i=int, j=int, s=double, Y=Vector)
cdef Vector test(Matrix X)
in test.py:
import numpy as np
def test(a):
Y = np.ndarray((a.shape[1],), dtype=np.double )
for i in range(a.shape[0]):
s = 0.0
for j in range(a.shape[1]):
s += a[i,j]
Y[i] = s
return Y
Is there a way to add support of typed memory views declaration in @locals decorator?
пятница, 24 мая 2013 г., 23:25:45 UTC+4 пользователь Zaur Shibzukhov написал: