diff options
author | Ian Hinder <ian.hinder@aei.mpg.de> | 2011-06-10 02:36:51 +0200 |
---|---|---|
committer | Ian Hinder <ian.hinder@aei.mpg.de> | 2011-06-11 03:47:30 +0200 |
commit | d5a8f8cbd8ad0c5653b8dec56a9943363ebbf640 (patch) | |
tree | dfcd44d3b3856ad4fdde49521ea7b6612a35f94e /Tools | |
parent | 216385dbca32325749f88b9dd3cda85705d800a0 (diff) |
TensorTools.m: Fix handling of summations inside functions
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/CodeGen/TensorTools.m | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Tools/CodeGen/TensorTools.m b/Tools/CodeGen/TensorTools.m index 23e6617..c946b9a 100644 --- a/Tools/CodeGen/TensorTools.m +++ b/Tools/CodeGen/TensorTools.m @@ -540,8 +540,16 @@ makeSum[x_ == y_] := makeSum[x_ -> y_] := makeSum[x] -> makeSum[y]; -makeSum[x_] := - makeSumOverDummies[x, dummiesIn[x]]; +makeSum[f_[x___]] := + Module[{xs2}, + xs2 = Map[makeSum, {x}]; + Apply[f, xs2]]; + +makeSum[x_?nontensorialQ] := + x; + +makeSum[x_] := + Throw["Expression " <> ToString[x] <> " is not recognized, and tensor indices will not be expanded"]; sumComponentsOfDummyIndex[x_, i_] := Apply[Plus,listComponents[x, i, toggleIndex[i]]]; |