[GiNaC-list] issues with simplify_indexed()

Ulrich Loup loup at cs.rwth-aachen.de
Tue May 17 01:33:22 CEST 2011


Hi,

I modified your code to output more details (I split the problematic line into 
several pieces) as follows:

#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 myEx1 = indexed(h, IJKLMNVec)*indexed(U, i, Va);
        cout << "myEx1: " << myEx1 << endl;
        ex myEx2 = myEx1*indexed(U, k, Vb)*indexed(U, m, Vg);
        cout << "myEx2: " << myEx2 << endl;
	ex myEx3 = myEx2*indexed(v, j, Va);
        cout << "myEx3: " << myEx3 << endl;
	ex myEx4 = myEx3*indexed(v, l, Vb);
        cout << "myEx4: " << myEx4 << endl;
 	ex myEx5 = myEx4*indexed(v, n, Vg);
 	cout << "myEx5: " << myEx5 << endl;

        cout << "myEx5.simpl: " << myEx5.simplify_indexed() << endl;

        return 0;
}

The output shows the "myEx5" line, but nothing more. So, the error is in 
"simplify_indexed". I'm no expert, but maybe this helps a little.

Regards,

Ulrich.

Nachricht von Sonntag 15 Mai 2011 22:38:07:
> I've been trying to get a little program of mine to work and well it
> just doesn't terminate. Somewhere it gets snagged in an infinite loop
> in the library. I'm pretty sure this is a library bug and I've alerted
> development but in the mean while has an one encountered this before?
> Has any one figured out a work around? I've whittled my program down
> to the smallest most simple component I could get to non terminate.
> The code looks like this.
> 
> #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, IJKLMNVec)*indexed(U, i, Va)
>          *indexed(U, k, Vb)*indexed(U, m, Vg)*indexed(v, j, Va)
> 	*indexed(v, l, Vb)*indexed(v, n, Vg)).simplify_indexed();
> 
> 	cout << myEx << endl;
> 
> 	return 0;
> }
> 
> This code never makes it to the cout code. it get trapped in a loop
> before then.
> Any one seen this before?
> 
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
> 
> 
> _______________________________________________
> GiNaC-list mailing list
> GiNaC-list at ginac.de
> https://www.cebix.net/mailman/listinfo/ginac-list


More information about the GiNaC-list mailing list