[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: standalone application (octave to c++): define anonymous function fo

From: Kai Torben Ohlhus
Subject: Re: standalone application (octave to c++): define anonymous function for nonlin_curvefit()
Date: Mon, 28 Jan 2019 11:58:30 +0100

On Mon, Jan 28, 2019 at 10:32 AM ola <address@hidden> wrote:
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?


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].



reply via email to

[Prev in Thread] Current Thread [Next in Thread]