[Scipy-tickets] [SciPy] #1153: scipy.weave does not work well with big-endian numpy arrays

SciPy Trac scipy-tickets@scipy....
Tue Apr 13 10:28:17 CDT 2010

#1153: scipy.weave does not work well with big-endian numpy arrays
 Reporter:  trobitaille  |       Owner:  somebody
     Type:  defect       |      Status:  new     
 Priority:  high         |   Milestone:  0.8.0   
Component:  scipy.weave  |     Version:  devel   
 Keywords:               |  
 The following code:

 import numpy as np
 from scipy.weave import converters
 import scipy.weave as weave

 nx = 10
 x = np.logspace(-5, 4, nx).astype('>f4')
 y = np.logspace(-5, 4, nx).astype('<f4')

 code = """
        for (int i=0; i<nx-1; ++i) {
           printf("%11.3e %11.3e \\n",x(i), y(i));
        return_val = 0;

 weave.inline(code, ['x', 'y', 'nx'], type_converters=converters.blitz)

 produces the following output:

  -5.603e-12   1.000e-05
   1.188e-24   1.000e-04
   4.534e+28   1.000e-03
   2.072e-32   1.000e-02
  -4.295e+08   1.000e-01
   4.601e-41   1.000e+00
   1.157e-41   1.000e+01
   7.184e-41   1.000e+02
   4.386e-41   1.000e+03

 This suggests that big-endian numpy arrays are not correctly converted
 when passed to the C code in weave.

Ticket URL: <http://projects.scipy.org/scipy/ticket/1153>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.

More information about the Scipy-tickets mailing list