[Numpy-discussion] Re: [SciPy-dev] unique hanging?
Jonathan Taylor
jonathan.taylor at stanford.edu
Tue Mar 14 20:32:01 EST 2006
thanks for the reply.
i could be wrong, but this problem seemed to appear only when i updated
svn -- i had a very similar
example before with N.nan that seemed fine....
-- jonathan
Sasha wrote:
>This really belongs to numpy-discussion.
>
>What you observe is probably the consequence of nan not being equal to itself:
>
>
>
>>>>N.equal(N.nan,N.nan)
>>>>
>>>>
>False
>
>Many algorithms would fail to terminate or produce wrong results when
>they encounter such an anomaly.
>
>For example:
>
>
>
>>>>N.sort([N.nan,5, N.nan, 3])
>>>>
>>>>
>array([ nan, 5. , nan, 3. ])
>
>This is unfortunate, but not really a bug. I would suggest that we
>document which numpy functions are nan safe and which are not.
>
>
>
>On 3/14/06, Jonathan Taylor <jonathan.taylor at stanford.edu> wrote:
>
>
>>hi all,
>>
>>apologize if this is not the right list -- in the latest svn of numpy
>>unique seems to be taking a long time with "nan"
>>
>>reproducible error:
>>
>>-------------------------------------------------------------------------------------------
>>import numpy as N
>>import numpy.random as R
>>
>>x = R.standard_normal((100000,))
>>x = N.around(x * 100.) / 100.
>>
>>print len(N.unique(x))
>>
>>x[0] = N.nan
>>print len(N.unique(x))
>>
>>
>>x[0:50000] = N.nan
>>print 'OK'
>>
>>print len(N.unique(x))
>>
>>
>>--
>>------------------------------------------------------------------------
>>I'm part of the Team in Training: please support our efforts for the
>>Leukemia and Lymphoma Society!
>>
>>http://www.active.com/donate/tntsvmb/tntsvmbJTaylor
>>
>>GO TEAM !!!
>>
>>------------------------------------------------------------------------
>>Jonathan Taylor Tel: 650.723.9230
>>Dept. of Statistics Fax: 650.725.8977
>>Sequoia Hall, 137 www-stat.stanford.edu/~jtaylo
>>390 Serra Mall
>>Stanford, CA 94305
>>
>>
>>
>>_______________________________________________
>>Scipy-dev mailing list
>>Scipy-dev at scipy.net
>>http://www.scipy.net/mailman/listinfo/scipy-dev
>>
>>
>>
>>
>>
>>
--
------------------------------------------------------------------------
I'm part of the Team in Training: please support our efforts for the
Leukemia and Lymphoma Society!
http://www.active.com/donate/tntsvmb/tntsvmbJTaylor
GO TEAM !!!
------------------------------------------------------------------------
Jonathan Taylor Tel: 650.723.9230
Dept. of Statistics Fax: 650.725.8977
Sequoia Hall, 137 www-stat.stanford.edu/~jtaylo
390 Serra Mall
Stanford, CA 94305
More information about the NumPy-Discussion
mailing list