[GiNaC-list] Performance of simplify_indexed on long chains of Dirac matrices

Sun Jan 4 00:48:23 CET 2015

```Dear all,

I'm wondering about the performance of simplify_indexed applied to a
long chain of Dirac matrices in D dimensions.

For example, simplifying

g^i1 g^i2 g^i3 g^i4 g^i5 g^i6 g^i7 g^i8 g^i9 g^i1 g^i2 g^i3 g^i4 g^i5
g^i6 g^i7 g^i8 g^i9

requires about 15 seconds on my machine. Is this something one would
normally expect with GiNaC, or am I lacking some essential optimizations?

I'm using Fedora 20 64-bit with newest GiNaC from the Git repository.
The machine is an i5-3570 with 16GB RAM. The source code
---------------------------------------------------------------------
#include <iostream>
#include <ginac/ginac.h>
using namespace std;
using namespace GiNaC;
int main() {
symbol D("D");
varidx i1(symbol("i1"), D),
i2(symbol("i2"), D),
i3(symbol("i3"), D),
i4(symbol("i4"), D),
i5(symbol("i5"), D),
i6(symbol("i6"), D),
i7(symbol("i7"), D),
i8(symbol("i8"), D),
i9(symbol("i9"), D);

cout << (simplify_indexed(dirac_gamma(i1)*
dirac_gamma(i2)*
dirac_gamma(i3)*
dirac_gamma(i4)*
dirac_gamma(i5)*
dirac_gamma(i6)*
dirac_gamma(i7)*
dirac_gamma(i8)*
dirac_gamma(i9)*
dirac_gamma(i1.toggle_variance())*
dirac_gamma(i2.toggle_variance())*
dirac_gamma(i3.toggle_variance())*
dirac_gamma(i4.toggle_variance())*
dirac_gamma(i5.toggle_variance())*
dirac_gamma(i6.toggle_variance())*
dirac_gamma(i7.toggle_variance())*
dirac_gamma(i8.toggle_variance())*
dirac_gamma(i9.toggle_variance())
)).expand()
<< endl;

return 0;
}
---------------------------------------------------------------------

is compiled and run via

c++ test.cpp -o test -Ofast -lcln -lginac  -Wl,-rpath,/usr/local/lib
time ./test

Cheers,