[Numpy-discussion] Apparently Non-deterministic behaviour of complex-array instantiation values
pav at iki.fi
Mon Dec 3 15:19:54 EST 2012
03.12.2012 22:10, Karl Kappler kirjoitti:
> I.e.. the imaginary part is initialized to a different value. From
> reading up on forums I think I understand that when an array is
> allocated without specific values, it will be given random values which
> are very small, ie. ~1e-316 or so. But it would seem that sometimes
> initallization is done to a finite quantity. I know I can try to
> initialize the array using np.zeros() instead of np.ndarray(), but it is
> the principle I am concerned about.
The memory is not initialized in any way [*] if you get the array from
np.empty(..) or np.ndarray(...). It contains whatever that happens to be
at that location. It just happens that "typical memory content" when
viewed in floating point often looks like that.
[*] Except that the OS zeroes new memory pages given to the process.
Processes however reuse the pages they are given.
More information about the NumPy-Discussion