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
from __future__ import print_function
import numpy as N

a = N.random.rand(3,3)
a1 = a.newbyteorder('<')
a2 = a.newbyteorder('>')
print(' a = \n', a)
print('\n\n a1 = \n', a1)
print('\n\n(Wrong byte order on Intel CPUs):\n a2 =\n', a2)

print('\n\n Invert a:')
b = N.linalg.inv(a)
print('OK')

print('\n Invert a2 (Wrong byte order!):')
b2 = N.linalg.inv(a2)
print('OK')

print('\n invert a1:')
b1 = N.linalg.inv(a1)
print('OK')
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to