Currently I try to use nonlin_curvefit() from octave optim package in my
standalone c++ code.
Unfortunatelly, I can't find any information how to declare octave-type
anonymous function in standalone application to prepare my model function.
Directly in octave I can do f = @(p,x)1-exp(p(1)*x), but in c++ I need to
declare a type of f; here function or octave::function doesn't work.
I can only use the feval to call nonlin_curvefit, and I don't know how put
there my model function, f:
octave_value_list result = octave::feval("nonlin_curvefit", ovl("@(p,x)
1-exp(p(1)*x)", init, t_points, y_val, opt(0)), 4); # also doesn't work
Could you help me?
-----
ola
Maybe this is not a very trivial task. Anonymous function creation looks deeply connected to the parser. The "octave_value" class that manages anonymous functions is "octave_user_function" [1]. Perhaps you can get something working when looking at how Octave creates those functions while parsing [2].
Best,
Kai