7#include "flint/ulong_extras.h"
36 GINAC_IMPLEMENT_PRINT_CONTEXT(FormFormat, print_dflt)
57 c <<
"((" << p.op(0) <<
")*(" << p.op(0) <<
"))";
59 c <<
"((" << p.op(0) <<
")^(" << p.op(1) <<
"))";
68 GINAC_IMPLEMENT_PRINT_CONTEXT(FCFormat, print_dflt)
91 for(
int r=0; r<nr; r++) {
93 for(
int c=0; c<nc; c++) {
94 mat(r,c).print(*
this);
107 if (i==vend) { s <<
"{}";
return *
this; }
122 if (i==send) { s <<
"{}";
return *
this; }
137 if (i==mend) { s <<
"{}";
return *
this; }
140 i->first.print(*
this);
142 i->second.print(*
this);
152 class ncmul_hack :
public ncmul {
154 ncmul_hack(ncmul _nm) : ncmul(_nm){ }
155 void print(
const FCFormat & c,
unsigned level) {
156 printseq(c,
'(',
'.',
')', precedence(), level);
159 ex mat_conj(
const ex & e1,
const ex & e2,
const ex & e3) {
160 return GMat(e1.conjugate(), e3, e2);
164 ncmul_hack(nm).print(c, level);
182 if(!is_a<Index>(other))
throw Error(
"Index::compare_same_type");
183 const Index &o =
static_cast<const Index &
>(other);
184 auto ret =
name.get_name().compare(o.
name.get_name());
186 else if(ret<0)
return -1;
191 if(!is_a<Index>(other))
throw Error(
"Index::is_equal_same_type");
192 const Index &o =
static_cast<const Index &
>(other);
193 return (
name.get_name() == o.
name.get_name());
201 return Pair(*
this, i);
205 return Pair(p, *
this);
209 inherited::archive(n);
210 n.add_string(
"name",
name.get_name());
211 n.add_unsigned(
"type",
type);
215 inherited::read_archive(n);
218 n.find_string(
"name", nstr);
220 n.find_unsigned(
"type", t);
229 for(const_preorder_iterator i = e.preorder_begin(); i != e.preorder_end(); ++i)
230 if(is_a<Index>(*i) && ex_to<Index>(*i).type!=
Index::Type::VD)
return true;
235 for(const_preorder_iterator i = e.preorder_begin(); i != e.preorder_end(); ++i)
236 if(is_a<Index>(*i) && ex_to<Index>(*i).type==
Index::Type::VD)
return true;
255 if(!is_a<Vector>(other))
throw Error(
"Vector::compare_same_type");
257 auto ret =
name.get_name().compare(o.
name.get_name());
259 else if(ret<0)
return -1;
264 if(!is_a<Vector>(other))
throw Error(
"Vector::is_equal_same_type");
266 return (
name.get_name() == o.
name.get_name());
274 return Pair(*
this, p);
278 return Pair(*
this, i);
282 inherited::archive(n);
283 n.add_string(
"name",
name.get_name());
287 inherited::read_archive(n);
290 n.find_string(
"name", nstr);
310 if(!is_a<SUNT>(other))
throw Error(
"SUNT::compare_same_type");
311 const SUNT &o =
static_cast<const SUNT &
>(other);
312 for(
int i=0; i<3; i++) {
313 auto c =
aij[i].compare(o.
aij[i]);
320 if(!is_a<SUNT>(other))
throw Error(
"SUNT::is_equal_same_type");
321 const SUNT &o =
static_cast<const SUNT &
>(other);
322 for(
int i=0; i<3; i++) {
323 if(!
aij[i].is_equal(o.
aij[i]))
return false;
329 if(is_a<lst>(
aij[0])) {
331 for(
auto item :
aij[0]) {
332 if(first) { first=
false; c <<
"T(" << item; }
333 else c <<
"," << item;
335 }
else c <<
"T(" <<
aij[0];
336 c <<
"," <<
aij[1] <<
"," <<
aij[2] <<
")";
340 c <<
"SUNTF[" <<
aij[0] <<
"," <<
aij[1] <<
"," <<
aij[2] <<
"]";
344 c.s <<
"T(" <<
aij[0] <<
"," <<
aij[1] <<
"," <<
aij[2] <<
")";
352 ensure_if_modifiable();
357 inherited::archive(n);
358 n.add_ex(
"a",
aij[0]);
359 n.add_ex(
"i",
aij[1]);
360 n.add_ex(
"j",
aij[2]);
364 inherited::read_archive(n);
367 aij[0] = ex_to<Index>(o);
369 aij[1] = ex_to<Index>(o);
371 aij[2] = ex_to<Index>(o);
380 lst argv = ex_to<lst>(
aij[0]);
382 for(
auto it=argv.rbegin(); it!=argv.rend(); ++it)
as.append(*it);
398 if(!is_a<SUNF>(other))
throw Error(
"SUNF::compare_same_type");
399 const SUNF &o =
static_cast<const SUNF &
>(other);
400 for(
int i=0; i<3; i++) {
401 auto c =
ijk[i].compare(o.
ijk[i]);
408 if(!is_a<SUNF>(other))
throw Error(
"SUNF::is_equal_same_type");
409 const SUNF &o =
static_cast<const SUNF &
>(other);
410 for(
int i=0; i<3; i++) {
411 if(!
ijk[i].is_equal(o.
ijk[i]))
return false;
417 if(flags & status_flags::evaluated)
return *
this;
418 if(
ijk[0].is_equal(
ijk[1]) ||
ijk[1].is_equal(
ijk[2]) ||
ijk[0].is_equal(
ijk[2]))
return 0;
421 if(c01 && c12)
return this->hold();
428 else return this->hold();
432 c.s <<
"f(" <<
ijk[0] <<
"," <<
ijk[1] <<
"," <<
ijk[2] <<
")";
436 c <<
"f(" <<
ijk[0] <<
"," <<
ijk[1] <<
"," <<
ijk[2] <<
")";
440 c <<
"SUNF[" <<
ijk[0] <<
"," <<
ijk[1] <<
"," <<
ijk[2] <<
"]";
448 ensure_if_modifiable();
453 inherited::archive(n);
454 n.add_ex(
"i",
ijk[0]);
455 n.add_ex(
"j",
ijk[1]);
456 n.add_ex(
"k",
ijk[2]);
460 inherited::read_archive(n);
463 ijk[0] = ex_to<Index>(o);
465 ijk[1] = ex_to<Index>(o);
467 ijk[2] = ex_to<Index>(o);
491 if(!is_a<SUNF4>(other))
throw Error(
"SUNF4::compare_same_type");
492 const SUNF4 &o =
static_cast<const SUNF4 &
>(other);
493 for(
int i=0; i<4; i++) {
494 auto c =
ijkl[i].compare(o.
ijkl[i]);
501 if(!is_a<SUNF4>(other))
throw Error(
"SUNF4::is_equal_same_type");
502 const SUNF4 &o =
static_cast<const SUNF4 &
>(other);
503 for(
int i=0; i<4; i++) {
504 if(!
ijkl[i].is_equal(o.
ijkl[i]))
return false;
514 if(flags & status_flags::evaluated)
return *
this;
518 if(c01 && c23)
return this->hold();
522 else return this->hold();
531 c.s <<
"f(" <<
ijkl[0] <<
"," <<
ijkl[1] <<
"," <<
ijkl[2] <<
"," <<
ijkl[3] <<
")";
535 c <<
"SUNF[" <<
ijkl[0] <<
"," <<
ijkl[1] <<
"," <<
ijkl[2] <<
"," <<
ijkl[3] <<
"]";
544 c <<
"f4(" <<
ijkl[0] <<
"," <<
ijkl[1] <<
"," <<
ijkl[2] <<
"," <<
ijkl[3] <<
")";
552 ensure_if_modifiable();
561 inherited::archive(n);
562 n.add_ex(
"i",
ijkl[0]);
563 n.add_ex(
"j",
ijkl[1]);
564 n.add_ex(
"k",
ijkl[2]);
565 n.add_ex(
"l",
ijkl[3]);
573 inherited::read_archive(n);
576 ijkl[0] = ex_to<Index>(o);
578 ijkl[1] = ex_to<Index>(o);
580 ijkl[2] = ex_to<Index>(o);
582 ijkl[3] = ex_to<Index>(o);
600 }
else if(is_a<mul>(e) || is_a<ncmul>(e)) {
604 if(!is_a<add>(rei)) rei = lst{ rei };
607 for(
auto oi : ores)
for(
auto ri : rei) res.append(oi * ri);
610 for(
auto ri : res) ret += ri;
612 }
else return e.map(self);
614 return inner_expand(expr);
623 if(!expr_in.has(GMat(
w1,
w2,
w3)))
return expr_in;
628 for(
auto cv : cv_lst) {
630 if(is_zero(e-1) || e.match(GMat(
w1,
w2,
w3))) {
631 if(e.match(GMat(
w1,
w2,
w2))) expr += cv.op(0) * TR(e.op(0));
632 else expr += cv.op(0) * e;
634 }
else if(!is_a<mul>(e))
throw Error(
"GMatContract: collect error: " +
ex2str(e));
637 for(
auto item : e) mats.append(item);
639 std::map<ex,int,ex_is_less> to_map, from_map;
642 for(
int i=0; i<mats.nops(); i++) {
643 auto item = mats.op(i);
644 if(item.op(0).return_type()==return_types::commutative || item.op(0).is_equal(
GAS(1))) {
645 mats_idx.append(lst{item,i});
647 if(to_map[item.op(1)]!=0 || from_map[item.op(2)]!=0)
throw Error(
"GMatContract: index conflict for "+
ex2str(item));
648 to_map[item.op(1)] = i+10;
649 from_map[item.op(2)] = i+10;
655 bool checked =
false;
659 for(
int i=0; i<mats_idx.nops(); i++) {
660 auto item = mats_idx.op(i).op(0);
661 int ii = ex_to<numeric>(mats_idx.op(i).op(1)).to_int();
663 to_map[item.op(1)]==0 && from_map[item.op(2)]==0 &&
664 to_map[item.op(2)]==0 && from_map[item.op(1)]==0) {
665 mats_idx2.append(mats_idx.op(i));
670 if(to_map[item.op(1)]==0 && from_map[item.op(2)]==0) {
671 to_map[item.op(1)] = ii+10;
672 from_map[item.op(2)] = ii+10;
673 }
else if(to_map[item.op(2)]==0 && from_map[item.op(1)]==0) {
674 to_map[item.op(2)] = ii+10;
675 from_map[item.op(1)] = ii+10;
677 auto li =
get_op(mats, ii, 1);
678 auto ri =
get_op(mats, ii, 2);
682 throw Error(
"GMatContract: index conflict (2).");
685 if(mats_idx2.nops()<1)
break;
686 mats_idx = mats_idx2;
691 while(todo.size()>0) {
692 int c = *(todo.begin());
694 ex curMat = mats.op(c).op(0);
695 auto li=mats.op(c).op(1);
696 auto ri=mats.op(c).op(2);
698 if(li.is_equal(ri)) {
699 retMat *= TR(curMat);
703 int fi = from_map[li];
705 retMat *= GMat(curMat, li, ri);
709 auto mat = mats.op(ti-10).op(0);
710 if(curMat.is_equal(
GAS(1))) curMat = mat;
711 else if(!mat.is_equal(
GAS(1))) curMat = curMat * mat;
712 ri = mats.op(ti-10).op(2);
717 auto mat = mats.op(fi-10).op(0);
718 if(curMat.is_equal(
GAS(1))) curMat = mat;
719 else if(!mat.is_equal(
GAS(1))) curMat = mat * curMat;
720 li = mats.op(fi-10).op(1);
726 expr += cv.op(0) * retMat;
736 else if(is_a<Pair>(e)) {
737 if(is_a<Index>(e.op(0)) || is_a<Index>(e.op(1))) idx_lst.append(e);
739 }
else return e.map(self);
744 if(idx_lst.nops()==0)
return ei;
749 auto v =
form(cv.op(1));
752 if(!is_a<mul>(v)) v = lst{ v };
756 if(!is_a<Pair>(vi)) r *= vi;
757 else if(is_a<Index>(vi.op(1)) && c.has(vi.op(1))) repl[vi.op(1)] = vi.op(0);
758 else if(is_a<Index>(vi.op(0)) && c.has(vi.op(0))) repl[vi.op(0)] = vi.op(1);
761 res += r * c.subs(repl);
769 if(!e.has(GMat(
w1,
w2,
w3)))
return e;
770 else if(e.match(GMat(
w1,
w2,
w3))) {
774 for(
auto item : e0) res +=
GMatExpand(GMat(item, e.op(1), e.op(2)));
776 }
else if(is_a<mul>(e0)) {
778 for(
auto item : e0) {
779 if(item.return_type()==return_types::commutative) c *= item;
782 cout <<
"c=" << c <<
", " <<
"v=" << v << endl;
783 throw Error(
"GMatExpand: v != 1");
788 if(v.is_equal(1)) v =
GAS(1);
789 return c *
GMatExpand(GMat(v, e.op(1), e.op(2)));
790 }
else if(is_a<ncmul>(e0)) {
793 for(
auto item : e0) {
800 if(!is_a<add>(ncL)) ncL = lst{ ncL };
802 if(!is_a<add>(ncR)) ncR = lst{ ncR };
804 for(
auto iL : ncL)
for(
auto iR : ncR) res += iL * iR;
808 if(!is_a<add>(rs)) rs = lst{ rs };
809 for(
auto item : rs) {
811 if(is_a<mul>(item)) {
812 if(item.nops()==1)
throw Error(
"GMatExpand: item.nops == 1");
813 for(
auto it : item) {
814 if(it.return_type()==return_types::commutative) c *= it;
816 if(!v.is_equal(1))
throw Error(
"GMatExpand: v != 1");
832 if(last==vi && is_a<DGamma>(vi)) {
835 if(is_a<Vector>(vi.op(0))) c *=
SP(vi.op(0));
836 else if(is_a<Index>(vi.op(0))) c *=
d;
837 else if(vi.op(0).is_equal(1) || vi.op(0).is_equal(5)) c *= 1;
838 else throw Error(
"GMatExpand: only GAS(i/p/1/5) supported.");
841 if(last!=
GAS(1) && !last.is_equal(1)) vv = vv * last;
846 if(!last.is_equal(1) && last!=
GAS(1)) v = vv * last;
851 if(v.is_equal(1)) v =
GAS(1);
852 res += c * GMat(v, e.op(1), e.op(2));
856 }
else return e.map(self);
858 return inner_expand(expr_in);
861 ex
GMatShift(
const ex & expr,
const ex & g,
bool to_right) {
862 if(!expr.has(g))
return expr;
864 if(!e.has(g) || !e.has(GMat(
w1,
w2,
w3)))
return e;
865 else if(e.match(GMat(
w1,
w2,
w3))) {
867 if(!is_a<ncmul>(eg)) eg = lst{ eg };
870 for(
int i=0; i<eg.nops()-1; i++)
if(eg.op(i)==g) { gi = i; break; }
871 if(gi==-1 || gi==eg.nops()-1)
return e;
873 for(
int i=eg.nops()-1; i>=0; i--)
if(eg.op(i)==g) { gi = i;
break; }
874 if(gi==-1 || gi==0)
return e;
876 int gj = gi + ( to_right ? 1 : -1 );
877 ex rem = 1, rem2 = 1;
878 for(
int i=0; i<eg.nops(); i++) {
884 if(to_right) rem2 *= eg.op(gj)*eg.op(gi);
885 else rem2 *= eg.op(gi)*eg.op(gj);
888 if(eg.op(gi).is_equal(eg.op(gj))) {
889 ex ip = eg.op(gi).op(0);
890 if(rem.is_equal(1)) rem =
GAS(1);
891 ex res = GMat(rem, e.op(1), e.op(2));
894 if(is_a<Vector>(ip)) c =
SP(ip);
895 else if(is_a<Index>(ip)) c =
d;
896 else throw Error(
"GMatShift: only GAS(i/p) supproted.");
899 if(rem.is_equal(1)) rem =
GAS(1);
900 if(rem2.is_equal(1)) rem2 =
GAS(1);
901 ex res = 2*
SP(eg.op(gi).op(0), eg.op(gj).op(0)) * GMat(rem, e.op(1), e.op(2));
902 res = res - GMat(rem2, e.op(1), e.op(2));
904 }
else return e.map(self);
908 res = inner_shift(res);
920 lst shift_12_right(
const ex & e) {
921 if(!is_a<ncmul>(e))
throw Error(
"input is not a ncmul.");
924 if(e.op(0)!=e.op(1))
throw Error(
"2 items are not equal!");
925 else if(is_a<Index>(e0.op(0)))
return lst{ lst{
d, 1 }};
926 else if(is_a<Vector>(e0.op(0)))
return lst{ lst{
SP(e.op(0).op(0)), 1 }};
928 cout << endl << e << endl;
929 throw Error(
"shift_12_right: only GAS(i/p) supproted.");
934 for(
int i=2; i<n; i++) rem *= e.op(i);
935 lst res = shift_12_right(e.op(0)*rem);
937 for(
int i=0; i<n; i++) {
938 res.let_op(i).let_op(0) = -res.op(i).op(0);
939 res.let_op(i).let_op(1) = e.op(1) * res.op(i).op(1);
941 if(!is_a<Index>(e.op(0).op(0)) && !is_a<Vector>(e.op(0).op(0))) {
943 throw Error(
"shift_12_right: not a Vector or Index");
945 if(!is_a<Index>(e.op(1).op(0)) && !is_a<Vector>(e.op(1).op(0))) {
947 throw Error(
"shift_12_right: not a Vector or Index");
949 res.append(lst{ 2*
SP(e.op(0).op(0), e.op(1).op(0)), rem });
955 if(!e.has(GMat(
w1,
w2,
w3)))
return e;
956 else if(e.match(GMat(
w1,
w2,
w3))) {
958 if(!is_a<ncmul>(eg)) eg = lst{ eg };
960 int gi = -1, gj = -1;
961 for(
int i=0; i<eg.nops(); i++)
for(
int j=i+1; j<eg.nops(); j++) {
962 if(eg.op(i).is_equal(eg.op(j))) {
971 ex exL = 1, exM=1, exR = 1;
972 for(
int i=0; i<eg.nops(); i++) {
973 if(i<gi) exL *= eg.op(i);
974 else if(i>gj) exR *= eg.op(i);
975 else exM *= eg.op(i);
977 lst cvs = shift_12_right(exM);
981 ex item = exL*cv.op(1)*exR;
982 if(item.is_equal(1)) item =
GAS(1);
983 res += cv.op(0)*
GMatShift(GMat(item, e.op(1), e.op(2)));
987 }
else return e.map(self);
991 res = inner_shift(res);
996 void GMat_fc_print(
const ex &arg1,
const ex &arg2,
const ex &arg3,
const print_context &c0) {
997 auto c =
static_cast<const FCFormat &
>(c0);
998 c <<
"GMat[" << arg1 <<
"," << arg2 <<
"," << arg3 <<
"]";
1002 REGISTER_FUNCTION(GMat, do_not_evalf_params().print_func<FCFormat>(&GMat_fc_print).conjugate_func(mat_conj).set_return_type(return_types::commutative))
1004 bool IsZero(
const ex & e) {
1007 for(const_preorder_iterator i = e.preorder_begin(); i != e.preorder_end(); ++i) {
1008 if(is_a<symbol>(*i) || is_a<Pair>(*i))
vs.insert(*i);
1012 for(
int i=0; i<5; i++) {
1014 for(
auto item :
vs) {
1015 nsubs[item] = ex(1)/n_nth_prime(n);
1018 ex ret = e.subs(nsubs);
1019 if(!normal(e).is_zero())
return false;
1023 return ret.is_zero();
1035 for(
auto cv : cvs) {
1036 int degTF = cv.op(1).degree(
TF);
1037 int degNF = cv.op(1).ldegree(
NF);
1038 if(degTF>0 && degNF<0) {
1041 if(degTF+degNF>0) n = -degNF;
1042 res += cv.op(0) * cv.op(1) * pow(
TF/
NF,-n) * pow(
TF*
NF-
CF,n);
1043 }
else if(degTF>0 && degNF>1) {
1046 if(degTF>degNF/2) n = degNF/2;
1047 res += cv.op(0) * cv.op(1) * pow(
TF*
NF*
NF,-n) * pow(
CF*
NF+
TF,n);
1048 }
else res += cv.op(0) * cv.op(1);
1056 if(!e.has(
CA))
return e;
1057 else if(e.match(pow(
CA,
w)) && e.op(1).info(info_flags::negint))
return pow(
CA-2*
CF,-e.op(1));
1058 else return e.map(self);
1060 return ca_map(expr);
1067 res = res.subs(
NF==
CA);
1093 if(!is_a<mul>(res)) res = lst{ res };
1095 for(
auto item : res) {
1096 if(item.has(
NF)) c *= item;
1100 int deg = c.degree(
NF);
1101 int ldeg = -c.ldegree(
NF);
1102 if(ldeg>deg) deg = ldeg;
1106 for(
int i=0; i<=deg; i++) {
1108 eqn -= xi * pow(
NF,i) * pow((
NF*
NF-1)/(2*
NF), deg-i);
1112 int nH = eqn.degree(
NF);
1113 int nL = eqn.ldegree(
NF);
1115 for(
int i=
nL; i<=
nH; i++) {
1116 ex cc = eqn.coeff(
NF, i);
1117 if(cc.is_zero())
continue;
1120 auto sol = lsolve(eqns, vars);
1121 if(sol.nops()!=deg+1) {
1122 cout <<
"c=" << c << endl;
1123 cout <<
"sol=" << sol << endl;
1124 throw Error(
"HomCACF: no solution found!");
1127 for(
int i=0; i<=deg; i++) c += vars.op(i).subs(sol) * pow(
CA,i) * pow(
CF, deg-i);
1132 ex
DoColor(
const ex & expr,
const ex & pref,
int method) {
1135 for(
auto const & cv : cvs) {
#define IMPLEMENT_HAS(classname)
#define DEFAULT_CTOR(classname)
#define IMPLEMENT_ALL(classname)
static bool has(const ex &e)
class used to wrap error message
int compare_same_type(const GiNaC::basic &other) const override
const char * class_name() const override
static bool hasv(const ex &e)
void archive(archive_node &n) const override
bool is_equal_same_type(const basic &other) const override
static GiNaC::registered_class_info & get_class_info_static()
void print(const print_context &c, unsigned level=0) const
void read_archive(const archive_node &n) override
static bool hasc(const ex &e)
ex derivative(const symbol &s) const override
const GiNaC::registered_class_info & get_class_info() const override
Pair operator()(const Index &i)
void accept(GiNaC::visitor &v) const override
Index * duplicate() const override
static bool has(const ex &e)
class to wrap map_function of GiNaC
static bool has(const ex &e)
void archive(archive_node &n) const override
save to archvie
static GiNaC::registered_class_info & get_class_info_static()
void form_print(const FormFormat &c, unsigned level=0) const
print the Form Format
void accept(GiNaC::visitor &v) const override
const GiNaC::registered_class_info & get_class_info() const override
size_t nops() const override
void fc_print(const FCFormat &c, unsigned level=0) const
void print(const print_dflt &c, unsigned level=0) const
normal priint
ex op(size_t i) const override
ex & let_op(size_t i) override
SUNF4 * duplicate() const override
ex eval() const override
automatical evaluation of SUNF4
ex derivative(const symbol &s) const override
set derivative of SUNF4 to 0
bool is_equal_same_type(const basic &other) const override
const char * class_name() const override
void read_archive(const archive_node &n) override
read from archive
int compare_same_type(const GiNaC::basic &other) const override
void archive(archive_node &n) const override
void print(const print_dflt &c, unsigned level=0) const
const char * class_name() const override
int compare_same_type(const GiNaC::basic &other) const override
ex derivative(const symbol &s) const override
set derivative of SUNF to 0
bool is_equal_same_type(const basic &other) const override
void form_print(const FormFormat &c, unsigned level=0) const
static GiNaC::registered_class_info & get_class_info_static()
ex & let_op(size_t i) override
SUNF * duplicate() const override
const GiNaC::registered_class_info & get_class_info() const override
void read_archive(const archive_node &n) override
size_t nops() const override
void accept(GiNaC::visitor &v) const override
void fc_print(const FCFormat &c, unsigned level=0) const
ex op(size_t i) const override
static GiNaC::registered_class_info & get_class_info_static()
bool is_equal_same_type(const basic &other) const override
ex & let_op(size_t i) override
void archive(archive_node &n) const override
size_t nops() const override
void form_print(const FormFormat &c, unsigned level=0) const
ex op(size_t i) const override
const GiNaC::registered_class_info & get_class_info() const override
void fc_print(const FCFormat &c, unsigned level=0) const
void print(const print_dflt &c, unsigned level=0) const
int compare_same_type(const GiNaC::basic &other) const override
void read_archive(const archive_node &n) override
SUNT * duplicate() const override
const char * class_name() const override
void accept(GiNaC::visitor &v) const override
ex derivative(const symbol &s) const override
ex conjugate() const override
class extended to GiNaC symbol class, represent a positive symbol
Vector * duplicate() const override
bool is_equal_same_type(const basic &other) const override
Pair operator()(const Vector &p)
const char * class_name() const override
ex derivative(const symbol &s) const override
void print(const print_context &c, unsigned level=0) const
static GiNaC::registered_class_info & get_class_info_static()
int compare_same_type(const GiNaC::basic &other) const override
void read_archive(const archive_node &n) override
void accept(GiNaC::visitor &v) const override
void archive(archive_node &n) const override
const GiNaC::registered_class_info & get_class_info() const override
ex exfactor(const ex &expr_in, int opt)
factorize a expression
bool ex_less(const ex &a, const ex &b)
ex DoColor(const ex &expr, const ex &pref, int method)
void let_op(ex &ex_in, int index1, int index2, const ex item)
update index1-th.index2-th of expression with item
ex GMatShift(const ex &expr, const ex &g, bool to_right)
ex collect_ex(ex const &expr_in, std::function< bool(const ex &)> has_func, int opt)
the collect function like Mathematica
ex GMatSimplify(const ex &expr)
ex GAS(const ex &expr, unsigned rl)
function similar to GAD/GSD in FeynClac
ex GMatExpand(const ex &expr_in)
ex Contract(const ex &ei)
ex get_op(const ex ex_in, int index1, int index2)
return index1-th.index2-th of expression
ex exnormal(const ex &expr, int opt)
normalize a expression
lst collect_lst(ex const &expr_in, std::function< bool(const ex &)> has_func, int opt)
the collect function like Mathematica, reture the lst { {c1,v1}, {c2,v2}, ... }
string ex2str(const ex &expr)
convert ex to output string, the defalut printer format will be used
ex ncmul_expand(const ex &expr)
REGISTER_FUNCTION(GMat, do_not_evalf_params().print_func< FCFormat >(&GMat_fc_print).conjugate_func(mat_conj).set_return_type(return_types::commutative)) bool IsZero(const ex &e)
ex form(const ex &iexpr, int verb)
evalulate expr in form program, see also the form_trace_mode and form_expand_mode
ex GMatContract(const ex &expr_in)
make contract on matrix, i.e., GMat(a,i1,i2)*GMat(b,i2,i3) -> GMat(a*b,i1,i3)
ex SP(const ex &a, bool use_map=false)
ex ca_neg_pow_sub(const ex &expr)