[Numpy-discussion] Accessing LAPACK and BLAS from the numpy C API

Robert Kern robert.kern@gmail....
Tue Nov 10 01:50:25 CST 2009


On Tue, Nov 10, 2009 at 02:43, Fernando Perez <fperez.net@gmail.com> wrote:
> On Sun, Nov 8, 2009 at 11:43 PM, David Cournapeau
> <david@ar.media.kyoto-u.ac.jp> wrote:
>> Fernando Perez wrote:
>>> On Sat, Nov 7, 2009 at 12:41 PM, Sturla Molden <sturla@molden.no> wrote:
>>>
>>>> You find a C function pointer wrapped in a CObject in the ._cpointer
>>>> attribute.
>>>>
>>>
>>> Sorry, in the ._cpointer attribute of what precisely?
>>
>> If Sturla refers to CObject as defined in the python C API, then the
>> underlying lapack functions are not wrapped into a C object (this is not
>> done automatically). The lapack_lite functions such as dgeev and co are
>> standard python function (with *self and *args args, i.e. wrappers
>> around the underlying 'true' lapack function).
>
> Thanks, David.  My question was because Sturla's language seemed to
> suggest (at least it did to me) that there was some python object foo
> where foo._cpointer would be a poniter to the raw C function one could
> then manipulate with ctypes.  Perhaps I just misunderstood, but thanks
> for clarifying that at least this isn't possible today from pure
> python.

Only f2py functions have the ._cpointer attribute.

In [3]: from scipy import linalg

In [4]: linalg.flapack.dgeev._cpointer
Out[4]: <PyCObject at 0x3435500>

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the NumPy-Discussion mailing list