Skip to content

Commit

Permalink
Improved Uncontract to work with tensors (using DataType FCTensor) th…
Browse files Browse the repository at this point in the history
…at are not defined in

the Global` context.
  • Loading branch information
Vladyslav Shtabovenko committed Jan 6, 2016
1 parent dc95bab commit 7deccf5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions FeynCalc/Lorentz/TensorFunction.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
at = Last[ef],
f = ef
];
DataType[ef,FCTensor]=True;

With[ {tf = f},
If [at=!="",
Which[
Expand Down
4 changes: 2 additions & 2 deletions FeynCalc/Lorentz/Uncontract.m
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@
Pair[Momentum[c,dimSelect[d]], li] Pair[Momentum[pe,dimSelect[d]],lidr[li]])/;MemberQ[par,pe]} /. times -> Times;

(* Uncontract tensor functions *)
If[ !FreeQ[nex, (tf_/;Context[tf]==="Global`")[___,Momentum[(q | Polarization[q,__]),___],___]],
nex = nex //. { (tf_/;Context[tf]==="Global`")[a___,Momentum[(c: q | Polarization[q,__]),d_:4],b___] :>
If[ !FreeQ[nex, (tf_/;DataType[tf,FCTensor])[___,Momentum[(q | Polarization[q,__]),___],___]],
nex = nex //. { (tf_/;DataType[tf,FCTensor])[a___,Momentum[(c: q | Polarization[q,__]),d_:4],b___] :>
(li = LorentzIndex[a$AL[inc = inc+1],dimSelect[d]];
tf[a, li, b] Pair[Momentum[c,dimSelect[d]],lidr[li]])}
];
Expand Down
3 changes: 3 additions & 0 deletions FeynCalc/Shared/DataType.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
PositiveNumber::usage = "PositiveNumber is a data type. E.g. \
DataType[Epsilon, PositiveNumber] = True (by default). ";

FCTensor::usage = "FCTensor is a data type. E.g. \
DataType[R, FCTensor] = True. ";

DataType::usage =
"DataType[exp, type] = True defines the object exp to have datatype type. \
DataType[exp1, exp2, ..., type] defines the objects exp1, exp2, ... to \
Expand Down

0 comments on commit 7deccf5

Please sign in to comment.