man, 22 03 2010 kl. 10:21 +0100, skrev Michael Creel:

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

In 99.9% of the cases it will be just fine to only check once. The
potential problem is due bad user functions, such as

  function retval = myhessian (x)
    if (x > 0)
      retval = 1;
    else
      retval = [0, 1];
  endfunction

In such silly cases I guess you need the error checks. Perhaps it can be
done more efficiently than what I did, though.

BTW. why is this function implemented in C++? Does it provide superior
speed compared to an m-file implementation?

Søren



------------------------------------------------------------------------------
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
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to