Skip to content

Commit

Permalink
Bugfix: extend IncreaseIndexLiterals[] function to nested functions
Browse files Browse the repository at this point in the history
The following example call of IncreaseIndexLiterals[] now works:

  In[]:= IncreaseIndexLiterals[Hpm[{2}][PL]]
  Out[]= Hpm[{3}][PL]

Thanks to Markus Bach.
  • Loading branch information
Alexander Voigt authored and Alexander Voigt committed Feb 16, 2017
1 parent 3827dba commit 2bb7259
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions meta/Parameters.m
Expand Up @@ -1344,12 +1344,11 @@
allOutputParameters]];

IncreaseIndexLiterals[expr_, num_Integer, heads_List] :=
Module[{indexedSymbols, rules, decrExpr, allHeads},
Module[{indexedSymbols, rules, allHeads},
allHeads = Join[heads /. FlexibleSUSY`M -> Identity, {SARAH`Delta, SARAH`ThetaStep}];
indexedSymbols = Cases[{expr}, s_[__] /; MemberQ[allHeads, s], Infinity];
indexedSymbols = Extract[{expr}, Position[{expr}, s_[__] /; MemberQ[allHeads, s], Infinity]];
rules = Rule[#, IncreaseIndices[#,num]] & /@ indexedSymbols;
decrExpr = expr /. rules;
Return[decrExpr]
expr /. rules
];

DecreaseIndexLiterals[expr_] :=
Expand Down

0 comments on commit 2bb7259

Please sign in to comment.