Skip to content

Commit 6226972

Browse files
authored
Merge pull request #22 from scarrazza/fixgz
importing changes from GZ
2 parents ba82bf6 + d22e433 commit 6226972

File tree

2 files changed

+44
-38
lines changed

2 files changed

+44
-38
lines changed

src/bubble.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +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 sgn = Sign(Real(Conjg(bb)*rtt));
115-
const TOutput x1 = this->_chalf*(bb+sgn*rtt)/(sqm0*sqm1);
114+
const TOutput x1 = this->_chalf*(bb+rtt)/(sqm0*sqm1);
116115
const TOutput x2 = this->_cone/x1;
117116
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)));
118117
res[1] = this->_cone;
@@ -279,8 +278,7 @@ namespace ql
279278
const TMass c = a;
280279
const TOutput b = m[0] + m[1] - TMass(p[0]) - this->_ieps;
281280
const TOutput root = Sqrt(Pow(b, 2) - this->_cfour*a*c);
282-
const TOutput sgn = TOutput(Sign(Real( Conjg(b) * root)));
283-
const TOutput q = this->_chalf * (b + sgn*root);
281+
const TOutput q = this->_chalf * (b + root);
284282
const TOutput rm = q / a;
285283
const TOutput r = rm;
286284
res[0] = - this->_chalf * (m[0] - m[1]) / Pow(p[0], 2) * Log(m[1]/m[0]) +

src/tools.cc

Lines changed: 42 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ using std::cout;
1515
using std::endl;
1616
using std::is_same;
1717

18-
namespace ql {
18+
namespace ql {
1919

2020
template<typename TOutput, typename TMass, typename TScale>
2121
Tools<TOutput,TMass,TScale>::Tools():
@@ -269,21 +269,21 @@ namespace ql {
269269
template<typename TOutput, typename TMass, typename TScale>
270270
TOutput Tools<TOutput,TMass,TScale>::fndd(int const& n, TOutput const& x, TScale const& iep) const
271271
{
272-
const int infty = 16;
273-
TOutput res = _czero;
272+
const int infty = 16;
273+
TOutput res = _czero;
274274
if (Abs(x) < _ten)
275275
{
276276
if (!iszero(Abs(x-_cone)))
277277
res = (_cone-Pow(x,n+1))*(cLn(x-_cone, iep) - cLn(x, iep));
278278

279279
for (int j = 0; j <= n; j++)
280280
res -= Pow(x, n-j)/(j+_one);
281-
}
281+
}
282282
else
283-
{
283+
{
284284
res = cLn(_cone-_cone/x, iep);
285285
for (int j = n+1; j <= n+infty; j++)
286-
res += Pow(x, n-j)/(j+_one);
286+
res += Pow(x, n-j)/(j+_one);
287287
}
288288
return res;
289289
}
@@ -481,18 +481,18 @@ namespace ql {
481481

482482
if (Real(z12) > _half)
483483
{
484-
cspence = ltspence(1, z12, _zero);
484+
cspence = ltspence(1, z12, _zero);
485485
const int etas = eta(z1, im1, z2, im2, im12);
486486
if (etas != 0) cspence += TOutput(etas)*cLn(_cone-z12, -im12)*_2ipi;
487487
}
488488
else if (Abs(z12) < _eps4)
489489
{
490-
cspence = TOutput(_pi2o6);
490+
cspence = TOutput(_pi2o6);
491491
if (Abs(z12) > _eps14)
492492
cspence += -ltspence(0, z12, _zero) + (cLn(z1,im1) + cLn(z2,im2))*z12*(_cone + z12*(_chalf + z12*(_cone/_cthree + z12/_cfour)));
493493
}
494494
else
495-
cspence = TOutput(_pi2o6) - ltspence(0, z12, _zero) - (cLn(z1, im1) + cLn(z2, im2))*cLn(_cone-z12,_zero);
495+
cspence = TOutput(_pi2o6) - ltspence(0, z12, _zero) - (cLn(z1, im1) + cLn(z2, im2))*cLn(_cone-z12,_zero);
496496

497497
return cspence;
498498
}
@@ -819,7 +819,7 @@ namespace ql {
819819
{
820820
const TOutput arg4 = (y0-_cone)/y0;
821821
res += extra*cLn(arg4, Sign(Imag(arg4)));
822-
}
822+
}
823823

824824
return res;
825825
}
@@ -1221,30 +1221,38 @@ namespace ql {
12211221
if (iszero(Imag(discr)))
12221222
{
12231223
const TMass sgnb = Sign(Real(b));
1224-
if (Real(discr) > 0)
1225-
{
1226-
const TMass q = -_half*(b+sgnb*Sqrt(discr));
1227-
if (Real(b) > 0)
1228-
{
1229-
z[0] = TOutput(c/q);
1230-
z[1] = TOutput(q/a);
1231-
}
1232-
else
1233-
{
1234-
z[0] = TOutput(q/a);
1235-
z[1] = TOutput(c/q);
1236-
}
1237-
}
1238-
else
1239-
{
1240-
z[1] = -(TOutput(b)+sgnb*Sqrt(TOutput(discr)))/(_ctwo*a);
1241-
z[0] = Conjg(z[1]);
1242-
if (Real(b) < 0)
1243-
{
1244-
z[0] = z[1];
1245-
z[1] = Conjg(z[0]);
1246-
}
1247-
}
1224+
if (iszero(Real(b)))
1225+
{
1226+
z[0] = -(TOutput(b)-Sqrt(TOutput(discr)))/(_ctwo*a);
1227+
z[1] = -(TOutput(b)+Sqrt(TOutput(discr)))/(_ctwo*a);
1228+
}
1229+
else
1230+
{
1231+
if (Real(discr) > 0)
1232+
{
1233+
const TMass q = -_half*(b+sgnb*Sqrt(discr));
1234+
if (Real(b) > 0)
1235+
{
1236+
z[0] = TOutput(c/q);
1237+
z[1] = TOutput(q/a);
1238+
}
1239+
else
1240+
{
1241+
z[0] = TOutput(q/a);
1242+
z[1] = TOutput(c/q);
1243+
}
1244+
}
1245+
else
1246+
{
1247+
z[1] = -(TOutput(b)+sgnb*Sqrt(TOutput(discr)))/(_ctwo*a);
1248+
z[0] = Conjg(z[1]);
1249+
if (Real(b) < 0)
1250+
{
1251+
z[0] = z[1];
1252+
z[1] = Conjg(z[0]);
1253+
}
1254+
}
1255+
}
12481256
}
12491257
else
12501258
{

0 commit comments

Comments
 (0)