## Re: [Vxl-users] Output values at each iteration of vnl_lbfgs

 Re: [Vxl-users] Output values at each iteration of vnl_lbfgs From: Ian Scott - 2009-01-30 09:50:08 ```David Doria wrote: > I know there is the trace function that will display gradient > information each iteration , but I would like to do something else > each iteration. I cannot put these operations in my f() function > because it gets called about 10 times per iteration (as I'm using > numerical derivatives). How can I output something every iteration? > Put a static local variable in your f function and output every 10 increments. double f(const vnl_vector &x) { { static count = 0; if (count++%10==0) vcl_cerr << "some logging info. "<< vcl_endl; } ... } Ian. ```

 [Vxl-users] Output values at each iteration of vnl_lbfgs From: David Doria - 2009-01-29 18:13:36 ```I know there is the trace function that will display gradient information each iteration , but I would like to do something else each iteration. I cannot put these operations in my f() function because it gets called about 10 times per iteration (as I'm using numerical derivatives). How can I output something every iteration? -- Thanks, David ```
 Re: [Vxl-users] Output values at each iteration of vnl_lbfgs From: Ian Scott - 2009-01-30 09:50:08 ```David Doria wrote: > I know there is the trace function that will display gradient > information each iteration , but I would like to do something else > each iteration. I cannot put these operations in my f() function > because it gets called about 10 times per iteration (as I'm using > numerical derivatives). How can I output something every iteration? > Put a static local variable in your f function and output every 10 increments. double f(const vnl_vector &x) { { static count = 0; if (count++%10==0) vcl_cerr << "some logging info. "<< vcl_endl; } ... } Ian. ```
 Re: [Vxl-users] Output values at each iteration of vnl_lbfgs From: David Doria - 2009-01-30 17:13:58 ```Ok good idea - then how do I get the current iteration? Then I can do something like this double f(const vnl_vector &x) { if (LastIter != CurrentIter() ) vcl_cerr << "some logging info. "<< vcl_endl; static LastIter = CurrentIter(); } Dave On Fri, Jan 30, 2009 at 4:50 AM, Ian Scott wrote: > David Doria wrote: >> >> I know there is the trace function that will display gradient >> information each iteration , but I would like to do something else >> each iteration. I cannot put these operations in my f() function >> because it gets called about 10 times per iteration (as I'm using >> numerical derivatives). How can I output something every iteration? >> > > Put a static local variable in your f function and output every 10 > increments. > > double f(const vnl_vector &x) > { > { > static count = 0; > if (count++%10==0) > vcl_cerr << "some logging info. "<< vcl_endl; > } > > ... > } > > Ian. > -- Thanks, David ```