man, 22 03 2010 kl. 17:58 +0100, skrev Michael Creel:
> 
> On Mon, Mar 22, 2010 at 5:44 PM, Søren Hauberg <so...@hauberg.org> 
>
> 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.
> 
> Even in a case like this it would only bite if x were very close to 1.
> I think that the first check should be sufficient.

Yeah, that's a good point. I assume you fear the many checks will be a
performance problem. If this is indeed the case, then I guess it the
checks should be removed again. I added them as part of the debugging I
did.

>         BTW. why is this function implemented in C++? Does it provide
>         superior
>         speed compared to an m-file implementation?
> 
> It is essentially a double loop with a function evaluation inside.
> Normally, Octave is not great with loops. I'm pretty sure that this is
> the case here, but I wrote this so long ago that I don't remember the
> performance gain in going from .m to .oct.

Ok.

Søren



------------------------------------------------------------------------------
Download Intel&#174; 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