[GiNaC-list] compile-time calculations

Matteo matpen at dnet.it
Tue Feb 28 13:43:41 CET 2017


I am currently evaluating GiNaC for use in an engineering software that
we use internally.
Therefore, I am still inexperienced with it and only ask for some pointers.

I have read in the news feed http://www.ginac.de/News.html
that new C++11 features like "constexpr" are being implemented into GiNaC.
My question is: how much can be done at compile time?

The basic workflow that we would like to optimize is the following:
1) Design an algorithm in C++, which involves manipulation of scientific
2) Elaborate the "manipulation" part in a separate environment (mostly
3) Translate the result of the separate CAS as C++
4) Integrate the result into the original C++ algorithm

This works, but has the following disadvantages:
- it requires to leave one environment (C++ IDE) to the other (CAS
- translating the mathematical results to C++ is tedious and error prone
(although it can be automated for simple cases)
- it separates the various parts of the algorithm into different
documents, which makes it hard to mantain

Ideally then, we would use GiNaC instead of SageMath (or other CAS) to
unify the code.
However, we would like to remove the runtime overhead of expression
manipulation and interpretation.

I am looking for something like the "compilation of expressions to
function pointers", but with the addition of compile-time expression

The closest I have found so far is ViennaMath, but it seems still very
limited in features.

Thank you for any help!

More information about the GiNaC-list mailing list