Here is a minimal example to the problem I face when using Compile
with Block
:
G1[x_, y_]:=Block[{ks = x y, id = Sin[x y]}, {(id - ks), (id + ks)}]
myFun = Compile[{{x, _Real}, {y, _Real}},Block[{f = G1[x, y]}, f[[1]] x + f[[2]]],
CompilationTarget -> "C"];
Once I run this code I get this error:
Compile::part: Part specification f[[1]] cannot be compiled since the argument is not a tensor of sufficient rank. Evaluation will use the uncompiled function.
How can I get rid of it?