[SciPy-Dev] Initializing error number in optimize zeros

Mark Alexander Mikofski mikofski at berkeley.edu
Thu Aug 30 14:53:53 EDT 2018


Hi,

I have a question about the scalar function root finders in optimize/Zeros
like brentq, etc, that are written in C, the error number is never
explicitly initialized, so it could be previously set to -2 or -1, which
could be misinterpreted as a failure.

Any reason not to set the error number to zero explicitly at the start of
the function?

I've created an issue to track this :

ENH: initialize params->error_num to zero in optimize/Zeros/*.c · Issue
#9189 · scipy/scipy
https://github.com/scipy/scipy/issues/9189

and implemented it in the cython_optimize_struct branch of my fork, eg
bisect.c:

https://github.com/mikofski/scipy/blob/cython_optimize_struct/scipy/optimize/Zeros/bisect.c#L13

Please, any comment?

Thanks!
Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20180830/0625a59b/attachment.html>


More information about the SciPy-Dev mailing list