Hi,
# OK, but slow
cdef double[:,:] a = np.zeros((10, 10), float)
# OK, fast (no Python object)
cdef double[10] a
# OK, but slow, makes Python calls (-> cython.view array)
cdef double[10*10] a_
cdef double[:,:] a = <double[:10,:10]>(<double*>a_)
# not allowed
cdef double[10,10] a
Small N-d work arrays are quite often needed in numerical code, and I'm
not aware of a way for conveniently getting them in Cython.
Maybe the recently added improved memoryviews could allow for
Python-less N-dim arrays? This may be reinveinting a certain language,
but such a feature would find immediate practical use.
--
Pauli Virtanen
_______________________________________________
cython-devel mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cython-devel