[GiNaC-list] Python bindings to GiNaC

Jonathan Brandmeyer jbrandmeyer at earthlink.net
Tue Jan 4 15:57:03 CET 2005


On Mon, 2005-01-03 at 14:53 +0100, Ondrej Certik wrote:
> Hello all,
> I wrote new Python bindings to ginac, because
> PyGiNaC (http://cens.ioc.ee/projects/pyginac/) seems to be dead
> and I wasn't able to even compile it.



> Currently I only support classes: basic, symbol, numeric, ex. But more
> can be done quite easily, unfortunately I probably won't have time to
> continue on it. More info at: 
> 
> http://ondrej.certik.cz/pyginac.php
> 
> Does anyone of you would like to use ginac
> in python, or does everybody use c++/cint?
> 
> Yours,
> Ondrej Certik

So have I, and I have support for a larger number of classes including
matrix, numeric, relational, power, add, mul, constant, function,
integral and others.  GiNaC::lst is automatically converted to a Python
list.  See www.sourceforge.net/projects/pyginac/.  I have not produced a
release yet since I have not ported the documentation over, but CVS is
current and usable.  Would you like to collaborate with me on this?

Personally, I prefer to use a mixed C++/Python environment, leaning on
Python as an alternative to cint and ginsh rather than an alternative to
C++.

The approach that I took which is different from the prior efforts is
that I always unwrap the child of an ex to its actual class.  I did this
because I think Python's dynamic object system is easier to use in
Python than using ex's dynamic object system would be from Python (this
isn't a complaint against it from the C++ side).  For example, to see if
you have an add object in hand, you test foo.__class__ == add, or use
the builtin function isinstance( foo, add).

-Jonathan




More information about the GiNaC-list mailing list