APFEL 4.8.0
A PDF evolution library in C++
Loading...
Searching...
No Matches
doubleobject.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 "apfel/tools.h"
10
11#include <functional>
12#include <iostream>
13
14namespace apfel
15{
20 template <class V, class U = V>
21 struct term
22 {
26 };
27
35 template<class T, class U = T>
37 {
38 public:
44
48
53 DoubleObject(std::vector<term<T, U>> const& terms);
55
60 void AddTerm(term<T, U> const& newterm);
61
66 std::vector<term<T, U>> GetTerms() const { return _terms; };
67
74 double Evaluate(double const& x, double const& z) const;
75
81 T Evaluate1(double const& x) const;
82
88 U Evaluate2(double const& z) const;
89
98 double Derive(double const& x, double const& z) const;
99
105 T Derive1(double const& x) const;
106
112 U Derive2(double const& z) const;
113
123 double Integrate(double const& xl, double const& xu, double const& zl, double const& zu) const;
124
131 T Integrate1(double const& xl, double const& xu) const;
132
139 U Integrate2(double const& zl, double const& zu) const;
140
150 double Integrate(double const& xl, double const& xu, std::function<double(double const&)> zlx, std::function<double(double const&)> zux) const;
151
161 double Integrate(std::function<double(double const&)> xlz, std::function<double(double const&)> xuz, double const& zl, double const& zu) const;
162
169 DoubleObject<T, U>& MultiplyBy(std::function<double(double const&)> const& fx, std::function<double(double const&)> const& fz);
170
174 void Print() const { std::cout << *this << std::endl; }
175
180 template<class V> DoubleObject<V> operator *= (DoubleObject<V> const& o) const;
183 DoubleObject<T, U>& operator *= (std::function<double(double const&)> const& f);
188
189 private:
190 std::vector<term<T, U>> _terms;
191
192 template<class V, class W>
193 friend std::ostream& operator << (std::ostream& os, DoubleObject<V, W> const& dob);
194 };
195
200 template<class A, class B>
201 DoubleObject<B> operator * (DoubleObject<A> lhs, DoubleObject<B> const& rhs) { return lhs *= rhs; }
202
203 template<class T, class U>
204 DoubleObject<T, U> operator * (double const& s, DoubleObject<T, U> rhs) { return rhs *= s; }
205
206 template<class T, class U>
207 DoubleObject<T, U> operator * (DoubleObject<T, U> lhs, double const& s) { return lhs *= s; }
208
209 template<class T, class U>
210 DoubleObject<T, U> operator / (DoubleObject<T, U> lhs, double const& s) { return lhs /= s; }
211
212 template<class T, class U>
214
215 template<class T, class U>
217
218 template<class T, class U>
221
225 template<class T, class U>
226 std::ostream& operator << (std::ostream& os, DoubleObject<T, U> const& dob);
227}
The DoubleObject class is a collection of pairs of single objects (Distributions or Operators) accomp...
Definition doubleobject.h:37
std::vector< term< T, U > > GetTerms() const
Function to get the terms.
Definition doubleobject.h:66
DoubleObject< T, U > & MultiplyBy(std::function< double(double const &)> const &fx, std::function< double(double const &)> const &fz)
This function multiplies the objects of the single terms of the DoubleObject by a respective function...
U Evaluate2(double const &z) const
Function that evaluates the double object in the second variable leaving the first undetermined.
DoubleObject< V > operator*=(DoubleObject< V > const &o) const
std::vector< term< T, U > > _terms
Definition doubleobject.h:190
void AddTerm(term< T, U > const &newterm)
Function to add more terms.
double Derive(double const &x, double const &z) const
Function that evaluates the derivative of the double distribution.
DoubleObject()
The DoubleObject constructor.
U Integrate2(double const &zl, double const &zu) const
Function that evaluates the derivative of the double object in the second variable leaving the first ...
double Integrate(std::function< double(double const &)> xlz, std::function< double(double const &)> xuz, double const &zl, double const &zu) const
Function that evaluates the integral of the double distribution.
U Derive2(double const &z) const
Function that evaluates the derivative of the double object in the second variable leaving the first ...
DoubleObject< T, U > & operator+=(DoubleObject< T, U > const &o)
this += DoubleObject
DoubleObject(std::vector< term< T, U > > const &terms)
The DoubleObject constructor.
double Integrate(double const &xl, double const &xu, double const &zl, double const &zu) const
Function that evaluates the integral of the double distribution.
DoubleObject< T, U > & operator/=(double const &s)
this /= scalar
DoubleObject< T, U > & operator-=(DoubleObject< T, U > const &o)
this -= DoubleObject
double Integrate(double const &xl, double const &xu, std::function< double(double const &)> zlx, std::function< double(double const &)> zux) const
Function that evaluates the integral of the double distribution.
void Print() const
Print the Operator object.
Definition doubleobject.h:174
T Integrate1(double const &xl, double const &xu) const
Function that evaluates the integral of the double object in the first variable leaving the second un...
friend std::ostream & operator<<(std::ostream &os, DoubleObject< V, W > const &dob)
T Derive1(double const &x) const
Function that evaluates the derivative of the double object in the first variable leaving the second ...
T Evaluate1(double const &x) const
Function that evaluates the double object in the first variable leaving the second undetermined.
double Evaluate(double const &x, double const &z) const
Function that evaluates the double distribution.
Namespace for all APFEL++ functions and classes.
Definition alphaqcd.h:14
Distribution operator/(Distribution lhs, double const &s)
Distribution/Scalar.
Distribution operator*(double const &s, Distribution rhs)
Scalar*Distribution.
Distribution operator+(Distribution lhs, Distribution const &rhs)
Distribution+Distribution.
std::ostream & operator<<(std::ostream &os, ConvolutionMap const &cm)
Method which prints ConvolutionMap with cout <<.
Distribution operator-(Distribution lhs, Distribution const &rhs)
Distribution-Distribution.
The term structure that contains all the objects of a single term of a double object.
Definition doubleobject.h:22
U object2
Definition doubleobject.h:25
double coefficient
Definition doubleobject.h:23
V object1
Definition doubleobject.h:24