14    string Laporta::Fout(
const ex & expr) {
 
   17            if(is_a<lst>(f)) f = F(f);
 
   18            else if(expr.match(F(
w1,
w2))) f = F(f.op(1));
 
   27            if(expr.match(F(
w1,
w2))) idx = expr.op(1);
 
   28            else if(expr.match(F(
w))) idx = expr.op(0);
 
   30            return to_string(i2w[idx]);
 
   37    ex Laporta::Fin(
const string & expr) {
 
   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.");
 
   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));
 
   65        for(
auto ii : 
Internal) InExternal.append(ii);
 
   66        for(
auto ii : 
External) InExternal.append(ii);
 
   70                for(
auto ii : InExternal) 
ISP.append(it*ii);
 
   76        if(
ISP.nops() > pdim) {
 
   77            cout << 
"ISP = " << 
ISP << endl;
 
   79            throw Error(
"UKIRA::Export: #(ISP) > #(Propagator).");
 
   84        for(
auto item : 
ISP) {
 
   86            Symbol si(
"P"+to_string(_pic));
 
   88            sp2s.append(
w*item==
w*si);
 
   89            sp2s.append(item==si);
 
   90            s2sp.append(si==item);
 
   94        for(
int i=0; i<
ISP.nops(); i++) { 
 
   98            if(eq.has(iWF(
w))) 
throw Error(
"UKIRA::Export, iWF used in eq.");
 
   99            leqns.append(eq == iWF(i));
 
  101        auto s2p = lsolve(leqns, ss);
 
  102        if(s2p.nops() != 
ISP.nops()) 
throw Error(
"KIRA::Export: lsolve failed.");
 
  106            for(
auto p2 : InExternal)
 
  107            DSP.append(lst{p1,p2});
 
  112        for(
int i=0; i<pdim; i++) nsa.append(
a(i));
 
  119            for(
int i=0; i<pdim; i++) {
 
  121                ns[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;
 
  128            ibp = ibp.subs(sp2s);
 
  129            ibp = ibp.subs(Replacement);
 
  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[i] = tmp.op(i)-1;
 
  141                    } 
else return e.map(self);
 
  145            res += ibp.subs(lst{iWF(
w)==0});
 
  146            auto cilp = iep.coeff(ilp);
 
  147            if(!is_zero(cilp)) res += 
d*cilp*F(nsa);
 
 
  160    void Laporta::Run() {
 
 
  167    void Laporta::Import() {
 
 
class used to wrap error message
 
void Export() override
Export input data for KIRA.
 
class extended to GiNaC symbol class, represent a positive symbol
 
ex sp(const ex &a, const ex &b)
translated the vector dot a.b to a*b, useful in SecDec
 
ex str2ex(const string &expr, symtab stab)
convert string to ex expression, using Parser internally
 
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