[GiNaC-devel] GiNaC is not a C compiler [Was: Optimized C-style
stefanw at thep.physik.uni-mainz.de
Thu Mar 22 15:26:40 CET 2007
thinking about it, we probably want the following: a data structure
consisting of two lists,
lhs = lst(t0,t1,...)
rhs = lst(expr0,expr1,...)
with the understanding that this should represent something like
t1 = expr1;
t0 = expr0;
There is a consistency condition which needs to be fulfilled: The right
hand side of the (j+1)-th entry cannot refer to symbols t0,...,tj, which
would be defined later.
One can consider two such structures equivalent, if the values of
t0,...,tn would be the same after execution of the corresponding code
fragments. In most cases we are just interested in n=0.
This is actually an equivalence relation in the mathematical sense.
For this structure we can have methods, which transform the structure into
an equivalent one.
These methods can add or remove entries from the two lists, or change the
Methods, which just transform the rhs are in some sense trivial and not
Examples of such methods could be:
- replace common subexpressions of type T1, T2, ... in the rhs.
- split containers with more than n_max arguments
- (eliminate redundant variables)
This structure has then a print method, which simply prints
double t1 = expr1;
double t0 = expr0;
Everybody happy with this concept ?
More information about the GiNaC-devel