Skip to content

Commit

Permalink
Ensure SARAH symbols are replaced in Which
Browse files Browse the repository at this point in the history
when searching for parameters in an expression
  • Loading branch information
Dylan Harries committed Jan 17, 2017
1 parent 8fb1ed6 commit 41fb896
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion meta/Parameters.m
Expand Up @@ -307,7 +307,7 @@
Cases[compactExpr, SARAH`Q[a_] /; MemberQ[parameters,SARAH`Q[a]] :> SARAH`Q[a], {0,Infinity}]
}]];
(* remove parameters found from compactExpr *)
compactExpr = compactExpr /. (RuleDelayed[#, CConversion`ToValidCSymbolString[#]]& /@ symbols);
compactExpr = compactExpr /. (RuleDelayed[#, Evaluate[CConversion`ToValidCSymbolString[#]]]& /@ symbols);
(* find all parameters without SARAH head in compactExpr *)
symbols = Join[symbols,
{ Cases[compactExpr, a_Symbol /; MemberQ[parameters,a], {0,Infinity}],
Expand Down
5 changes: 5 additions & 0 deletions test/test_Parameters.m
Expand Up @@ -147,6 +147,11 @@
Sort[{SARAH`B[Mu], SARAH`Q[WOp]}]
];

expr = Which[WOp > 1, Sqrt[B[Mu]]];

TestEquality[Sort[Parameters`FindAllParameters[expr]],
Sort[{B[Mu], WOp}]];

Print["testing GetType[] ..."];

TestEquality[Parameters`GetType[x],
Expand Down

0 comments on commit 41fb896

Please sign in to comment.