Also, in numpy 1.8.2 (mit Python 2.7.6) scheint ein Problem in Array-Division. Bei der In-Place-Division eines ausreichend großen Arrays (mindestens 8192 Elemente, mehr als eine Dimension, Datentyp ist irrelevant) mit einem Teil von sich selbst ist das Verhalten für verschiedene Notationen inkonsistent.Unerwartetes Verhalten in numpy, beim Teilen von Arrays
import numpy as np
arr = np.random.rand(2, 5000)
arr_copy = arr.copy()
arr_copy = arr_copy/arr_copy[0]
arr /= arr[0]
print np.sum(arr != arr_copy), arr.size - np.sum(np.isclose(arr, arr_copy))
Der Ausgang 0 sein soll, da die beiden Divisionen konsequent sein sollte, aber es ist 1808. Ein Bug ist das? Tritt es auch in anderen numpigen Versionen vor?
Ein Kollege wies darauf hin, dass dieses Verhalten darauf zurückzuführen sein könnte, dass arr [0] nur eine Ansicht von arr ist und daher während der In-Place-Operation verändert wurde. – Dschoni