ensure contiguous arrays for Cython