Cadabra
Computer algebra system for field theory problems
|
Graphical notebook interface and Cadabra packages.
Functionality to store and manipulate Cadabra notebooks and use them as packages inside other notebooks or scripts.
Classes | |
class | cadabra::ConvertData |
Object to store pre-parsing intermediate results. More... | |
class | cadabra::DataCell |
DataCells are the basic building blocks for a document. More... | |
Functions | |
std::string | cadabra::cdb2python (const std::string &, bool display) |
Convert a block of Cadabra notation into pure Python. More... | |
std::string | cadabra::convert_line (const std::string &, ConvertData &cv, bool display) |
Detect Cadabra expression statements and rewrite to Python form. More... | |
std::string | cadabra::cnb2python (const std::string &, bool for_standalone) |
Convert a Cadabra notebook file to pure Python. More... | |
void | cadabra::compile_package (const std::string &in_name, const std::string &out_name) |
Convert a Cadabra notebook file to a python package which can be imported using standard 'import' notation. More... | |
std::string cadabra::cdb2python | ( | const std::string & | in_name, |
bool | display | ||
) |
Convert a block of Cadabra notation into pure Python.
Mimics the functionality in the python script 'cadabra2' If display is false, this will not make ';' characters generate 'display' statements (used in the conversion of notebooks to python packages).
std::string cadabra::cnb2python | ( | const std::string & | in_name, |
bool | for_standalone | ||
) |
Convert a Cadabra notebook file to pure Python.
This gets called on-the-fly when importing Cadabra notebooks written by users, and at install time for all system-supplied packages. If for_standalone is false, this will not make ';' characters generate 'display' statements (used in the conversion of notebooks to python packages), and it will not convert any cells which have their ignore_on_import
flag set.
void cadabra::compile_package | ( | const std::string & | in_name, |
const std::string & | out_name | ||
) |
Convert a Cadabra notebook file to a python package which can be imported using standard 'import' notation.
Doing this will ignore all cells which are labelled ignore_on_import
.
std::string cadabra::convert_line | ( | const std::string & | line, |
ConvertData & | cv, | ||
bool | display | ||
) |
Detect Cadabra expression statements and rewrite to Python form.
Lines containing ':=' are interpreted as expression declarations. Lines containing '::' are interpreted as property declarations.
These need to end on '.', ':' or ';'. If not, keep track of the input so far and store that in self.convert_data.lhs, self.convert_data.op, self.convert_data.rhs, and then return an empty string.
TODO: make ';' at the end of '::' line result the print statement printing property objects using their readable form; addresses one issue report).