[SciPy-Dev] TestNorm.test_stable failure [was ANN: SciPy 0.11.0 release candidate 2]

Rüdiger Kessel ruediger.kessel at gmail.com
Sat Sep 22 12:14:48 EDT 2012


Hi,

test_basic.TestNorm.test_stable is very sensitive against the
implementation of the basic BLAS routine snrm2() as I have explained
before.
Its good to tell implementations apart, but it is not very robust.

A pure float32 implementation of snrm2() will give 10000.0 for norm(a).
An internal double implementation with rounding to float32 at the end
gives 10000.5 for norm(a).
A mixed implementation with rounding to float32 before rescaling gives
10000.4990234375 for norm(a).

I have not looked into the implementation in ATLAS. I just played with
my python implementation to see if I can find an explanation.

I think the problem here is that for matrix a some data was chosen
where a pure float32 implementation of snrm2() will not give a precise
result. So any implementation with gives something in the range from
10000.0 to 10000.5 need to be considered as correct.

Maybe it would be better to chose data where rounded double and
float32 implementation will give the same result like:

a = array(range(90000,100000), dtype=float32)/10.0

norm(a) should give 950434.0 for any implementation.

Ruediger

2012/9/22 Ralf Gommers <ralf.gommers at gmail.com>:
>
>
> On Sat, Sep 8, 2012 at 9:38 PM, <josef.pktd at gmail.com> wrote:
>>
>>
>> -------------------------
>> If I just unzip the superpack instead of installing the sse3, I get
>> only one failure
>>
>> ======================================================================
>> FAIL: test_basic.TestNorm.test_stable
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>   File
>> "E:\Josef\testing\tox\py27b\lib\site-packages\nose-1.1.2-py2.7.egg\nose\case.py",
>> line 197, in runTest
>>     self.test(*self.arg)
>>   File
>> "E:\Josef\testing\tox\py27b\lib\site-packages\scipy\linalg\tests\test_basic.py",
>> line 592, in
>> test_stable
>>     assert_almost_equal(norm(a) - 1e4, 0.0, err_msg=msg)
>>   File
>> "E:\Josef\testing\tox\py27b\lib\site-packages\numpy-1.6.2-py2.7-win32.egg\numpy\testing\utils.py",
>> line 468, in assert_almost_equal
>>     raise AssertionError(msg)
>> AssertionError:
>> Arrays are not almost equal to 7 decimals
>> : Result should equal either 0.0 or 0.5 (depending on implementation of
>> snrm2).
>>  ACTUAL: 0.4990234375
>>  DESIRED: 0.0
>>
>> maybe some sse incompatibilities.
>
>
> This one keeps on coming back. We fixed the test for allowing 0.0 or 0.5,
> but it can also just break like this. It does so at least for some people on
> OS X 10.8 and on Windows. Since the problem seems to be in ATLAS /
> Accelerate, should we leave it as is or not?
>
> Ralf
>
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>



More information about the SciPy-Dev mailing list