[Numpy-discussion] Wrong treatment of byte-order.

Nadav Horesh nadavh at visionsense.com
Wed Aug 31 01:37:19 EDT 2011


Hi,

 This is my second post on this problem I found in numpy 1.6.1, and recently it cam up in the latest  git version (2.0.0.dev-f3e70d9). The problem is numpy treats the native byte order ('<') as illegal while the wrong one ('>') as the right one. The output of the attached script (bult for python 2.6 + ) is given below (my system is a 64 bit linux on core i7.  64 bit python 2.7.2/3.2 , numpy uses ATLAS):

$ python test_byte_order.py
 a =
 [[ 0.28596132  0.31658824  0.34929676]
 [ 0.48739246  0.68020533  0.39616588]
 [ 0.29310406  0.9584545   0.8120068 ]]

 a1 =
 [[ 0.28596132  0.31658824  0.34929676]
 [ 0.48739246  0.68020533  0.39616588]
 [ 0.29310406  0.9584545   0.8120068 ]]

(Wrong byte order on Intel CPUs):
 a2 =
 [[  8.97948198e-017   1.73406416e-025  -4.25909057e+014]
 [  4.59443694e+090   7.91693101e-029   5.26959329e-135]
 [  2.93240450e+060  -2.25898860e-051  -2.06126917e+302]]

Invert a:
OK
 Invert a2 (Wrong byte order!):
OK
 invert a1:
Traceback (most recent call last):
  File "test_byte_order.py", line 20, in <module>
    b1 = N.linalg.inv(a1)
  File "/usr/lib64/python2.7/site-packages/numpy/linalg/linalg.py", line 445, in inv
    return wrap(solve(a, identity(a.shape[0], dtype=a.dtype)))
  File "/usr/lib64/python2.7/site-packages/numpy/linalg/linalg.py", line 326, in solve
    results = lapack_routine(n_eq, n_rhs, a, n_eq, pivots, b, n_eq, 0)
lapack_lite.LapackError: Parameter a has non-native byte order in lapack_lite.dgesv
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110830/764ba499/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test_byte_order.py
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110830/764ba499/attachment.ksh>


More information about the NumPy-Discussion mailing list