APFEL 4.8.0
A PDF evolution library in C++
Loading...
Searching...
No Matches
polylog_test.cc
//
// APFEL++ 2017
//
// Author: Valerio Bertone: valerio.bertone@cern.ch
//
#include <apfel/apfelxx.h>
int main()
{
const double xx = 0.4;
double *x = new double;
int *nw = new int;
int *wn1 = new int;
int *wn2 = new int;
*x = xx;
*nw = 5;
*wn1 = -1;
*wn2 = 1;
// HPLOG all at once up to weight 5
double *H = new double[363];
apfel::apf_hplog_(x, nw, &H[0], &H[3], &H[12], &H[39], &H[120], wn1, wn2);
std::cout << " x = " << xx << std::endl;
std::cout << " "
<< " HPOLY "
<< " HPLOG_ "
<< std::endl;
std::cout << std::scientific;
std::cout << "HPL({-1}, x) = " << apfel::hpoly({-1}, 0.4) << ",\t" << H[apfel::HPLogMap({-1})] << std::endl;
std::cout << "HPL({0,1}, x) = " << apfel::hpoly({0,1}, 0.4) << ",\t" << H[apfel::HPLogMap({0,1})] << std::endl;
std::cout << "HPL({-1,0,0}, x) = " << apfel::hpoly({-1,0,0}, 0.4) << ",\t" << H[apfel::HPLogMap({-1,0,0})] << std::endl;
std::cout << "HPL({-1,-1,1,0}, x) = " << apfel::hpoly({-1,-1,1,0}, 0.4) << ",\t" << H[apfel::HPLogMap({-1,-1,1,0})] << std::endl;
std::cout << "HPL({-1,-1,1,0,1}, x) = " << apfel::hpoly({-1,-1,1,0,1}, 0.4) << ",\t" << H[apfel::HPLogMap({-1,-1,1,0,1})] << std::endl;
std::cout << "\n";
// Performance test
const double nc = 1000;
for (int i = 0; i < nc; i++)
apfel::hpoly({-1,-1,1,0,1}, 0.4);
std::cout << "Calling HPOLY " << nc << " times... ";
t.stop();
t.start();
for (int i = 0; i < nc; i++)
apfel::apf_hplog_(x, nw, &H[0], &H[3], &H[12], &H[39], &H[120], wn1, wn2);
std::cout << "Calling HPLOG_ " << nc << " times... ";
t.stop();
std::cout << "\n";
// Testing Nielsen's polylog against Li2
std::cout << "Li2(x) = " << apfel::dilog(xx) << std::endl;
std::cout << "S_{1,1}(x) = " << apfel::wgplg(1, 1, xx) << std::endl;
std::cout << "\n";
delete x;
delete nw;
delete wn1;
delete wn2;
delete[] H;
return 0;
}
The Timer class computes the time elapsed between start and stop.
Definition timer.h:20
void stop(bool const &ForceDisplay=false)
This function stops the timer and reports the elapsed time in seconds since the last time the timer w...
Definition timer.h:36
void start()
This function starts the timer.
Definition timer.h:30
int HPLogMap(std::vector< int > const &w)
Function that returns the index to be used with unidimensional arrays returned by hplog_.
double dilog(double const &x)
Real dilogarithm .
double apf_hplog_(double *wx, int *wnw, double *Hr1, double *Hr2, double *Hr3, double *Hr4, double *Hr5, int *wn1, int *wn2)
double hpoly(std::vector< int > const &w, double const &x)
Function for the computation of the Harmonic polylogs up to weight 5.
double wgplg(int const &n, int const &p, double const &x)
Function for the computation of the Nielsen's generalized dilogs.