Hello! I downloaded software called Xloops to evaluate integrals I'm working with. It comes with some example programs to show how the libraries work, but I can't seem to get them compiling consistently.

Here is one program (the important part is the first 12 lines):

``````#include <iostream>
#include "xloops.h"
#include <fstream>

using namespace std;
using namespace xloops;

int main(int argc, char** argv)
{

symbol x("x[0]"), y("x[1]"), eps("eps");
ex D = 4- 2*eps;
ex rho=pow(10,-15);

// Declaring masses
lst m(3,1,5,7);
lst mm(3,1,0,0);
lst t(1,1,1,1);

// preparing a list of values of external momentum q^2
lst q(2.66667, 1.77778, 1.18519, 0.790124, 0.526749, 0.351166,
0.234111, 0.156074, 0.104049, 0.069366, 0.046244, 0.030829,
0.020553, 0.013702, 0.009135, 0.006090);

// Now scan through the different valuse of q^2 in the list
// and do integration

for (int i = 0; i < q.nops(); i++) {
lst option(x, y);

ex T1, res2, f3, T2;
T1 = TwoLoop2Pt3(0,0,0,0, 0,sqrt(q.op(i)),m,t,rho, eps, option);
T2 = TwoLoop2Pt3(0,0,0,0, 0,sqrt(q.op(i)),mm,t,rho, eps, option);

// Extract the analytical part
ex res1 = (T1.op(1)-T2.op(1))/pow(I*pow(Pi,2)*pow(2*Pi,-2*eps),2);
res2 = res1.series(eps==0,4);
// Extract the finite term of the analytical part
ex fr = res2.coeff(eps,0);

// Extract the numerical part
ex f1 = (T1.op(0)-T2.op(0))/pow(I*pow(Pi,2)*pow(2*Pi,-2*eps),2);

// Remove terms propotinal to eps and higher order.
ex f2 = f1.series(eps==0,4);
f3 = evalf(f2.coeff(eps,0));

// Now we call Vegas
ex num = VNumInt(f3,10000,10,100000 ,10,option);

// Extract the result of Vegas
ex fin = num.op(0);
ex finerror= num.op(1);
ex im = num.op(2);
ex imfinerror= num.op(3);
cout << "The real part of Vegas: " << endl;
cout << fin << "+/-" << abs(finerror) << endl;
cout << "The imaginary part of Vegas" << endl;
cout << im*I << "+/-" << abs(imfinerror)*I << endl;

cout << "The Analytical part" << endl;
for (int i=0; i<=2; i++) {
cout << "The eps^(" << i-2 << ") term :" << endl;
cout << normal((res2.coeff(eps,i-2)))*pow(eps,i-2) << endl;
}
}
return 0;
// Is it fun?
}``````

It fails to compile with lots of errors--all because it can't find custom classes like "symbol" and "ex" in the scope. xloops.h references other header files and eventually references the ginac.h header containing these classes.

If I add `using namespace GiNaC;` to the above program, it compiles fine.

It seems to me that this is not the ideal solution, and indeed, if I try it with other example programs, I get other scope and overloading related errors.

Why aren't the header includes being followed? (xloops.h -> ginac.h -> symbol.h)

Thanks,
Matt

2
Contributors
7
Replies
8
Views
11 Years
Discussion Span
Last Post by mattb0611

Is this what you downloaded ? And did you also get the GiNaC C++ library which they provided the link to ?

I downloaded the CVS source, and I have GiNaC and Nestedsums installed. Everything is set-up in my path, and like I said, if I include `using namespace GiNaC;` in T1234N.cpp, it works. The others don't compile, but I want to nail down this problem first.

I suppose I should add, this is on an AMD64 Gentoo system. I'm compiling using the script provided, but I also can get it to work in Eclipse--with the extra line I mentioned.

We provide read-only CVS access to our repository. Note that this gives you "bleeding edge" code that may not even compile!

I think that says it all.

I thought they were only talking about the initial make of the libraries. Does that extend to software using them?

I have no idea. You'd have to ask them for clarification and help.

I think I figured it out. I found some other documentation which says the GiNaC namespace must be included to work. Makes sense... Thank you!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.