On 07/12/2011 04:10 PM, Daniel Wheeler wrote:
> On Tue, Jul 12, 2011 at 3:51 AM, Dag Sverre Seljebotn
> <[email protected]> wrote:
>> On 07/11/2011 11:01 PM, Daniel Wheeler wrote:
>>> Hi, I am trying to find the eigenvalues and eigenvectors as well as
>>> the inverse for a large number of small matrices. The matrix size
>
>> If you want to go the Cython route, here's a start:
>>
>> http://www.vetta.org/2009/09/tokyo-a-cython-blas-wrapper-for-fast-matrix-math/
>
> Thanks for the heads up. Looks like an option. Presumably, it would
> still have to use "map" even with more direct access to BLAS (still
> going C<-> python for every matrix)? Also, adding extra non-standard
> dependencies is a problem as this code is part of a production code
> that's passed onto others.
>
I was thinking you'd use it as a starting point, and actually write
low-level for-loops indexing the buffer data pointers in Cython.
If you make sure that np.ascontiguousarray or np.asfortranarray, you can do
cimport numpy as np
np.import_array()
...
def func(np.ndarray[double, ndim=3, mode='fortran'] arr):
double *buf = <double*>PyArray_DATA(arr)
# low-level C-like code to get slices of buf and pass to BLAS
Dag Sverre
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion