From d5a8f8cbd8ad0c5653b8dec56a9943363ebbf640 Mon Sep 17 00:00:00 2001 From: Ian Hinder Date: Fri, 10 Jun 2011 02:36:51 +0200 Subject: TensorTools.m: Fix handling of summations inside functions --- Tools/CodeGen/TensorTools.m | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'Tools') 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]]]; -- cgit v1.2.3