Skip to content

Commit fafaeb6

Browse files
committed
implemeting fix for quadratic sqrt
1 parent 7544750 commit fafaeb6

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/bubble.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ namespace ql
4747
vector<TScale> const& p)
4848
{
4949
if (!this->checkCache(mu2,m,p))
50-
{
50+
{
5151
if (mu2 < 0) throw RangeError("Bubble::integral","mu2 is negative!");
5252

5353
// Normalization
@@ -65,18 +65,18 @@ namespace ql
6565
cout << "s,m0,m1 = " << p0 << ", " << m0 << ", " << m1 << ql::def << endl;
6666
this->_val[0] = this->_val[2] = this->_czero;
6767
this->_val[1] = this->_cone;
68-
}
68+
}
6969
else if (this->iszero(m0/musq))
7070
{
71-
if (this->iszero(Abs((m1-p0)/musq))) BB1(this->_val,musq,m1); // I(s;0,s) s = m1, DD(4.13)
71+
if (this->iszero(Abs((m1-p0)/musq))) BB1(this->_val,musq,m1); // I(s;0,s) s = m1, DD(4.13)
7272
else if (this->iszero(Abs(p0/musq))) BB2(this->_val,musq,m1); // I(0;0,m2)
7373
else if (this->iszero(Abs(m1/musq))) BB3(this->_val,musq,m1-TMass(p0)); // I(s;0,0)
7474
else BB4(this->_val,musq,m1,p0); // I(s;0,m2)
7575
}
7676
else if (this->iszero(Abs(p0/musq))) // deal with special case, s = 0
7777
BB5(this->_val, musq, m0, m1);
7878
else
79-
BB0(this->_val, musq, m0, m1, p0);
79+
BB0(this->_val, musq, m0, m1, p0);
8080

8181
this->storeCache(mu2,m,p);
8282
}
@@ -111,7 +111,7 @@ namespace ql
111111
const TMass sqm1 = Sqrt(m1);
112112
const TOutput bb = TOutput(m0+m1-s);
113113
const TOutput rtt= Sqrt(bb*bb - this->_cfour*TOutput(m1*m0));
114-
const TOutput x1 = this->_chalf*(bb+rtt)/(sqm0*sqm1);
114+
const TOutput x1 = this->_chalf*(bb+Sign(bb)*rtt)/(sqm0*sqm1);
115115
const TOutput x2 = this->_cone/x1;
116116
res[0] = this->_ctwo - Log(sqm0*sqm1/mu2) + (m0-m1)/s*Log(sqm1/sqm0) - sqm0*sqm1/s*(x2-x1)*this->cLn(x1, Sign(Real(x1-x2)));
117117
res[1] = this->_cone;

src/qcdloop/maths.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ namespace ql
5656
// Comparison and sign operations
5757
inline int Sign(double const& x) { return (double(0) < x) - (x < double(0)); }
5858
inline int Sign(qdouble const& x){ return (qdouble(0) < x) -(x < qdouble(0));}
59+
inline complex Sign(complex const& x){ return x/Abs(x);}
60+
inline qcomplex Sign(qcomplex const& x){return x/Abs(x);}
5961

6062
inline double Max(double const& a, double const& b)
6163
{

0 commit comments

Comments
 (0)