[GiNaC-devel] infinite loop in simplify_indexed()

PG CLARK P.G.Clark at Bradford.ac.uk
Fri May 13 19:49:10 CEST 2011


I've finally tracked down the source of my troubles in getting the  
little program I've been working on to run and I'm 99% convinced it's  
a bug in the library. Please take a look at this brief sample program  
I wrote that illustrates the problem.

#include <iostream>
#include <ginac/ginac.h>
using namespace std;
using namespace GiNaC;

int main()
{
         symbol i_sym("i"), j_sym("j"), k_sym("k"), l_sym("l"),  
m_sym("m"), n_sym("n");
         idx i(i_sym, 2), j(j_sym, 2), k(k_sym, 2), l(l_sym, 2),  
m(m_sym, 2), n(n_sym, 2);

         symbol alpha_sym("\\alpha"), beta_sym("\\beta"), gamma_sym("\\gamma");
         idx Va(alpha_sym, 3), Vb(beta_sym, 3), Vg(gamma_sym, 3);

         symbol U("U"), v("v"), h("h");

         exvector IJKLMNVec;
         idx IJKLMNIA[] ={i, j, k, l, m, n};
         IJKLMNVec.assign (IJKLMNIA,IJKLMNIA+6);

         ex myEx = (indexed(h, sy_symm(sy_none(0, 1), sy_none(2,  
3),sy_none(4, 5)),
         IJKLMNVec)*indexed(U, i, Va)*indexed(v, j, Va)*indexed(U, k, Vb)
         *indexed(v, l, Vb)*indexed(U, m, Vg)*indexed(v, n,  
Vg)).simplify_indexed();

         cout << myEx << endl;

         return 0;
}

You'll find it never terminates. simplify_indexed() has an infinite  
loop that was unanticipated caused by some rare forms of indexed  
expressions.

This program will just run and run trapped in implify_indexed() and  
never print anything out.

If a fix is not forthcoming any ideas for a work around?

regards
peter clark

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




More information about the GiNaC-devel mailing list