On Apr 15, 2009, at 2:51 AM, mabshoff wrote: > On Apr 15, 1:55 am, Burcin Erocal <bur...@erocal.org> wrote: >> On Wed, 15 Apr 2009 09:38:39 +0100 > > <SNIP> > >> It is possible to call python code from C/C++, pynac has many >> examples >> of this. The functions in sage/symbolic/pynac.pyx are all exported so >> they are callable from C++. >> >> You just need to define the function as extern in your code, and the >> linker takes care of the rest at runtime. Of course, this makes the >> library very much dependent on Sage. >> >> I have no experience with the sparse matrix code, so I don't know how >> hard it would be to fill in Sage's sparse matrices from C++. > > I kind of doubt that in this particular case the overhead of requiring > Sage is worth it, but it is possible to call arbitrary Sage functions > from C++ code by embedding a python interpreter. It has been done, > i.e. M2 has a sage package in the current svn that was developed at > Sage Days 14 by Dan Greyson with help of a couple Sage developers. > There were some small fixes needed for the Sage library that AFAIK > have not been merged into the main tree, but it should be relatively > simple to get that code in.
If your C++ code is called originally from Python, it's even easier (no need to embed an interpreter). It really depends on what you're doing, but easier than calling Sage might be looking into using LinBox directly (which ships with Sage). - Robert --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---