[Matrix-SIG] data sharing

Konrad Hinsen hinsen@ibs.ibs.fr
Mon, 23 Mar 1998 17:49:21 +0100


> Is there a way to pass data, without copying (fromstring/ tostring
> method) ?

What exactly are you trying to do? The most obvious way of passing
data is to pass the NumPy arrays. They can be accessed as sequences
(even nested sequences), so many routines can handle them without
knowing it.

If you mean other C extension modules, it's a bit trickier. If the
C modules use the generic object interface, everything should be
fine again. If they are written for a specific data type, you'll need
to convert your arrays.

> There is a nice mehtod by Jim Fulton for exporting
> C API  which could be used to do this.

The C API of the array and umath modules *is* exported. There are
already a couple of C extension modules that make use of this, e.g.
the LAPACK interface (in NumPy), the various random number modules, or
the netCDF module. But this won't help you if you are dealing with
another library that expects another data type.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                          | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire   | Tel.: +33-4.76.88.99.28
Institut de Biologie Structurale       | Fax:  +33-4.76.88.54.94
41, av. des Martyrs                    | Deutsch/Esperanto/English/
38027 Grenoble Cedex 1, France         | Nederlands/Francais
-------------------------------------------------------------------------------