Advanced Computing Platform for Theoretical Physics

Commit 0c50e50a authored by Feng Feng's avatar Feng Feng
Browse files

change DiracGamma to DGamma, add HepFormat for unique output

parent 34450fe4
......@@ -1897,13 +1897,16 @@ namespace HepLib {
exmap map_rat;
expr_in = expr_in.to_rational(map_rat);
lst rep_vs;
lst rep_vs, rep_vs2;
for(const_preorder_iterator i = expr_in.preorder_begin(); i != expr_in.preorder_end(); ++i) {
if(is_a<symbol>(*i)) rep_vs.append(*i);
if(is_a<symbol>(*i)) rep_vs2.append(*i);
}
rep_vs.sort();
rep_vs.unique();
sort_lst(rep_vs);
rep_vs2.sort();
rep_vs2.unique();
auto rep_vs2_tot = rep_vs2.nops();
for(int i=0; i<rep_vs2_tot; i++) rep_vs2.let_op(i) = lst{rep_vs2.op(i).subs(map_rat),rep_vs2.op(i)};
sort_lst(rep_vs2);
for(auto item : rep_vs2) rep_vs.append(item.op(1));
exmap v2f, f2v;
exmap nn_map;
......@@ -2109,5 +2112,42 @@ namespace HepLib {
return inner_form_factor(num_den.op(0))/inner_form_factor(num_den.op(1));
}
//-----------------------------------------------------------
// FCFormat Output
//-----------------------------------------------------------
HepFormat::HepFormat(ostream &os, unsigned opt) : print_dflt(os, opt) {}
HepFormat::HepFormat() : print_dflt(std::cout) {}
GINAC_IMPLEMENT_PRINT_CONTEXT(HepFormat, print_dflt)
OUT_FORMAT_IMPLEMENT(HepFormat)
void HepFormat::add_print(const add & a, const HepFormat & c, unsigned level) {
auto as = add2lst(a);
sort_lst(as);
auto cl = a.precedence();
bool first = true;
if(cl<=level) c.s << '(';
for(auto item : as) {
if(!first) c.s << "+";
item.print(c, cl);
first = false;
}
if(a.precedence()<=level) c.s << ')';
}
void HepFormat::mul_print(const mul & m, const HepFormat & c, unsigned level) {
auto ms = mul2lst(m);
sort_lst(ms);
auto cl = m.precedence();
bool first = true;
if(cl<=level) c.s << '(';
for(auto item : ms) {
if(!first) c.s << "*";
item.print(c, cl);
first = false;
}
if(cl<=level) c.s << ')';
}
}
......@@ -708,4 +708,26 @@ namespace HepLib {
pid_t pid = 0;
};
/**
* @brief class for HepLib Format Output
*/
class HepFormat : public print_dflt {
GINAC_DECLARE_PRINT_CONTEXT(HepFormat, print_dflt)
public:
HepFormat(ostream &os, unsigned opt=0);
static void add_print(const add & a, const HepFormat & c, unsigned level=0);
static void mul_print(const mul & m, const HepFormat & c, unsigned level=0);
OUT_FORMAT_DECLARE(HepFormat)
/**
* @brief inner class for some static initializations
*/
class _init {
public: _init();
};
private:
static _init HepFormat_init;
};
extern HepFormat hout;
}
......@@ -72,7 +72,7 @@ public:
bool isVector();
bool isIndex();
bool isPair();
bool isDiracGamma();
bool isDGamma();
bool info(std::string sflags);
expr map(MapFunction &mf);
......
......@@ -42,7 +42,7 @@ bool expr::isSymbol() { return GiNaC::is_a<HepLib::Symbol>(_expr); }
bool expr::isVector() { return GiNaC::is_a<HepLib::FC::Vector>(_expr); }
bool expr::isIndex() { return GiNaC::is_a<HepLib::FC::Index>(_expr); }
bool expr::isPair() { return GiNaC::is_a<HepLib::FC::Pair>(_expr); }
bool expr::isDiracGamma() { return GiNaC::is_a<HepLib::FC::DiracGamma>(_expr); }
bool expr::isDGamma() { return GiNaC::is_a<HepLib::FC::DGamma>(_expr); }
bool expr::info(std::string sflags) {
if (sflags == "numeric") return _expr.info(GiNaC::info_flags::numeric);
......
......@@ -51,7 +51,7 @@ public:
bool isVector();
bool isIndex();
bool isPair();
bool isDiracGamma();
bool isDGamma();
bool info(std::string sflags);
expr map(MapFunction &mf);
......
......@@ -407,10 +407,9 @@ namespace HepLib::FC {
* @brief Apart on ex
* @param expr_in normal expresion, product of [ linear w.r.t. vars ]^n
* @param vars_in independent variables
* @param sign_map a map of vars to 1 or -1, key can be omited
* @return sum of coefficient * ApartIR
*/
ex Apart(const ex &expr_in, const lst &vars_in, exmap sign_map) {
ex Apart(const ex &expr_in, const lst &vars_in) {
exmap map1, map2;
lst vars;
for(int i=0; i<vars_in.nops(); i++) {
......@@ -476,15 +475,15 @@ namespace HepLib::FC {
// consider sign
bool has_sgn = false;
for(auto v : vars) {
if(pc.has(iEpsilon) && key_exists(sign_map,iEpsilon)) { // iEpsilon first
ex sign = sign_map[iEpsilon]/pc.coeff(iEpsilon);
if(pc.has(iEpsilon) && key_exists(Apart_SignMap,iEpsilon)) { // iEpsilon first
ex sign = Apart_SignMap[iEpsilon]/pc.coeff(iEpsilon);
pref /= pow(sign, nc);
pc *= sign;
has_sgn = true;
break;
} else {
if(is_zero(pc.coeff(v)) || !key_exists(sign_map,v.subs(map2))) continue;
ex sign = sign_map[v.subs(map2)]/pc.coeff(v);
if(is_zero(pc.coeff(v)) || !key_exists(Apart_SignMap,v.subs(map2))) continue;
ex sign = Apart_SignMap[v.subs(map2)]/pc.coeff(v);
pref /= pow(sign, nc);
pc *= sign;
has_sgn = true;
......@@ -543,9 +542,8 @@ namespace HepLib::FC {
auto expr = expr_in;
lst sps;
exmap sign;
for(auto li : loops) {
sign[SP(li)] = -1;
Apart_SignMap[SP(li)] = -1;
for(auto li2: loops) {
auto item = SP(li, li2).subs(SP_map);
if(is_a<Pair>(item)) sps.append(item);
......@@ -560,10 +558,9 @@ namespace HepLib::FC {
sort_lst(sps);
auto cv_lst = mma_collect_lst(expr, loops);
sort_lst(cv_lst);
ex res = 0;
for(auto item : cv_lst) {
res += item.op(0) * Apart(item.op(1), sps, sign);
res += item.op(0) * Apart(item.op(1), sps);
}
// fermat_normal
......@@ -618,7 +615,7 @@ namespace HepLib::FC {
for(int c=0; c<cc; c++) mat(r,c) = mat0(r,c);
}
for(int i=0; i<n; i++) {
mat(i,cc) = 1;
mat(i,cc) = (key_exists(Apart_SignMap,e.op(1).op(i)) ? Apart_SignMap[e.op(1).op(i)] : 1);
auto r = mat.rank();
if(r==n) break;
if(r==cc+1) cc++;
......@@ -735,14 +732,22 @@ namespace HepLib::FC {
auto vars = ex_to<lst>(item.op(1));
lst pns;
int nrow = mat.rows();
for(int c=0; c<mat.cols(); c++) {
for(int c=0; c<mat.cols()-cut_props.nops(); c++) {
ex pc = 0;
for(int r=0; r<nrow-2; r++) pc += mat(r,c) * vars.op(r);
pc += mat(nrow-2,c);
pc = SP2sp(pc);
pns.append(lst{ pc,ex(0)-mat(nrow-1,c) }); // note Apart and FIRE convension
}
sort_lst(pns);
sort_lst(pns); // note the cut_props should NOT be sorted
for(int c=mat.cols()-cut_props.nops(); c<mat.cols(); c++) {
ex pc = 0;
for(int r=0; r<nrow-2; r++) pc += mat(r,c) * vars.op(r);
pc += mat(nrow-2,c);
pc = SP2sp(pc);
pns.append(lst{ pc,ex(0)-mat(nrow-1,c) }); // note Apart and FIRE convension
}
lst props, ns;
for(auto item : pns) {
props.append(item.op(0));
......
......@@ -37,10 +37,10 @@ namespace HepLib::FC {
OUT_FORMAT_IMPLEMENT(FormFormat)
void FormFormat::power_print(const power & p, const FormFormat & c, unsigned level) {
if(p.op(1)==2 && !DiracGamma::has(p)) {
if(p.op(1)==2 && !DGamma::has(p)) {
c << "((" << p.op(0) << ")*(" << p.op(0) << "))";
} else {
c << "(" << p.op(0) << ")^(" << p.op(1) << ")";
c << "((" << p.op(0) << ")^(" << p.op(1) << "))";
}
}
......
/**
* @file
* @brief Functions for DiracGamma
* @brief Functions for DGamma
*/
#include "FC.h"
......@@ -16,7 +16,7 @@ namespace HepLib::FC {
else {
ex c=1; ex v=1;
for(auto it : item) {
if(!Index::has(it) && !DiracGamma::has(it)) c *= it;
if(!Index::has(it) && !DGamma::has(it)) c *= it;
else v *= it;
}
res += c * TR(v);
......@@ -33,73 +33,73 @@ namespace HepLib::FC {
ex c=1;
ex v=1;
for(auto it : num) {
if(!Index::has(it) && !DiracGamma::has(it)) c *= it;
if(!Index::has(it) && !DGamma::has(it)) c *= it;
else v *= it;
}
return c*TR(v)/nd.op(1);
}
//-----------------------------------------------------------
// DiracGamma Class
// DGamma Class
//-----------------------------------------------------------
GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(DiracGamma, basic,
print_func<print_dflt>(&DiracGamma::print).
print_func<FormFormat>(&DiracGamma::form_print).
print_func<FCFormat>(&DiracGamma::fc_print)
GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(DGamma, basic,
print_func<print_dflt>(&DGamma::print).
print_func<FormFormat>(&DGamma::form_print).
print_func<FCFormat>(&DGamma::fc_print)
)
DEFAULT_CTOR(DiracGamma)
GINAC_BIND_UNARCHIVER(DiracGamma);
IMPLEMENT_HAS(DiracGamma)
IMPLEMENT_ALL(DiracGamma)
DEFAULT_CTOR(DGamma)
GINAC_BIND_UNARCHIVER(DGamma);
IMPLEMENT_HAS(DGamma)
IMPLEMENT_ALL(DGamma)
return_type_t DiracGamma::return_type_tinfo() const {
return_type_t DGamma::return_type_tinfo() const {
return make_return_type_t<clifford>(rl);
//return make_return_type_t<DiracGamma>(rl);
//return make_return_type_t<DGamma>(rl);
}
bool DiracGamma::match_same_type(const basic & other) const {
const DiracGamma &o = static_cast<const DiracGamma &>(other);
bool DGamma::match_same_type(const basic & other) const {
const DGamma &o = static_cast<const DGamma &>(other);
return rl == o.rl;
}
unsigned DiracGamma::get_rl() {
unsigned DGamma::get_rl() {
return rl;
}
int DiracGamma::compare_same_type(const basic &other) const {
const DiracGamma &o = static_cast<const DiracGamma &>(other);
int DGamma::compare_same_type(const basic &other) const {
const DGamma &o = static_cast<const DGamma &>(other);
if (rl != o.rl) return rl < o.rl ? -1 : 1;
return pi.compare(o.pi);
}
DiracGamma::DiracGamma(int int_1567, unsigned _rl) : pi(int_1567), rl(_rl) { }
DiracGamma::DiracGamma(const Vector &p, unsigned _rl) : pi(p), rl(_rl) { }
DiracGamma::DiracGamma(const Index &i, unsigned _rl) : pi(i), rl(_rl) { }
DiracGamma::DiracGamma(const DiracGamma &g, unsigned _rl) : pi(g.pi), rl(_rl) { }
DGamma::DGamma(int int_1567, unsigned _rl) : pi(int_1567), rl(_rl) { }
DGamma::DGamma(const Vector &p, unsigned _rl) : pi(p), rl(_rl) { }
DGamma::DGamma(const Index &i, unsigned _rl) : pi(i), rl(_rl) { }
DGamma::DGamma(const DGamma &g, unsigned _rl) : pi(g.pi), rl(_rl) { }
size_t DiracGamma::nops() const { return 2; }
ex DiracGamma::op(size_t i) const {
size_t DGamma::nops() const { return 2; }
ex DGamma::op(size_t i) const {
if(i==0) return pi;
else if(i==1) return rl;
return 0;
}
ex & DiracGamma::let_op(size_t i) {
ex & DGamma::let_op(size_t i) {
static ex ex_rl = numeric(rl);
ensure_if_modifiable();
if(i==0) return pi;
else return ex_rl;
}
ex DiracGamma::eval() const {
ex DGamma::eval() const {
if(flags & status_flags::evaluated) return *this;
else if(is_zero(pi) || is_zero(pi-1) || is_zero(pi-5) || is_zero(pi-6) || is_zero(pi-7)) return this->hold();
else if(!is_a<Vector>(pi) && !is_a<Index>(pi)) return GAS(pi,rl);
else return this->hold();
}
void DiracGamma::print(const print_dflt &c, unsigned level) const {
void DGamma::print(const print_dflt &c, unsigned level) const {
if(is_zero(pi-1)) {
c.s << "𝕚";
return;
......@@ -110,7 +110,7 @@ namespace HepLib::FC {
c.s << ")";
}
void DiracGamma::form_print(const FormFormat &c, unsigned level) const {
void DGamma::form_print(const FormFormat &c, unsigned level) const {
c << "g_(" << rl;
if(!is_zero(pi-1)) {
c << "," << pi;
......@@ -119,7 +119,7 @@ namespace HepLib::FC {
c << ")";
}
void DiracGamma::fc_print(const FCFormat &c, unsigned level) const {
void DGamma::fc_print(const FCFormat &c, unsigned level) const {
if(is_zero(pi-1)) {
c << "1";
return;
......@@ -129,29 +129,29 @@ namespace HepLib::FC {
c << "(" << pi << ")";
}
void DiracGamma::archive(archive_node & n) const {
void DGamma::archive(archive_node & n) const {
inherited::archive(n);
n.add_ex("pi", pi);
n.add_unsigned("rl", rl);
}
void DiracGamma::read_archive(const archive_node& n, lst& sym_lst) {
void DGamma::read_archive(const archive_node& n, lst& sym_lst) {
inherited::read_archive(n, sym_lst);
n.find_unsigned("rl", rl);
n.find_ex("pi", pi, sym_lst);
}
ex DiracGamma::derivative(const symbol & s) const {
ex DGamma::derivative(const symbol & s) const {
return 0;
}
ex DiracGamma::conjugate() const {
ex DGamma::conjugate() const {
if(is_a<Index>(pi) || is_a<Vector>(pi)) return *this;
else if(is_zero(pi-5)) return -1*DiracGamma(5, rl);
else if(is_zero(pi-6)) return DiracGamma(7, rl);
else if(is_zero(pi-7)) return DiracGamma(6, rl);
else if(is_zero(pi-1)) return DiracGamma(1, rl);
throw Error("invalid DiracGamma Found.");
else if(is_zero(pi-5)) return -1*DGamma(5, rl);
else if(is_zero(pi-6)) return DGamma(7, rl);
else if(is_zero(pi-7)) return DGamma(6, rl);
else if(is_zero(pi-1)) return DGamma(1, rl);
throw Error("invalid Dirac Gamma Found.");
}
//-----------------------------------------------------------
......@@ -224,13 +224,13 @@ namespace HepLib::FC {
* @brief function similar to GAD/GSD in FeynClac
* @param expr momentum/index or 1,5,6,7
* @param rl the represent line number
* @return expanded/translasted to DiracGamma objects
* @return expanded/translasted to Dirac Gamma objects
*/
ex GAS(const ex &expr, unsigned rl) {
if(is_zero(expr-1)) return DiracGamma(1,rl);
else if(is_zero(expr-5)) return DiracGamma(5,rl);
else if(is_zero(expr-6)) return DiracGamma(6,rl);
else if(is_zero(expr-7)) return DiracGamma(7,rl);
if(is_zero(expr-1)) return DGamma(1,rl);
else if(is_zero(expr-5)) return DGamma(5,rl);
else if(is_zero(expr-6)) return DGamma(6,rl);
else if(is_zero(expr-7)) return DGamma(7,rl);
ex tmp = expand(expr);
lst ex_lst;
......@@ -246,16 +246,16 @@ namespace HepLib::FC {
ex c=1, g=1;
for(auto ii : mul_lst) {
if(is_a<Vector>(ii)) {
if(is_a<DiracGamma>(g)) throw Error("Something Wrong with GAS");
g = DiracGamma(ex_to<Vector>(ii),rl);
if(is_a<DGamma>(g)) throw Error("Something Wrong with GAS");
g = DGamma(ex_to<Vector>(ii),rl);
} else if(is_a<Index>(ii)) {
if(is_a<DiracGamma>(g)) throw Error("Something Wrong with GAS");
g = DiracGamma(ex_to<Index>(ii),rl);
if(is_a<DGamma>(g)) throw Error("Something Wrong with GAS");
g = DGamma(ex_to<Index>(ii),rl);
} else {
c *= ii;
}
}
if(!is_a<DiracGamma>(g)) throw Error("Something Wrong with GAS");
if(!is_a<DGamma>(g)) throw Error("Something Wrong with GAS");
res += c * g;
}
return res;
......
......@@ -8,7 +8,7 @@
#include "IBP.h"
/**
* @brief namespace for Index, Vector, DiracGamma, etc.
* @brief namespace for Index, Vector, Dirac Gamma, etc.
*/
namespace HepLib::FC {
......@@ -25,6 +25,7 @@ namespace HepLib::FC {
extern const Symbol nL;
extern const Symbol nH;
extern exmap SP_map;
extern exmap Apart_SignMap;
extern int form_trace_mode;
extern const int form_trace_all;
......@@ -263,17 +264,17 @@ namespace HepLib::FC {
ex LC(ex pi1, ex pi2, ex pi3, ex pi4);
/**
* @brief class for DiracGamma object
* @brief class for DGamma object
*/
class DiracGamma : public basic {
GINAC_DECLARE_REGISTERED_CLASS(DiracGamma, basic)
class DGamma : public basic {
GINAC_DECLARE_REGISTERED_CLASS(DGamma, basic)
public:
ex pi;
unsigned rl;
DiracGamma(const Vector &p, unsigned rl=0);
DiracGamma(const Index &i, unsigned rl=0);
DiracGamma(int int_1567, unsigned _rl=0);
DiracGamma(const DiracGamma &g, unsigned _rl);
DGamma(const Vector &p, unsigned rl=0);
DGamma(const Index &i, unsigned rl=0);
DGamma(int int_1567, unsigned _rl=0);
DGamma(const DGamma &g, unsigned _rl);
void print(const print_dflt &c, unsigned level = 0) const;
void form_print(const FormFormat &c, unsigned level = 0) const;
void fc_print(const FCFormat &c, unsigned level = 0) const;
......@@ -292,7 +293,7 @@ namespace HepLib::FC {
ex derivative(const symbol & s) const override;
ex conjugate() const override;
};
GINAC_DECLARE_UNARCHIVER(DiracGamma);
GINAC_DECLARE_UNARCHIVER(DGamma);
//-----------------------------------------------------------
// TR/GAS functions
......@@ -302,8 +303,8 @@ namespace HepLib::FC {
DECLARE_FUNCTION_1P(TTR)
DECLARE_FUNCTION_1P(HF)
inline ex GAS(const Vector &p, unsigned rl=0) { return DiracGamma(p,rl); }
inline ex GAS(const Index &i, unsigned rl=0) { return DiracGamma(i,rl); }
inline ex GAS(const Vector &p, unsigned rl=0) { return DGamma(p,rl); }
inline ex GAS(const Index &i, unsigned rl=0) { return DGamma(i,rl); }
ex GAS(const ex &expr, unsigned rl=0);
// Form, TIR, Apart
......@@ -311,7 +312,7 @@ namespace HepLib::FC {
ex form(const ex &expr, int verb=0);
ex TIR(const ex &expr_in, const lst &loop_ps, const lst &ext_ps);
ex MatrixContract(const ex & expr_in);
ex Apart(const ex &expr_in, const lst &vars, exmap sign_map=exmap());
ex Apart(const ex &expr_in, const lst &vars);
ex Apart(const ex &expr_in, const lst &loops, const lst & extmoms);
ex ApartIR2ex(const ex & expr_in);
ex ApartIR2F(const ex & expr_in);
......
......@@ -37,7 +37,7 @@ namespace HepLib::FC {
return TTR(as);
}
alignas(2) static ex DiracGamma_reader(const exvector& ev) {
alignas(2) static ex DGamma_reader(const exvector& ev) {
int n = ev.size();
if(n==1) return GAS(ev[0]);
ex ret = 1;
......@@ -50,7 +50,7 @@ namespace HepLib::FC {
int n = ev.size();
if(n==0) return GAS(1);
else if(n==1) return GAS(1,ex2int(ev[0]));
else throw Error("DiracGamma_reader: number of arguments more than 2.");
else throw Error("DGamma_reader: number of arguments more than 2.");
}
}
......@@ -62,8 +62,8 @@ namespace HepLib::FC {
struct mapGamma : public map_function {
public:
ex operator()(const ex &e) {
if(is_a<DiracGamma>(e)) return DiracGamma(ex_to<DiracGamma>(e), gline);
else if(!DiracGamma::has(e)) return e;
if(is_a<DGamma>(e)) return DGamma(ex_to<DGamma>(e), gline);
else if(!DGamma::has(e)) return e;
else return e.map(*this);
}
mapGamma(int _gline) : gline(_gline) { };
......@@ -79,7 +79,7 @@ namespace HepLib::FC {
ex gs = e.op(0);
gline++;
gs = mapGamma(gline)(gs);
gs = DiracGamma(1, gline) * gs;
gs = DGamma(1, gline) * gs;
if(glmax<gline) {
glmax = gline;
if(glmax>128) throw Error("too large index with glmax>128.");
......@@ -285,7 +285,7 @@ id TTR(colA1?,colA2?) = I2R*d_(colA1,colA2);
ex item = it;
// pull out global common factor
item = collect_common_factors(item);
item = CoPat(item,[](const ex &e)->bool{return Index::has(e) || DiracGamma::has(e);});
item = CoPat(item,[](const ex &e)->bool{return Index::has(e) || DGamma::has(e);});
auto ckey = item.op(0);
if(!is_a<numeric>(ckey)) {
int ckid;
......@@ -496,7 +496,7 @@ id TTR(colA1?,colA2?) = I2R*d_(colA1,colA2);
fp.FTable[make_pair("LC", 4)] = LC_reader;
for(int i=1; i<30; i++) fp.FTable[make_pair("T", i)] = SUNT_reader;
for(int i=1; i<30; i++) fp.FTable[make_pair("TTRX", i)] = TTR_reader;
for(int i=1; i<30; i++) fp.FTable[make_pair("DG", i)] = DiracGamma_reader;
for(int i=1; i<30; i++) fp.FTable[make_pair("DG", i)] = DGamma_reader;
fp.FTable[make_pair("GI", 0)] = gi_reader;
fp.FTable[make_pair("GI", 1)] = gi_reader;
ex ret = fp.Read(ostr);
......@@ -547,7 +547,7 @@ id TTR(colA1?,colA2?) = I2R*d_(colA1,colA2);
return ret.subs(SP_map);
} else if(form_expand_mode==form_expand_all) {
auto cv_lst = mma_collect_lst(expr.subs(SP_map), [](const ex & e)->bool {
return e.has(TR(w)) || SUNT::has(e) || SUNF::has(e) || SUNF4::has(e) || Index::has(e) || DiracGamma::has(e);
return e.has(TR(w)) || SUNT::has(e) || SUNF::has(e) || SUNF4::has(e) || Index::has(e) || DGamma::has(e);
});
lst to_lst;
for(auto cv : cv_lst) to_lst.append(cv.op(1));
......@@ -568,9 +568,9 @@ id TTR(colA1?,colA2?) = I2R*d_(colA1,colA2);
*/
ex charge_conjugate(const ex & expr) {
if(expr.has(Matrix(w1,w2,w3))) throw Error("charge_conjugate: Matrix found.");
if(!DiracGamma::has(expr)) return expr;
if(is_a<DiracGamma>(expr)) {
DiracGamma g = ex_to<DiracGamma>(expr);
if(!DGamma::has(expr)) return expr;
if(is_a<DGamma>(expr)) {
DGamma g = ex_to<DGamma>(expr);
if(is_a<Vector>(g.pi) || is_a<Index>(g.pi)) return -expr;
else if(is_zero(g.pi-1) || is_zero(g.pi-5)) return expr;
}
......@@ -589,7 +589,7 @@ id TTR(colA1?,colA2?) = I2R*d_(colA1,colA2);
for(int i=n-1; i>-1; i--) ret *= charge_conjugate(expr.op(i));
return ret;
}
cout << DiracGamma::has(expr) << " : " << expr << endl;
cout << DGamma::has(expr) << " : " << expr << endl;
throw Error("charge_conjugate: unexpected region.");
return 0;
}
......
......@@ -43,6 +43,13 @@ namespace HepLib {
bool fermat_use_array = true;
int NNDigits = 100;
HepFormat::_init::_init() {
set_print_func<add, HepFormat>(HepFormat::add_print);
set_print_func<mul, HepFormat>(HepFormat::mul_print);
}
HepFormat::_init HepFormat_init;
HepFormat hout(cout);
lst GiNaC_archive_Symbols = lst{};
string InstallPrefix = "@CMAKE_INSTALL_PREFIX@";
string INC_FLAGS = "@INC_FLAGS@";
......@@ -89,6 +96,7 @@ namespace HepLib {
const Symbol FC::nH("nH");;
exmap FC::SP_map;
exmap FC::Apart_SignMap;
map<ex,string,ex_is_less> Qgraf::LineTeX; // key is the filed
map<ex,string,ex_is_less> Qgraf::VerTeX; // key is the fileds in vertex
map<ex,string,ex_is_less> Qgraf::InOutTeX; // key is the id, id<0
......
......@@ -8,7 +8,7 @@
#include "FC.h"
/**
* @brief namespace for Index, Vector, DiracGamma, etc.
* @brief namespace for Index, Vector, DGamma, etc.
*/
namespace HepLib::Qgraf {
......
......@@ -268,11 +268,11 @@ namespace HepLib::Qgraf {
} else if(pis[i].has(q)) throw Error("LProj: Eps still has q.");
}
return LC(pis[0], pis[1], pis[2], pis[3]) * cc;
} else if(is_a<DiracGamma>(e)) {
} else if(is_a<DGamma>(e)) {
Index idx(prefix+to_string(++lproj));
auto g = ex_to<DiracGamma>(e);
auto g = ex_to<DGamma>(e);
if(!g.pi.is_equal(q)) throw Error("LProj: g.pi is NOT q.");
return DiracGamma(idx, g.rl) * SP(g.pi, idx);
return DGamma(idx, g.rl) * SP(g.pi, idx);
} else if (e.match(TR(w))) {
auto ret = self(e.op(0));
ret = mma_collect(ret, q, true);
......
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