[Pythonmac-SIG] Compiling Scipy/available binaries for Universal Python 2.4?

David M. Cooke cookedm at physics.mcmaster.ca
Sat Jan 13 23:39:25 CET 2007


On Jan 12, 2007, at 11:49 , Robert Kern wrote:

> Christopher Barker wrote:
>> Robert Kern wrote:
>>> Yup. -framework Accelerate
>>
>> Robert, just so we're clear here. If one does a straight "setup.py
>> build" with numpy 1.0.1, do you get a version that uses Veclib? I do
>> understand that that is the Fortran-compatible version, and thus may
>> result in some extra copying to shift between row and column major
>> ordering. By the way, if one were to take care to use Fortran ordered
>> numpy arrays, would you avoid that copying?
>
> Yes. Both with numpy and scipy.

As long as your arrays are contiguous, it won't matter whether they  
are C-ordered or Fortran-ordered. Pretty much every BLAS routine  
takes an argument that says whether to use the array as-is, or the  
transpose (or the Hermitian conjugate in the case of complex arrays).  
That's how the C wrappers of Fortran BLAS routines work. The tranpose  
of a Fortran-ordered array is the original array as C-ordered.

For instance, in Fortran to calculate AB=C, you'd do something like  
DGEMM('N','N',A,B), and to caculate A^T B, something like DGEMM 
('T','N',A,B). In C, if A and B are C-ordered, for AB you'd call the  
Fortran routine like so: DGEMM('T','T', B, A), which does B^T A^T =  
C^T, and C will be the C-ordered result of AB.

The underlying implementations of the BLAS routines are pretty much  
always the same for the C interface and the Fortran interface.

-- 
|>|\/|<
/------------------------------------------------------------------\
|David M. Cooke              http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca



More information about the Pythonmac-SIG mailing list