我有一个 numpy 布尔数组:
myarr = np.array([[False, True], [True, False]])
如果我尝试用它初始化 Cython MemoryView,如下所示:
cdef bint[:,:] mymem = myarr
我收到此错误:
ValueError: Does not understand character buffer dtype format string ('?')
如果我这样做,它工作正常:
cdef np.int_t[:,:] mymem = np.int_(myarr)
如何使用 Cython MemoryViews 存储布尔 numpy 数组?