[GiNaC-list] Substitution and re-evaluation
kaelingre at gmail.com
Wed Nov 10 09:47:17 CET 2021
I'm extending GiNaC by some new classes and ran into a problem with subs
and eval. My class, representing an integral, inherits from basic and is
essentially a container class containing several ex's itself. The subs
method, inherited from basic, works as expected for the substitution
step, but does not re-evaluate the expression (i.e. the eval function of
my class is not called after the substitution happened). The tutorial
states "All GiNaC methods that transform expressions, like subs() or
normal(), automatically re-evaluate their results." and, hence, I would
expect that the default subs method of the basic class calls eval
somewhere in the process.
Is this a bug in basic::subs or am I supposed to take care of a
re-evaluation of my custom classes myself (i.e. essentially overriding
subs and calling eval explicitly in the process)?
Looking into the source code (I'm on commit 9197695fc, ginac version
1.8.1-1) I'd expect a call to eval on line 628 of basic.cpp after all
operands have been substituted, and before subs_one_level is called.
More information about the GiNaC-list