I want to overwrite some array values for a min-finding algorithm.
For these examples, I want the values of the first row to be replaced by math.inf.
It works fine in example c, but I don't understand what happens in a and b:
import numpy as np
import math
a = np.repeat(0, 9).reshape((3, 3))
a[0, :] = np.ones((3,)) * math.inf
print(a)
b = np.arange(9).reshape((3, 3))
b[0, :] = np.ones((3,)) * math.inf
print(b)
c = np.empty((3, 3))
c[0, :] = np.ones((3,)) * math.inf
print(c)
Output: shows infinity as the row entry in example c, but -9223372036854775808 in example a and b.
Why does the existing output have an influence when I overwrite it?
