42template<
typename Type>
44typename std::enable_if<std::is_base_of<basic, T>::value,
bool>::type
49template<
typename Type>
51typename std::enable_if<!std::is_base_of<basic, T>::value,
bool>::type
57template<
typename Type>
60 std::cout <<
"Cache" << std::endl;
61 for (
const auto& n :
cache)
62 std::cout <<
" " << n.first <<
" -> " << n.second << std::endl;
65template<
typename Type>
70 const auto pos =
cache.find(expr);
71 if (pos !=
cache.end())
78 std::vector<ex> terms;
79 terms.reserve(expr.
nops());
80 for (
size_t i = 0; i < expr.
nops(); i++)
81 terms.emplace_back(
impl(expr.
op(i)));
89 for (
size_t i = 0; i < expr.
nops(); i++)
111 std::vector<std::vector<int>> result;
112 std::vector<int> hlp(m, 0);
116 int x = hlp[k-1] + 1;
119 while (x <= y && k < m-1) {
126 std::vector<int> decomposition(m, 0);
127 for (
size_t i = 0; i < k+1; i++)
128 decomposition[i] = hlp[i];
129 std::sort(decomposition.begin(), decomposition.end());
131 result.emplace_back(decomposition);
132 }
while (next_permutation(decomposition.begin(), decomposition.end()));
138template<
typename Kernel>
140 const std::vector<Kernel>& args,
141 const std::vector<ex>& endpoints,
142 const std::function<
ex(std::vector<Kernel>& new_args,
const ex& start,
const ex& end)>& construct
146 const size_t n_segments = endpoints.size()-1;
147 const std::vector<std::vector<int>> partitions =
integer_partition(args.size(), n_segments);
148 std::vector<ex> terms;
149 terms.reserve(partitions.size());
150 for (
const std::vector<int>& partition : partitions) {
151 size_t kernel_count = 0;
152 std::vector<ex> factors;
153 factors.reserve(n_segments);
154 for (
size_t i = 0; i < n_segments; i++) {
155 if (partition[i] == 0)
158 std::vector<Kernel> new_args(args.begin()+kernel_count, args.begin()+kernel_count+partition[i]);
159 kernel_count += partition[i];
161 factors.emplace_back(construct(new_args, endpoints[n_segments-1-i], endpoints[n_segments-i]));
163 terms.emplace_back(
mul(factors));
169 const std::vector<ex>& args,
170 const std::vector<ex>& endpoints,
171 const std::function<
ex(std::vector<ex>& new_args,
const ex& start,
const ex& end)>& construct
174 const std::vector<Gt::kernel>& args,
175 const std::vector<ex>& endpoints,
176 const std::function<
ex(std::vector<Gt::kernel>& new_args,
const ex& start,
const ex& end)>& construct
192 throw std::logic_error(
"Gt: Cannot multiply these terms");
198 for (
int i = std::min(0,
power); i < std::max(0,
power); i++)
215 std::vector<ex> args =
polylog;
218 args.insert(args.begin(),
ex{0});
223 args.erase(args.begin());
236 std::vector<ex> args =
polylog;
237 args.insert(args.begin(),
denom);
242 throw std::logic_error(
"Gt: Invalid integration");
249 result /=
denom - upper_bound;
258 if (path.size() > 2) {
260 return G_path(new_args,start,end);
263 return G_path(args, path[0], path[1]);
268 bool all_args_same = args.size() >= 2;
269 for (
size_t i = 1; i < args.size() && all_args_same; i++)
270 all_args_same = (args[i] == args[0]);
272 return (
pow(
G((args[0] - start)/(end - start),1).hold(), args.size()) /
factorial(args.size()));
276 for (
const ex& arg : args)
277 new_args.
append((arg - start)/(end - start));
278 return G(new_args,1).
hold();
285 os <<
"*[int.var.]^" << term.
power;
290 os <<
"},[int.var.],[path])";
293 os <<
"/([int.var.]-(" << term.
denom <<
"))";
313 if (cmpval < 0)
return true;
314 if (cmpval > 0)
return false;
316 for (
size_t i = 0; i < a.
polylog.size(); i++) {
318 if (cmpval < 0)
return true;
319 if (cmpval > 0)
return false;
329 std::set<pathintegral_term>::iterator pos =
terms.find(term);
331 terms.insert(std::move(term));
333 pos->prefactor += term.prefactor;
334 if (pos->prefactor.is_zero())
Interface to GiNaC's elliptic multiple polylogarithms.
Interface to helper functions for elliptic multiple polylogarithms.
Interface to GiNaC's sums of expressions.
std::set< pathintegral_term >::const_iterator begin() const
void add(pathintegral_term &&term)
std::set< pathintegral_term > terms
std::set< pathintegral_term >::const_iterator end() const
pathintegral_term(ex prefactor, int power, const std::vector< ex > &polylog={}, ex denom=0)
friend bool operator<(const pathintegral_term &lh, const pathintegral_term &rh)
void integrate(const ex &start, pathintegral_term_list &integrand, pathintegral_term_list &result) const
static ex G_path(const std::vector< ex > &args, const std::vector< ex > &path)
std::vector< ex > polylog
friend class pathintegral_term_list
ex evaluate(const ex &upper_bound, const std::vector< ex > &path) const
friend std::ostream & operator<<(std::ostream &os, const pathintegral_term &term)
add(const ex &lh, const ex &rh)
const basic & hold() const
Stop further evaluation.
container & append(const ex &b)
Add element at back.
Lightweight wrapper for GiNaC's symbolic objects.
int compare(const ex &other) const
mul(const ex &lh, const ex &rh)
power(const ex &lh, const ex &rh)
Interface to class of symbolic functions.
Interface to GiNaC's initially known functions.
Definition of GiNaC's lst.
Interface to GiNaC's products of expressions.
template ex deconcatenate_path< Gt::kernel >(const std::vector< Gt::kernel > &args, const std::vector< ex > &endpoints, const std::function< ex(std::vector< Gt::kernel > &new_args, const ex &start, const ex &end)> &construct)
ex deconcatenate_path(const std::vector< Kernel > &args, const std::vector< ex > &endpoints, const std::function< ex(std::vector< Kernel > &new_args, const ex &start, const ex &end)> &construct)
std::vector< std::vector< int > > integer_partition(const int n, const int m)
bool is_zero(const ex &thisex)
bool is_the_function(const ex &x)
const numeric pow(const numeric &x, const numeric &y)
container< std::list > lst
const numeric factorial(const numeric &n)
Factorial combinatorial function.
bool is_exactly_a(const basic &obj)
Check if obj is a T, not including base classes.
class_info< OPT > * class_info< OPT >::first
function G(const T1 &x, const T2 &y)
Interface to GiNaC's overloaded operators.
Interface to GiNaC's symbolic exponentiation (basis^exponent).
Interface to relations between expressions.