Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
想象一下,我有
a = np.memmap(..) b = np.memmap(..)
我想获得元素明智的结果和更新。
a = a[0:size1:2] * b[1:size1:3]
假设a[0:size1:2]和b[1:size1:3]是相同的维度(或至少可广播),您可以使用 numpy 数组切片共享内存的事实:
a[0:size1:2]
b[1:size1:3]
temp_a = a[0:size1:2] temp_a *= b[1:size1:3]
这将仅更新 中的a值temp_a。
a
temp_a