Hello,
Is it this what you want:
symbol x; ex e1 = beta(x, lst(0,1)); ex e2 = beta(x, lst(4,1));
if ( e1 == beta(x, lst(0,1)) ) cout << "e1 BINGO" << endl; if ( e2 == beta(x, lst(0,1)) ) cout << "e2 BINGO" << endl;
Otherwise I do not completely understand your problem yet. Could you clarify it more, then?
The x-loops function I'm working with is r_sum. It's definition is (from r.cpp): static ex r_sum(const ex& t, const lst& b, const lst& x, const ex& eps, int order) and I'm trying to flag the occurrence of a certain set of argument values. The boolean operation "is_a<symbol>(x.op(i));" returns 1 for i=0,1 so I think I'm working with a list of symbols, x. Additionally, "cout << x;" yields {0,1} making me think that the symbols have been assigned numerical value.
That is what confuses me. One cannot assign numerical values to symbols in GiNaC. One can replace symbols by numbers, of course.
Perhaps I'm not correctly using/interpreting is_a<class>(ex) and/or cout<<x? Sincerely, Chris Bouchard
Hi, On Thu, Jul 24, 2008 at 12:08:23PM -0500, Chris Bouchard wrote:
The boolean operation "is_a<symbol>(x.op(i));" returns 1 for i=0,1 so I think I'm working with a list of symbols, x.
Additionally, "cout << x;" yields {0,1}
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 Confused, Alexei -- All science is either physics or stamp collecting.
participants (2)
-
Alexei Sheplyakov
-
Chris Bouchard