Re: [GiNaC-list] comparing symbols
Hi,
I don't think this situation is possible (modulo compiler bugs and things like that).
$ cat test.cc #include <ginac/ginac.h> #include <iostream> using namespace GiNaC; using namespace std;
int main(int argc, char** argv) { lst x; x = ex(0), ex(1); if (is_a<symbol>(x.op(0))) { cerr << "Huh, 0 is a symbol?" << endl; return 1; } return 0; } $ g++ test.cc -lginac $ ./a.out $ echo $? 0
Hmmm... that seems to make sense. For sake of clarity I've pasted code fragment below followed by associated output. Code fragment ------------- ... namespace xloops { static ex r_sum(const ex& t, const lst& b, const lst& x, const ex& eps, int order) { // class of arguments cout << "t is class mul?: " << is_a<mul>(t) << "\n"; cout << "b is class list?: " << is_a<lst>(b)<< "\n"; cout << "b.op(0) is class add?: " << is_a<add>(b.op(0)) << "\n"; cout << "b.op(1) is class numeric?: " << is_a<numeric>(b.op(1)) << "\n"; cout << "x is class list?: " << is_a<lst>(x) << "\n"; cout << "x.op(0) is class symbol?: " << is_a<symbol>(x.op(0)) << "\n"; cout << "x.op(0) is class mul?: " << is_a<mul>(x.op(0)) << "\n"; cout << "x.op(0) is class numeric?: " << is_a<numeric>(x.op(0)) << "\n"; cout << "x.op(0) is class add?: " << is_a<add>(x.op(0)) << "\n"; cout << "x.op(1) is class symbol?: " << is_a<symbol>(x.op(1)) << "\n"; cout << "x.op(1) is class mul?: " << is_a<mul>(x.op(1)) << "\n"; cout << "x.op(1) is class numeric?: " << is_a<numeric>(x.op(1)) << "\n"; cout << "x.op(1) is class add?: " << is_a<add>(x.op(1)) << "\n"; cout << "eps is class symbol?: " << is_a<symbol>(eps) << "\n"; // value of arguments cout << "t = " << t << "\n"; cout << "b = " << b << "\n"; cout << "x = " << x << "\n"; cout << "eps = " << eps << "\n"; ... } Output ------ t is class mul?: 1 b is class list?: 1 b.op(0) is class add?: 1 b.op(1) is class numeric?: 1 x is class list?: 1 x.op(0) is class symbol?: 1 x.op(0) is class mul?: 0 x.op(0) is class numeric?: 0 x.op(0) is class add?: 0 x.op(1) is class symbol?: 1 x.op(1) is class mul?: 0 x.op(1) is class numeric?: 0 x.op(1) is class add?: 0 eps is class symbol?: 1 t = -eps b = {-1/2+eps,1} x = {0,1} eps = eps Is there any other information I could provide to shed light on this? Sincerely, Chris Bouchard
Hi, Chris Bouchard schrieb:
Is there any other information I could provide to shed light on this?
try the code cout << tree << "x = " << x << "\n"; then we can see what is going on. Maybe r_sum is called with something like symbol f1("0"); symbol f2("1"); r_sum(...,lst(f1,f2),...); Regards, Jens
participants (2)
-
Chris Bouchard
-
Jens Vollinga