Advanced Computing Platform for Theoretical Physics

Commit c89deef6 authored by Feng Feng's avatar Feng Feng
Browse files

update doxygen

parent 10ccad77
......@@ -200,7 +200,7 @@ namespace HepLib {
cout << "\r \r" << pre;
cout << "\\--Evaluating ";
if(key != "") cout << Color_HighLight << key << RESET << " ";
cout << Color_HighLight << nbatch << "x" << RESET << "[" << (bi+1) << "/" << btotal << "] " << flush;
cout << Color_HighLight << nbatch << "x" << RESET << "[" << (bi+1) << "/" << btotal << "] " << "@" << now(false) << flush;
}
auto pid = fork();
......@@ -236,17 +236,20 @@ namespace HepLib {
auto cpid = getpid();
if(cpid!=ppid) exit(0); // make sure child exit
while (waitpid(-pgid,NULL,0) != -1) { }
if(Verbose > 1 && ntotal > 0) cout << "@" << now(false) << endl;
if(ntotal > 0) {
if(Verbose > 10) cout << endl;
else if(Verbose > 1) cout << "\r \r" << flush;
}
vector<ex> ovec;
for(int bi=0; bi<btotal; bi++) {
if(Verbose > 1) {
if(key == "") {
cout << "\r \r" << pre;
cout << "\\--Reading *.gar [" << (bi+1) << "/" << btotal << "] " << flush;
cout << "\\--Reading *.gar [" << (bi+1) << "/" << btotal << "] " << "@" << now(false) << flush;
} else {
cout << "\r \r" << pre;
cout << "\\--Reading *." << Color_HighLight << key << RESET << ".gar [" << (bi+1) << "/" << btotal << "] " << flush;
cout << "\\--Reading *." << Color_HighLight << key << RESET << ".gar [" << (bi+1) << "/" << btotal << "] " << "@" << now(false) << flush;
}
}
......@@ -266,14 +269,16 @@ namespace HepLib {
cmd << "rm -fr " << ppid;
system(cmd.str().c_str());
}
if(Verbose > 1 && ntotal > 0) cout << "@" << now(false) << endl;
if(ntotal > 0) {
if(Verbose > 10) cout << endl;
else if(Verbose > 1) cout << "\r \r" << flush;
}
return ovec;
}
/**
* @brief get the symbol from symbol factory, if not exsit, a new one will be created
* @param s the name of the symbol
* @param check true to check exist, and if so, error will be thrown
* @return return the found/created symbol
*/
const symbol & get_symbol(const string & s) {
......@@ -530,6 +535,7 @@ namespace HepLib {
/**
* @brief garWrite to write the string-key map to the archive
* @param garfn ginac archive filename for output
* @param resMap a key-valued map
*/
void garWrite(const string &garfn, const map<string, ex> &resMap) {
archive ar;
......@@ -727,7 +733,7 @@ namespace HepLib {
/**
* @brief convert lst to exvector
* @param exvec input lst
* @param alst input lst
* @return exvector
*/
exvector lst2vec(const lst & alst) {
......@@ -968,7 +974,6 @@ namespace HepLib {
* @brief the expand like Mathematica
* @param expr_in input expression
* @param pats only expand the element e, when e has at least one pattern in pats is true
* @param depth will be incresed by 1 when each recursively called
* @return the expanded expression
*/
ex mma_expand(ex const &expr_in, lst const &pats) {
......@@ -984,7 +989,6 @@ namespace HepLib {
* @brief the expand like Mathematica
* @param expr_in input expression
* @param pat only expand the element e, when e has the pattern: pat
* @param depth will be incresed by 1 when each recursively called
* @return the expanded expression
*/
ex mma_expand(ex const &expr_in, const ex &pat) {
......@@ -1373,7 +1377,8 @@ namespace HepLib {
/**
* @brief remove the last in index1-th.index2-th of expression
* @param ex_in input expression will be update
* @param index the index
* @param index1 the index
* @param index2 the index
*/
void let_op_remove_last(ex & ex_in, int index1, int index2) {
auto tmp = ex_to<lst>(ex_in.op(index1).op(index2));
......@@ -1384,7 +1389,8 @@ namespace HepLib {
/**
* @brief remove the last in index1-th.index2-th of expression
* @param ex_in input expression will be update
* @param index the index
* @param index1 the index
* @param index2 the index
*/
void let_op_remove_last(lst & ex_in, int index1, int index2) {
auto tmp = ex_to<lst>(ex_in.op(index1).op(index2));
......@@ -1417,7 +1423,8 @@ namespace HepLib {
/**
* @brief remove the first in index1-th.index2-th of expression
* @param ex_in input expression will be update
* @param index the index
* @param index1 the index
* @param index2 the index
*/
void let_op_remove_first(ex & ex_in, int index1, int index2) {
auto tmp = ex_to<lst>(ex_in.op(index1).op(index2));
......@@ -1428,7 +1435,8 @@ namespace HepLib {
/**
* @brief remove the first in index1-th.index2-th of expression
* @param ex_in input expression will be update
* @param index the index
* @param index1 the index
* @param index2 the index
*/
void let_op_remove_first(lst & ex_in, int index1, int index2) {
auto tmp = ex_to<lst>(ex_in.op(index1).op(index2));
......@@ -1441,7 +1449,7 @@ namespace HepLib {
* @param ex_in input expression will be update
* @param index1 the index
* @param index2 the index
* @param the new item
* @param item the new item
*/
void let_op(ex &ex_in, int index1, int index2, const ex item) {
ex_in.let_op(index1).let_op(index2) = item;
......@@ -1452,7 +1460,7 @@ namespace HepLib {
* @param ex_in input expression will be update
* @param index1 the index
* @param index2 the index
* @param the new item
* @param item the new item
*/
void let_op(lst &ex_in, int index1, int index2, const ex item) {
ex_in.let_op(index1).let_op(index2) = item;
......@@ -1464,7 +1472,7 @@ namespace HepLib {
* @param index1 the index
* @param index2 the index
* @param index3 the index
* @param the new item
* @param item the new item
*/
void let_op(ex &ex_in, int index1, int index2, int index3, const ex item) {
ex_in.let_op(index1).let_op(index2).let_op(index3) = item;
......@@ -1476,7 +1484,7 @@ namespace HepLib {
* @param index1 the index
* @param index2 the index
* @param index3 the index
* @param the new item
* @param item the new item
*/
void let_op(lst &ex_in, int index1, int index2, int index3, const ex item) {
ex_in.let_op(index1).let_op(index2).let_op(index3) = item;
......@@ -1592,9 +1600,20 @@ namespace HepLib {
}
// power
if(is_a<GiNaC::power>(a) && is_a<GiNaC::power>(b)) {
if(!is_zero(a.op(0)-b.op(0))) return ex_less(a.op(0),b.op(0));
if(!is_zero(a.op(1)-b.op(1))) return ex_less(a.op(1),b.op(1));
if(is_a<GiNaC::power>(a) || is_a<GiNaC::power>(b)) {
ex ae=a, be=b;
ex an=1, bn=1;
if(is_a<GiNaC::power>(a)) {
ae = a.op(0);
an = a.op(1);
}
if(is_a<GiNaC::power>(b)) {
be = b.op(0);
bn = b.op(1);
}
if(!is_zero(ae-be)) return ex_less(ae,be);
if(is_a<numeric>(an) && is_a<numeric>(bn)) return (evalf(an-bn)>0);
if(!is_zero(an-bn)) return ex_less(an,bn);
return false;
}
......@@ -1614,7 +1633,7 @@ namespace HepLib {
}
// add
if(is_a<add>(a) || is_a<add>(b)) {
if(is_a<add>(a) && is_a<add>(b)) {
auto as = add2lst(a);
auto bs = add2lst(b);
auto na = as.nops();
......@@ -1629,9 +1648,11 @@ namespace HepLib {
if(na!=nb) return (na<nb);
return false;
}
if(is_a<add>(a)) return false;
if(is_a<add>(b)) return true;
// mul
if(is_a<mul>(a) || is_a<mul>(b)) {
if(is_a<mul>(a) && is_a<mul>(b)) {
auto as = mul2lst(a);
auto bs = mul2lst(b);
auto na = as.nops();
......@@ -1646,6 +1667,8 @@ namespace HepLib {
if(na!=nb) return (na<nb);
return false;
}
if(is_a<mul>(a)) return false;
if(is_a<mul>(b)) return true;
// type
string tna = a.return_type_tinfo().tinfo->name();
......@@ -2161,9 +2184,24 @@ namespace HepLib {
auto ms = mul2lst(m);
sort_lst(ms);
auto cl = m.precedence();
// handle negative number
int nn = ms.nops();
if(nn>1 && is_a<numeric>(ms.op(0)) && ms.op(0)<0) {
ex nex = ms.op(nn-1);
if(is_a<add>(nex)) {
nex = numeric(-1) * nex;
if(is_a<add>(nex)) {
ms.let_op(0) = numeric(-1) * ms.op(0);
ms.let_op(nn-1) = nex;
}
}
}
bool first = true;
if(cl<=level) c.s << '(';
for(auto item : ms) {
if(is_a<numeric>(item) && is_zero(item-1)) continue;
if(!first) c.s << "*";
item.print(c, cl);
first = false;
......@@ -2172,4 +2210,3 @@ namespace HepLib {
}
}
......@@ -405,8 +405,9 @@ namespace HepLib::FC {
/**
* @brief Apart on ex
* @param expr_in normal expresion, product of [ linear w.r.t. vars ]^n
* @param expr_ino normal expresion, product of [ linear w.r.t. vars ]^n
* @param vars_in independent variables
* @param sgnmap the sign map
* @return sum of coefficient * ApartIR
*/
ex Apart(const ex &expr_ino, const lst &vars_in, exmap sgnmap) {
......@@ -569,7 +570,7 @@ namespace HepLib::FC {
/**
* @brief Apart on ex
* @param expr_in input expression
* @param expr_ino input expression
* @param loops list of loop Vector
* @param extps list of external Vector
* @return sum of coefficient * ApartIR
......@@ -581,7 +582,7 @@ namespace HepLib::FC {
lst sps;
exmap sgnmap;
for(auto li : loops) {
sgnmap[SP(li)] = -1;
sgnmap[SP(li)] = 1;
for(auto li2: loops) {
auto item = SP(li, li2).subs(SP_map);
if(is_a<Pair>(item)) sps.append(item);
......@@ -631,7 +632,6 @@ namespace HepLib::FC {
/**
* @brief complete the ApartIR elements
* @param expr_in input expression
* @param cut_props cut propagators, default is { }
* @return ApartIR with complete matrix rank, ready for IBP reduction
*/
ex ApartIRC(const ex & expr_in) {
......@@ -676,6 +676,7 @@ namespace HepLib::FC {
* @param air_vec vector contains aparted input, ApartIRC will be call internally
* @param loops_exts lst { loop vectors, external vectors, }
* @param cut_props cut propagators, default is { }
* @param uf the function to compute UF polynomial
* @return nothing returned, the input air_vec will be updated
*/
void ApartIBP(int IBPmethod, exvector &air_vec, const lst & loops_exts, const lst & cut_props,
......
......@@ -438,8 +438,6 @@ namespace HepLib::FC {
return 0;
}
REGISTER_FUNCTION(Matrix, do_not_evalf_params().conjugate_func(mat_conj).set_return_type(return_types::commutative))
/**
* @brief make contract on matrix, i.e., Matrix(a,i1,i2)*Matrix(b,i2,i3) -> Matrix(a*b,i1,i3)
* @param expr_in expression contains Matrix
......@@ -554,5 +552,7 @@ namespace HepLib::FC {
return expr;
}
REGISTER_FUNCTION(Matrix, do_not_evalf_params().conjugate_func(mat_conj).set_return_type(return_types::commutative))
}
......@@ -507,6 +507,7 @@ id TTR(colA1?,colA2?) = I2R*d_(colA1,colA2);
/**
* @brief evalulate expr in form program, see also the form_trace_mode and form_expand_mode
* @param expr the input expression
* @param verb for verb output
* @return result with index contract, trace performed, etc.
*/
ex form(const ex &expr, int verb) {
......
......@@ -22,7 +22,7 @@ namespace HepLib::IBP {
/**
* @brief Sort for all permuations, and return xs w.r.t. 1st permutation
* @param expr the input expression, as the sort key, no need of polynormial of xs
* @param in_expr the input expression, as the sort key, no need of polynormial of xs
* @param xs the permutation list
* @return 1st of sorted xs
*/
......@@ -124,18 +124,19 @@ namespace HepLib::IBP {
/**
* @brief UF function, from FIRE.m
* @param base the Base object
* @param idx exponent for the internal Propagator
* @return lst of {U, F}
*/
lst LoopUF(const Base & fire, const ex & idx) {
lst LoopUF(const Base & base, const ex & idx) {
static map<ex,exmap,ex_is_less> cache_by_prop;
exmap & cache = cache_by_prop[lst{fire.Propagators,fire.Internal}];
exmap & cache = cache_by_prop[lst{base.Propagators,base.Internal}];
ex ut, ft, uf;
lst key;
lst xs;
exmap x2ax;
int nxi=0;
int nps = fire.Propagators.nops();
int nps = base.Propagators.nops();
ft = 0;
for(int i=0; i<nps; i++) {
if(is_zero(idx.op(i))) {
......@@ -145,25 +146,25 @@ namespace HepLib::IBP {
key.append(1);
if(!is_zero(idx.op(i)-1)) x2ax[x(nxi)] = a(idx.op(i)) * x(nxi);
xs.append(x(nxi));
ft -= x(nxi) * fire.Propagators.op(i); // only used when no cache item
ft -= x(nxi) * base.Propagators.op(i); // only used when no cache item
nxi++;
}
if(cache.find(key)==cache.end()) { // no cache item
ut = 1;
for(int i=0; i<fire.Internal.nops(); i++) {
for(int i=0; i<base.Internal.nops(); i++) {
ft = ft.expand();
ft = subs_all(ft, fire.Replacements);
auto t2 = ft.coeff(fire.Internal.op(i),2);
auto t1 = ft.coeff(fire.Internal.op(i),1);
auto t0 = ft.subs(fire.Internal.op(i)==0);
ft = subs_all(ft, base.Replacements);
auto t2 = ft.coeff(base.Internal.op(i),2);
auto t1 = ft.coeff(base.Internal.op(i),1);
auto t0 = ft.subs(base.Internal.op(i)==0);
ut *= t2;
if(is_zero(t2)) return lst{0,0};
ft = normal(t0-t1*t1/(4*t2));
}
ft = normal(ut*ft);
ft = normal(subs_all(ft, fire.Replacements));
ut = normal(subs_all(ut, fire.Replacements));
ft = normal(subs_all(ft, base.Replacements));
ut = normal(subs_all(ut, base.Replacements));
uf = normal(ut*ft);
cache[key] = lst{ut,ft,uf};
......@@ -186,7 +187,12 @@ namespace HepLib::IBP {
/**
* @brief UF function, from FIRE.m
* @param idx exponent for the internal Propagator
* @param ps the list of propagator
* @param ns the list of exponent
* @param loops the list of loop momenta
* @param tloops the list of transverse/quasi momenta
* @param lsubs the replacements for loops
* @param tsubs the replacements for tloops
* @return lst of {U, F}
*/
lst UF(const ex & ps, const ex & ns, const ex & loops, const ex & tloops, const ex & lsubs, const ex & tsubs) {
......@@ -281,6 +287,7 @@ namespace HepLib::IBP {
* @brief Find Rules for Integrals or Master Integrals
* @param fs vector of Base pointer object
* @param mi true for Master Integals
* @param uf the function to compute the UF polynomial
* @return rules replacement and left integrals or left master integrals
*/
pair<exmap,lst> FindRules(vector<Base*> & fs, bool mi, std::function<lst(const Base &, const ex &)> uf) {
......
......@@ -395,6 +395,7 @@ namespace HepLib::Qgraf {
* @brief Propagator for quark
* @param e expression with head of Propagator
* @param m the quark mass, default is 0
* @param color true for QCD, false for QED
* @return the quark propagator, with dirac/color index
*/
ex QuarkPropagator(ex e, ex m, bool color) {
......@@ -408,6 +409,7 @@ namespace HepLib::Qgraf {
/**
* @brief Propagator for gluon
* @param e expression with head of Propagator
* @param color true for QCD, false for QED
* @return the gloun propagator under Feynman gauge, with dirac/color index
*/
ex GluonPropagator(ex e, bool color) {
......@@ -421,6 +423,7 @@ namespace HepLib::Qgraf {
/**
* @brief Propagator for ghost
* @param e expression with head of Propagator
* @param color true for QCD, false for QED
* @return the ghost propagator, with dirac/color index
*/
ex GhostPropagator(ex e, bool color) {
......@@ -434,6 +437,7 @@ namespace HepLib::Qgraf {
/**
* @brief q-qbar-g vertex
* @param e expression with head of Vertex
* @param color true for QCD, false for QED
* @return the q-qbar-g vertex
*/
ex q2gVertex(ex e, bool color) {
......@@ -483,6 +487,7 @@ namespace HepLib::Qgraf {
/**
* @brief ghost-anti ghost-g vertex
* @param e expression with head of Vertex
* @param color true for QCD, false for QED
* @return the ghost-anti ghost-g vertex
*/
ex gh2gVertex(ex e, bool color) {
......@@ -618,6 +623,7 @@ namespace HepLib::Qgraf {
/**
* @brief polarization sum for gluon
* @param qi gluon qgraf index
* @param color true for QCD, false for QED
* @return g^{i ir} delta^{i ir}
*/
ex GluonSumL(int qi, bool color) {
......@@ -628,6 +634,7 @@ namespace HepLib::Qgraf {
/**
* @brief polarization sum for gluon
* @param qi gluon qgraf index
* @param color true for QCD, false for QED
* @return g^{i ir} delta^{i ir}
*/
ex GluonSumR(int qi, bool color) {
......@@ -640,6 +647,7 @@ namespace HepLib::Qgraf {
* @param qi quark qgraf index
* @param p anti-quark momentum vector
* @param m anti-quark mass
* @param color true for QCD, false for QED
* @return Quark summation
*/
ex QuarkSumL(int qi, ex p, ex m, bool color) {
......@@ -652,6 +660,7 @@ namespace HepLib::Qgraf {
* @param qi quark qgraf index
* @param p anti-quark momentum vector
* @param m anti-quark mass
* @param color true for QCD, false for QED
* @return Quark summation
*/
ex QuarkSumR(int qi, ex p, ex m, bool color) {
......@@ -677,6 +686,7 @@ namespace HepLib::Qgraf {
* @param qi anti-quark qgraf index
* @param p anti-quark momentum vector
* @param m anti-quark mass
* @param color true for QCD, false for QED
* @return anti-Quark summation
*/
ex AntiQuarkSumR(int qi, ex p, ex m, bool color) {
......@@ -723,6 +733,7 @@ namespace HepLib::Qgraf {
/**
* @brief polarization sum for total angular momentum
* @param qi qgraf index
* @param p the total momentum
* @return -g^{qi, rqi} + p^qi p^rqi/p.p
*/
ex J1SumL(int qi, ex p) {
......@@ -733,6 +744,7 @@ namespace HepLib::Qgraf {
/**
* @brief polarization sum for total angular momentum
* @param qi qgraf index
* @param p the momentum
* @return -g^{qi, rqi} + p^qi p^rqi/p.p
*/
ex J1SumR(int qi, ex p) {
......
......@@ -134,6 +134,7 @@ namespace HepLib::Qgraf {
* @brief Color-Octet Projector
* @param i quark qgraf index
* @param j anti-quark qgraf index
* @param a the color index
* @return Color-Octet Projector
*/
ex ColorProj(int i, int j, Index a) {
......@@ -162,7 +163,7 @@ namespace HepLib::Qgraf {
* @param si spin index
* @param qi q-vector index
* @param mu spin index
* @param total momentum
* @param p total momentum
* @return S-L with total spin 1
*/
ex S1L1Proj(ex si, ex qi, ex mu, ex p) {
......@@ -175,7 +176,7 @@ namespace HepLib::Qgraf {
* @param qi q-vector index
* @param mu1 spin-2 index
* @param mu2 spin-2 index
* @param total momentum
* @param p total momentum
* @return S-L with total spin 2
*/
ex S1L1Proj(ex si, ex qi, ex mu1, ex mu2, ex p) {
......@@ -188,7 +189,7 @@ namespace HepLib::Qgraf {
* @param qi1 q1-vector index
* @param qi2 q2-vector index
* @param mu spin index
* @param total momentum
* @param p total momentum
* @return S-L with total spin 1
*/
ex S1L2Proj(ex si, ex qi1, ex qi2, ex mu, ex p) {
......@@ -202,7 +203,7 @@ namespace HepLib::Qgraf {
* @param qi2 q2-vector index
* @param mu1 spin-2 index
* @param mu2 spin-2 index
* @param total momentum
* @param p total momentum
* @return S-L with total spin L
*/
ex S1L2Proj(ex si, ex qi1, ex qi2, ex mu1, ex mu2, ex p) {
......@@ -376,6 +377,7 @@ namespace HepLib::Qgraf {
* @brief n-massless body phase space
* https://arxiv.org/abs/hep-ph/0311276v1
* @param n the number of massless particles
* @param q2 the squared total momentum
* @return integrated phase space
*/
ex nPS(int n, ex q2) {
......@@ -392,7 +394,7 @@ namespace HepLib::Qgraf {
* https://arxiv.org/abs/hep-ph/0311276v1
* @param moms momentum in phase space
* @param amp input amplitudes
* @param si start index, -1 for automatically detect
* @param si_in start index, -1 for automatically detect
* @param q2 refers to q^2, total invarant mass
* @return amp * PS2/3/4, for PS4, a list will be returned
*/
......
......@@ -79,7 +79,7 @@ namespace HepLib::SD {
* @brief to Projectivize the input fe, the fe will be updated
* @param fe is the { function list, exponet list }
* @param delta is a list of x's in Delta function
* @param xsum is used to balance the powers, xsum refers to Delta(1-xsum), if xsum=0, then xsum=SUM(delta list)
* @param xsum_in is used to balance the powers, xsum refers to Delta(1-xsum), if xsum=0, then xsum=SUM(delta list)
*/
void ChengWu::Projectivize(ex &fe, const ex delta, const ex xsum_in) {
static symbol s;
......@@ -695,7 +695,7 @@ namespace HepLib::SD {
/**
* @brief WickRotation, just check WRA exist or NOT to see successful or NOT. Still Experimental
* @param in_fe input fe
* @param fe_vec input fe vector
* @return vector of fe
*/
exvector ChengWu::WickRotation(const exvector & fe_vec) {
......
This diff is collapsed.
HepLib Project {#mainpage}
HepLib Project {#mainpage}
---------
Home page: [https://heplib.github.io](https://heplib.github.io)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment