Re: [deal.II] Re: optimization, SolverBFGS

2019-10-28 Thread Juan Carlos Araujo Cabarcas
Thanks for the help, now it is running nicely! On Monday, 28 October 2019 15:05:19 UTC+1, Bruno Turcksin wrote: > > There is a small bug in the lambda: > > Le lun. 28 oct. 2019 à 09:36, Juan Carlos Araujo Cabarcas > > a écrit : > > auto my_lambda = [&polar](Vector a, Vectorb) { > >

Re: [deal.II] Re: optimization, SolverBFGS

2019-10-28 Thread Bruno Turcksin
There is a small bug in the lambda: Le lun. 28 oct. 2019 à 09:36, Juan Carlos Araujo Cabarcas a écrit : > auto my_lambda = [&polar](Vector a, Vectorb) { > return polar.objective_fun(a,b); > }; //polar.Callback (a,b);}; You want the vector to be passed by reference not

Re: [deal.II] Re: optimization, SolverBFGS

2019-10-28 Thread Juan Carlos Araujo Cabarcas
Hi, thanks! that worked by using polar.objective_fun(a,b), instead of Callback. Now, it seems that SolverBFGS is not starting, and terminates in the first function call! However, the optimization should not be done since |grad x| is not small. This is what I do: Vector X (N), Dx (N);

Re: [deal.II] Re: optimization, SolverBFGS

2019-10-28 Thread Bruno Turcksin
Here is a simple example: https://wandbox.org/permlink/fbcldo9PIiHl6tfI In your case, try something like auto my_lambda = [&polar](Vector a, Vectorb) {return polar.Callback(a,b);}; opt.solve ( my_lambda, X ); Bruno Le lun. 28 oct. 2019 à 06:30, Juan Carlos Araujo Cabarcas a écrit : > > Thanks

[deal.II] Re: optimization, SolverBFGS

2019-10-28 Thread Juan Carlos Araujo Cabarcas
Thanks Bruno for your prompt reply, I got the important part of the code compiling, however since I am new to this lambda (functional) functions, I do not know how to pass the new definitions to SolverBFGS. Looking at your suggestion I do the following: class Shape_compute { public:

[deal.II] Re: optimization, SolverBFGS

2019-10-25 Thread Bruno Turcksin
Juan, Take a look at https://stackoverflow.com/questions/17131768/how-to-directly-bind-a-member-function-to-an-stdfunction-in-visual-studio-11 I advise using a lambda like the second reply suggests Best, Bruno On Friday, October 25, 2019 at 10:53:08 AM UTC-4, Juan Carlos Araujo Cabarcas wr