[GiNaC-list] comparing symbols

Alexei Sheplyakov varg at theor.jinr.ru
Thu Jul 24 19:20:46 CEST 2008


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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: Digital signature
Url : http://www.cebix.net/pipermail/ginac-list/attachments/20080724/66fb56bf/attachment.sig 


More information about the GiNaC-list mailing list