Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I would turn it around, instead of controlling Sage from within your C++ program make Sage/IPython your user interface. Then call into your C++ code for whatever you want it to do quickly. Will be a much nicer interface than calling your binary with different arguments.

Typically C/C++ code does some fast numerics after you have done some symbolic preprocessing, so usually you don't need to call back into Python then. But you definitely can using the Python C API (tedious), or by linking against Cython module and calling cdef functions, or boost:python.

Simple example of a C++ lattice simulation code controlled from the Sage commandline: https://github.com/vbraun/lattice_phi4