HepLib
Loading...
Searching...
No Matches
Laporta.cpp
Go to the documentation of this file.
1
6#include "IBP.h"
7#include <cmath>
8
9namespace HepLib {
10
14 string Laporta::Fout(const ex & expr) {
15 if(!using_uw) {
16 ex f = expr;
17 if(is_a<lst>(f)) f = F(f);
18 else if(expr.match(F(w1,w2))) f = F(f.op(1));
19 string fstr = ex2str(f);
20 string_replace_all(fstr,"{","");
21 string_replace_all(fstr,"}","");
22 string_replace_all(fstr,"(","[");
23 string_replace_all(fstr,")","]");
24 return fstr;
25 } else {
26 ex idx;
27 if(expr.match(F(w1,w2))) idx = expr.op(1);
28 else if(expr.match(F(w))) idx = expr.op(0);
29 else idx = expr;
30 return to_string(i2w[idx]);
31 }
32 }
33
37 ex Laporta::Fin(const string & expr) {
38 if(!using_uw) {
39 string fstr = expr;
40 string_replace_all(fstr,"[","("+to_string(ProblemNumber)+",{");
41 string_replace_all(fstr,"]","})");
42 return str2ex(fstr);
43 } else {
44 auto cpos = expr.find("*");
45 if(cpos==string::npos) {
46 if(expr=="0") return 0;
47 throw Error("KIRA::Fin with 0 or * NOT Found.");
48 }
49 auto wstr = expr.substr(0,cpos);
50 unsigned long long weight = stoull(wstr,NULL,0);
51 auto oex = str2ex(expr.substr(cpos+1,string::npos));
52 return F(ProblemNumber, w2i[weight]) * oex;
53 }
54 }
55
60
61 if(Integral.nops()<1) return;
62
63 int pdim = Propagator.nops();
64 lst InExternal;
65 for(auto ii : Internal) InExternal.append(ii);
66 for(auto ii : External) InExternal.append(ii);
67
68 if(ISP.nops()<1) {
69 for(auto it : Internal) {
70 for(auto ii : InExternal) ISP.append(it*ii);
71 }
72 ISP.sort();
73 ISP.unique();
74 }
75
76 if(ISP.nops() > pdim) {
77 cout << "ISP = " << ISP << endl;
78 cout << "Propagator = " << Propagator << endl;
79 throw Error("UKIRA::Export: #(ISP) > #(Propagator).");
80 }
81
82 lst sp2s, s2sp, ss;
83 int _pic=0;
84 for(auto item : ISP) {
85 _pic++;
86 Symbol si("P"+to_string(_pic));
87 ss.append(si);
88 sp2s.append(w*item==w*si);
89 sp2s.append(item==si);
90 s2sp.append(si==item);
91 }
92
93 lst leqns;
94 for(int i=0; i<ISP.nops(); i++) { // note NOT pdim
95 auto eq = Propagator.op(i).expand().subs(iEpsilon==0); // drop iEpsilon
96 eq = eq.subs(sp2s);
97 eq = eq.subs(Replacement);
98 if(eq.has(iWF(w))) throw Error("UKIRA::Export, iWF used in eq.");
99 leqns.append(eq == iWF(i));
100 }
101 auto s2p = lsolve(leqns, ss);
102 if(s2p.nops() != ISP.nops()) throw Error("KIRA::Export: lsolve failed.");
103
104 if(DSP.nops()<1) {
105 for(auto p1 : Internal)
106 for(auto p2 : InExternal)
107 DSP.append(lst{p1,p2});
108 }
109
110 ibps.remove_all(); // no need
111 lst nsa;
112 for(int i=0; i<pdim; i++) nsa.append(a(i));
113 for(auto sp : DSP) {
114 auto ilp = sp.op(0);
115 auto iep = sp.op(1);
116
117 ex ibp = 0;
118 symbol ss;
119 for(int i=0; i<pdim; i++) {
120 auto ns = nsa;
121 ns.let_op(i) = nsa.op(i) + 1;
122 auto dp = Propagator.op(i).subs(ilp==ss).diff(ss).subs(ss==ilp);
123 ibp -= (a(i)+Shift[i+1]) * F(ns) * dp;
124 }
125
126 ibp = ibp * iep;
127 ibp = ibp.expand();
128 ibp = ibp.subs(sp2s);
129 ibp = ibp.subs(Replacement);
130 ibp = ibp.subs(s2p);
131
132 ex res = 0;
133 for(int i=0; i<pdim; i++) {
134 auto ci = ibp.coeff(iWF(i), 1);
135 ci = MapFunction([i](const ex &e, MapFunction &self)->ex {
136 if(!e.has(F(w))) return e;
137 else if(e.match(F(w))) {
138 lst tmp = ex_to<lst>(e.op(0));
139 tmp.let_op(i) = tmp.op(i)-1;
140 return F(tmp);
141 } else return e.map(self);
142 })(ci);
143 res += ci;
144 }
145 res += ibp.subs(lst{iWF(w)==0});
146 auto cilp = iep.coeff(ilp);
147 if(!is_zero(cilp)) res += d*cilp*F(nsa);
148 ibps.append(res);
149 }
150
151cout << ibps << endl;
152
153
154
155 }
156
160 void Laporta::Run() {
161
162 }
163
167 void Laporta::Import() {
168
169 }
170
171}
172
int * a
IBP header file.
class used to wrap error message
Definition BASIC.h:242
lst Internal
Definition IBP.h:27
lst ISP
Definition IBP.h:34
lst Replacement
Definition IBP.h:29
lst DSP
Definition IBP.h:33
lst Integral
Definition IBP.h:31
lst External
Definition IBP.h:28
lst Propagator
Definition IBP.h:30
int ProblemNumber
Definition IBP.h:39
bool using_uw
Definition IBP.h:184
void Export() override
Export input data for KIRA.
Definition Laporta.cpp:59
class extended to GiNaC symbol class, represent a positive symbol
Definition BASIC.h:113
HepLib namespace.
Definition BASIC.cpp:17
const iSymbol iEpsilon
ex sp(const ex &a, const ex &b)
translated the vector dot a.b to a*b, useful in SecDec
Definition Pair.cpp:237
ex str2ex(const string &expr, symtab stab)
convert string to ex expression, using Parser internally
Definition BASIC.cpp:670
ex w
Definition Init.cpp:93
const Symbol d
void string_replace_all(string &str, const string &from, const string &to)
string ex2str(const ex &expr)
convert ex to output string, the defalut printer format will be used
Definition BASIC.cpp:715
ex w1
Definition BASIC.h:499
ex w2
Definition BASIC.h:499