Skip to content

Commit

Permalink
Add check for Power in processed expression
Browse files Browse the repository at this point in the history
  • Loading branch information
ianhinder committed Mar 19, 2014
1 parent befaebd commit 7a366eb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Tools/CodeGen/CodeGenKranc.m
Expand Up @@ -262,8 +262,14 @@

rhs = rhs //. mathematicaToCRules;

If[Cases[rhs, _Power, Infinity] =!= {},
ThrowError["Power found in "<>ToString[rhs,InputForm]]];

rhs = PostProcessExpression[$CodeGenTarget, rhs];

If[Cases[rhs, _Power, Infinity] =!= {},
ThrowError["Power found in "<>ToString[rhs,InputForm]]];

rhs = rhs //. {Parameter[xx_] -> xx};
rhs]];

Expand Down
4 changes: 4 additions & 0 deletions Tools/CodeGen/Vectorisation.m
Expand Up @@ -230,6 +230,10 @@
expr = expr /. {
x:(kmul|kadd)[a_,b_] /; !OrderedQ[x] :> Sort[x]};

If[Cases[expr, _Power, Infinity] =!= {},
ThrowError["Power found in " <> ToString[expr,InputForm]]];


Return[expr]]];

(* Code generation: The following functions are called when vectorising. *)
Expand Down

0 comments on commit 7a366eb

Please sign in to comment.