On Sun, Mar 21, 2010 at 6:42 PM, Søren Hauberg <[email protected]> wrote:
> søn, 21 03 2010 kl. 09:32 +0100, skrev Michael Creel:
>
>
> > I am interested in knowing what problem you found with numhessian.
>
> The main problem was the following line
>
> f_args(k); // resize only once
>
> which was used to resize the 'octave_value_list' used for inputs for the
> function being optimised. The idea in the above code is to touch the
> k'th element of 'f_args' such that it gets a certain size. However,
> since indexing is zero-based in C++, it is actually touching the k+1'th
> element. The number of input arguments to the function being optimised
> thus ended up being off by one, which resulted in an undefined default
> input argument.
>
Right, thanks. This never bit me, but it's good to have it fixed.
>
> I changed the above code into
>
> f_args.resize (k); // resize only once
>
> Besides this, I also added checks for ensuring that the function
> actually returns 'double's.
>
There are quite a few such checks. Don't you think that just the first would
be sufficient? If the function returns a double at x, it will pretty much
for sure return a double at x plus or minus a small delta. Maybe a check at
the end, making sure that 'derivative' is a matrix of doubles would be ok.
Cheers, M.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev