<分区> 分区>
我需要一个 2d n x n bool 数组,它使用尽可能接近 n^2 位的内存。我需要的操作是能够快速设置和读取由 (x,y) 坐标索引的各个位。有没有在 python 和/或 numpy 中执行此操作的好方法?