[SciPy-Dev] Expose Lapack for Cython

Sturla Molden sturla.molden at gmail.com
Wed Nov 19 21:31:27 EST 2014


On 19/11/14 20:27, Ian Henriksen wrote:

> Another alternative would be to put these modules all in a new submodule
> of scipy.linalg. The current version in the pull request does this, but
> the submodule is called "cython" and that is causing name collision issues.
> The submodule could instead be called "cylinalg" or "cython_wrappers", or
> something else along those lines.

I think that special memoryview versions will be a hard nut to crack 
because there it is not obvious what the API should be. A memory has 
metadata while a Fortran 77 array has not, so metadata is typically 
passed along with the array in BLAS and LAPACK subroutines. 
memoryvrappers would probably also be expected to ensure correct 
alignment of the array and ensure it is Fortran contiguous.

C pointer versions can easily be used with typed memoryviews, just pass 
the address of the first element.

The important part is to get the versions with C pointers working. I am 
not sure the hypothetical memoryview versions, for which API is not even 
thought through, will ever be realized. If you use the metadata in typed 
memoryviews the API deviate so much from LAPACK that we might just as 
well use scipy.linalg Python functions. If you don't use the metadata 
they don't add any value beyond the C pointer versions.

All in all, I think what you should do is ignore memoryviews and just 
focus on getting the C pointers versions ready for SciPy 0.15.0. The 
ideas of creating a typed memoryview abstraction for LAPACK is 
distracting the important work.


Sturla




More information about the SciPy-Dev mailing list