APFEL 4.8.0
A PDF evolution library in C++
Loading...
Searching...
No Matches
qgrid.h
Go to the documentation of this file.
1//
2// APFEL++ 2017
3//
4// Author: Valerio Bertone: valerio.bertone@cern.ch
5//
6
7#pragma once
8
9#include <vector>
10#include <tuple>
11#include <iostream>
12#include <functional>
13
14namespace apfel
15{
21 template<class T>
22 class QGrid
23 {
24 public:
30 QGrid() = delete;
31
42 QGrid(int const& nQ,
43 double const& QMin,
44 double const& QMax,
45 int const& InterDegree,
46 std::vector<double> const& Thresholds,
47 std::function<double(double const&)> const& TabFunc,
48 std::function<double(double const&)> const& InvTabFunc);
49
59 QGrid(int const& nQ,
60 double const& QMin,
61 double const& QMax,
62 int const& InterDegree,
63 std::vector<double> const& Thresholds,
64 double const& Lambda = 0.25);
65
75 QGrid(std::vector<double> const& Qg,
76 int const& InterDegree);
78
84 T Evaluate(double const& Q) const;
85
91 T Derive(double const& Q) const;
92
99 T Integrate(double const& Qa, double const& Qb) const;
100
106 bool operator == (QGrid const& sg) const;
107 bool operator != (QGrid const& sg) const;
109
114 int nQ() const { return _nQ; }
115 int InterDegree() const { return _InterDegree; }
116 double QMin() const { return _QMin; }
117 double QMax() const { return _QMax; }
118 std::function<double(double const&)> const& TabFunc() const { return _TabFunc; }
119 std::vector<double> const& GetThresholds() const { return _Thresholds;}
120 std::vector<double> const& GetQGrid() const { return _Qg; }
121 std::vector<double> const& GetFQGrid() const { return _fQg; }
122 std::vector<int> const& GetThesholdIndices() const { return _nQg; }
123 std::vector<T> const& GetQGridValues() const { return _GridValues; }
125
133 double Interpolant(int const& tQ, int const& tau, double const& fq) const;
134
142 double DerInterpolant(int const& tQ, int const& tau, double const& Q) const;
143
152 double IntInterpolant(int const& tQ, int const& tau, double const& Qa, double const& Qb) const;
153
160 std::tuple<int, int, int> SumBounds(double const& Q) const;
161
165 void Print() const { std::cout << *this << std::endl; }
166
167 protected:
168 int _nQ;
169 double _QMin;
170 double _QMax;
172 std::vector<double> _Thresholds;
173 std::function<double(double const&)> _TabFunc;
174 std::vector<double> _Qg;
175 std::vector<double> _fQg;
176 std::vector<int> _nQg;
177 std::vector<T> _GridValues;
178
179 template<class U>
180 friend std::ostream& operator << (std::ostream& os, QGrid<U> const& dt);
181 };
182
186 template<class T>
187 inline std::ostream& operator << (std::ostream& os, QGrid<T> const& Qg)
188 {
189 os << "QGrid: " << &Qg << "\n";
190 os << "nQ = " << Qg._nQ << "\n";
191 os << "QMin = " << Qg._QMin << "\n";
192 os << "QMax = " << Qg._QMax << "\n";
193 os << "InterDegree = " << Qg._InterDegree << "\n";
194 os << "Thresholds = ";
195 for (const auto &v: Qg._Thresholds) os << v << " ";
196 os << "\n";
197 os << "Threshold indices = ";
198 for (const auto &v: Qg._nQg) os << v << " ";
199 os << "\n";
200 os << "Qg = ";
201 for (const auto &v: Qg._Qg) os << v << " ";
202 os << "\n";
203 return os;
204 }
205}
The template class QGrids is a mother class for the interpolation in Q. This class also implements me...
Definition qgrid.h:23
double QMin() const
return the minimum node value
Definition qgrid.h:116
std::vector< double > const & GetFQGrid() const
return the grid in _TabFunc(Q)
Definition qgrid.h:121
QGrid(int const &nQ, double const &QMin, double const &QMax, int const &InterDegree, std::vector< double > const &Thresholds, std::function< double(double const &)> const &TabFunc, std::function< double(double const &)> const &InvTabFunc)
The QGrid constructor.
std::vector< double > const & GetThresholds() const
return the heavy quark thresholds
Definition qgrid.h:119
QGrid()=delete
bool operator==(QGrid const &sg) const
std::tuple< int, int, int > SumBounds(double const &Q) const
Computes the control parameter of the interpolant, the lower and upper bounds over which the sum is l...
double _QMin
Minumim value of Q.
Definition qgrid.h:169
int nQ() const
return the number of Q interval
Definition qgrid.h:114
int InterDegree() const
return the interpolation degree
Definition qgrid.h:115
std::vector< int > _nQg
Indices of the nodes on which there is either a bound or a threshold.
Definition qgrid.h:176
std::vector< T > const & GetQGridValues() const
return the tabulated objects on the grid.
Definition qgrid.h:123
T Integrate(double const &Qa, double const &Qb) const
Function that integrates on the grid in Q.
double Interpolant(int const &tQ, int const &tau, double const &fq) const
Interpolation functions on QGrid.
void Print() const
Print the QGrid object.
Definition qgrid.h:165
bool operator!=(QGrid const &sg) const
friend std::ostream & operator<<(std::ostream &os, QGrid< U > const &dt)
std::vector< int > const & GetThesholdIndices() const
return the indices of the thresholds on the grid
Definition qgrid.h:122
std::function< double(double const &)> const TabFunc)() const
return the tabulation function
Definition qgrid.h:118
double IntInterpolant(int const &tQ, int const &tau, double const &Qa, double const &Qb) const
Derivative of the interpolation functions on QGrid.
QGrid(std::vector< double > const &Qg, int const &InterDegree)
The QGrid constructor.
int _nQ
Number intervals.
Definition qgrid.h:168
T Derive(double const &Q) const
Function that derives on the grid in Q.
T Evaluate(double const &Q) const
Function that interpolates on the grid in Q.
std::vector< double > _Qg
Grid in Q.
Definition qgrid.h:174
std::vector< double > const & GetQGrid() const
return the grid in Q
Definition qgrid.h:120
double _QMax
Maximum value of Q.
Definition qgrid.h:170
double QMax() const
return the maximum node value
Definition qgrid.h:117
int _InterDegree
Interpolation degree.
Definition qgrid.h:171
std::function< double(double const &) _TabFunc)
Function whose constant step is used for the tabulation.
Definition qgrid.h:173
QGrid(int const &nQ, double const &QMin, double const &QMax, int const &InterDegree, std::vector< double > const &Thresholds, double const &Lambda=0.25)
The QGrid constructor.
double DerInterpolant(int const &tQ, int const &tau, double const &Q) const
Derivative of the interpolation functions on QGrid.
std::vector< T > _GridValues
Vector of values to be interpolated on the grid.
Definition qgrid.h:177
std::vector< double > _fQg
Grid in _TabFunc(Q)
Definition qgrid.h:175
std::vector< double > _Thresholds
Thresholds.
Definition qgrid.h:172
Namespace for all APFEL++ functions and classes.
Definition alphaqcd.h:14
std::ostream & operator<<(std::ostream &os, ConvolutionMap const &cm)
Method which prints ConvolutionMap with cout <<.