[Numpy-discussion] strange behavior of numpy.random.multivariate_normal, ticket:1842
Thu Feb 16 07:46:01 CST 2012
On Thu, Feb 16, 2012 at 8:14 AM, <email@example.com> wrote:
> On Thu, Feb 16, 2012 at 4:44 AM, Pauli Virtanen <firstname.lastname@example.org> wrote:
>> 16.02.2012 06:09, email@example.com kirjoitti:
>>> numpy linalg.svd doesn't produce always the same results
>>> running this gives two different answers,
>>> using scipy.linalg.svd I always get the same answer, which is one of
>>> the numpy answers
>>> (numpy random.multivariate_normal is collateral damage)
>> Are you using a Windows binary for Numpy compiled with the Intel
>> compilers, or maybe linked with Intel MKL?
> This was with the official numpy installer, compiled with MingW
> I just tried with 64 bit python 3.2 with MKL (Gohlke installer) and in
> several runs I always get the same answer.
>> If yes, one possibility is that the exact sequence of floating point
>> operations in SVD or some other step in the calculation depends on the
>> data alignment, which can affect rounding error.
>> See http://www.nccs.nasa.gov/images/FloatingPoint_consistency.pdf
>> That would explain why the pattern you see is quasi-deterministic. The
>> other explanation would be using uninitialized memory at some point, but
>> that seems quite unlikely.
> Running the script on the commandline I always get several patterns,
> but running the script in the same process didn't converge to a unique
> We had other cases of several patterns in quasi-deterministic linalg
> before, but as far as I remember only in the final digits of
> precision, where it didn't matter much except for reducing test
> precision in my cases.
> In the random multivariate normal case in the ticket the differences
> are large, which makes them pretty unreliable and useless for
Is there anything special, or are there specific numerical problems
with an svd when most singular values are the same ?
The example has all random variables equal correlated
array([ 3.84604989, 0.68377223, 0.68377223, 0.68377223, 0.68377223,
0.68377223, 0.68377223, 0.68377223, 0.68377223, 0.68377223])
>> Pauli Virtanen
>> NumPy-Discussion mailing list
More information about the NumPy-Discussion