I am trying to fit data with a compiled function, however I receive error message, I don't understand why:
dat = Join[Table[{RandomReal[], RandomReal[]}, {i, 10}],
Table[{RandomReal[{1, 2}], RandomReal[{1, 2}]}, {i, 10}]];
kk = Compile[{{a, _Real}, {b, _Real}, {x, _Real}}, a + b x]
NonlinearModelFit[data, kk[a, b, x], {a, b}, x]
CompiledFunction::cfsa: Argument a at position 1 should be a machine-size real number. >>
Any ideas how to fix it? Thanks!