[PYTHON MATRIX-SIG] Guidance for extensions?

Johann Hibschman johann@physics.berkeley.edu
Mon, 25 Nov 1996 11:47:57 -0800 (PST)


[ I sent this to the comp.lang.python as well, but I think you people 
are more likely to be able to answer my questions... ]

Hello all,

I've recently decided that Numeric Python all by itself is too slow
for a project that I'm working on, so I'm trying to learn how to
extend python.  However, the docs I've found are rather confusing.

I want to take a C++ program with classes like

class Solver {
public:
   int numPoints;
   Vector density, temperature;

   void DoTimeSteps( int numSteps );
};

and arrange a python module which would mirror the structure of the
class.  I want to be able to use python to set the variables, then
call pass the arrays from python to the C++ object, call the C++
object to advance the solution by some number of timesteps, then pass
the arrays back from the C++ object to the python object, so I can
interactively play with them.

This seems like it should be easy to do, but I'm not sure where to
begin.  The docs cover modules with simple functions fairly well, but
I'm not sure how to construct C++ classes so they work, and I don't
know how to transfer Numeric python arrays (or even normal python
lists) to and from my program.

Any suggestions, pointers, comments?

- Johann

Johann Hibschman
johann@physics.berkeley.edu   


=================
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================