APFEL 4.8.0
A PDF evolution library in C++
Loading...
Searching...
No Matches
qgrid_test.cc
//
// APFEL++ 2017
//
// Author: Valerio Bertone: valerio.bertone@cern.ch
//
#include <apfel/apfelxx.h>
#include <iostream>
#include <cmath>
#include <iomanip>
int main()
{
// Constructor of QGrid with type double
const apfel::QGrid<double> qg{50, 1, 1000, 3, {0, 0, 0, sqrt(2), 4.5, 175.}};
std::cout << qg << std::endl;
// AlphaQCD running coupling
apfel::AlphaQCD as{0.35, sqrt(2), {0, 0, 0, sqrt(2), 4.5, 175}, 2};
// Tabulate AlphaQCD on a QGrid
const apfel::TabulateObject<double> gas{as, 50, 1, 1000, 3};
std::cout << "\nAccuracy test:" << std::endl;
double nQ = 20;
double Qmin = 1.1;
double Qmax = 999.;
double Step = exp( log( Qmax / Qmin ) / ( nQ - 1 ) );
double Q = Qmin;
std::cout << std::setprecision(8) << std::scientific;
std::cout << "Q \t\tDirect \t\tInterpolated\t\tRatio" << std::endl;
for (int iQ = 0; iQ < nQ; iQ++)
{
std::cout << Q << "\t\t" << as.Evaluate(Q) << "\t\t" << gas.Evaluate(Q) << "\t\t" << as.Evaluate(Q) / gas.Evaluate(Q) << std::endl;
Q *=Step;
}
std::cout << "\nPerformance test:" << std::endl;
nQ = 100000;
Step = exp( log( Qmax / Qmin ) / ( nQ - 1 ) );
t.start();
std::cout << "Direct calculation of " << nQ << " points... ";
Q = Qmin;
for (int iQ = 0; iQ < nQ; iQ++)
{
as.Evaluate(Q);
Q *= Step;
}
t.stop();
t.start();
std::cout << "Interpolated calculation of " << nQ << " points... ";
Q = Qmin;
for (int iQ = 0; iQ < nQ; iQ++)
{
gas.Evaluate(Q);
Q *= Step;
}
t.stop();
return 0;
}
The AlphaQCD is a specialization class of the MatchedEvolution class for the computation of the QCD c...
Definition alphaqcd.h:21
The template class QGrids is a mother class for the interpolation in Q. This class also implements me...
Definition qgrid.h:23
The template TabulateObject class is a derived of the QGrid class that tabulates on object of type T ...
Definition tabulateobject.h:26
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