{"action":"created","issue":{"url":"https://api.github.com/repos/scipy/scipy/issues/9314","repository_url":"https://api.github.com/repos/scipy/scipy","labels_url":"https://api.github.com/repos/scipy/scipy/issues/9314/labels{/name}","comments_url":"https://api.github.com/repos/scipy/scipy/issues/9314/comments","events_url":"https://api.github.com/repos/scipy/scipy/issues/9314/events","html_url":"https://github.com/scipy/scipy/pull/9314","id":364280387,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE4NTA1ODI3","number":9314,"title":"ENH: WIP Add support for LowLevelCallable to optimize.zeros.brenth et al","user":{"login":"pvanmulbregt","id":23403152,"node_id":"MDQ6VXNlcjIzNDAzMTUy","avatar_url":"https://avatars0.githubusercontent.com/u/23403152?v=4","gravatar_id":"","url":"https://api.github.com/users/pvanmulbregt","html_url":"https://github.com/pvanmulbregt","followers_url":"https://api.github.com/users/pvanmulbregt/followers","following_url":"https://api.github.com/users/pvanmulbregt/following{/other_user}","gists_url":"https://api.github.com/users/pvanmulbregt/gists{/gist_id}","starred_url":"https://api.github.com/users/pvanmulbregt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pvanmulbregt/subscriptions","organizations_url":"https://api.github.com/users/pvanmulbregt/orgs","repos_url":"https://api.github.com/users/pvanmulbregt/repos","events_url":"https://api.github.com/users/pvanmulbregt/events{/privacy}","received_events_url":"https://api.github.com/users/pvanmulbregt/received_events","type":"User","site_admin":false},"labels":[{"id":37340735,"node_id":"MDU6TGFiZWwzNzM0MDczNQ==","url":"https://api.github.com/repos/scipy/scipy/labels/enhancement","name":"enhancement","color":"bfe5bf","default":true},{"id":37341011,"node_id":"MDU6TGFiZWwzNzM0MTAxMQ==","url":"https://api.github.com/repos/scipy/scipy/labels/scipy.optimize","name":"scipy.optimize","color":"207de5","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-09-27T02:25:28Z","updated_at":"2018-10-27T14:59:52Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/scipy/scipy/pulls/9314","html_url":"https://github.com/scipy/scipy/pull/9314","diff_url":"https://github.com/scipy/scipy/pull/9314.diff","patch_url":"https://github.com/scipy/scipy/pull/9314.patch"},"body":"Added support for the function passed to `optimize.zeros.{bisect|brenth|brentq|ridder}(func, a, b)` to be a `LowLevelCallable`.  This allows for speedups in root-finding by staying within C, and not jumping back and-forth between C and Python.\r\nIt is an alternate approach to that of gh-8431, which augments the C implementations of `brenth|brentq|ridder|bisect` with Cython versions in a sub package of `zeros` and allows the user to pass in Cython functions.\r\n\r\nTwo new files are added with Cython functions for testing purposes: `optimize/_tstutils_zerofuncs.pxy` and `optimize/_tstutils_zerofuncs.pxd`.\r\n\r\nSome caveats:\r\n* This PR does not extend support for `LowLevelCallables` to the `toms748` root finder --- that routine is currently written in Python and would require additional modifications.\r\n* This PR does not extend support for LowLevelCallables to the `newton` (or `secant`, `halley`) root finder(s) --- that routine is written in Python, and it supports both real and complex-valued functions, and would require additional modifications.\r\n\r\nSome cleanup along the way:\r\n* Separated the constant parts (`function`, `args` and `jmp_buf`) from the changeable parts (`funccalls`, `iterations`, `error_num`) of the `default_parameters` struct into two separate structs.\r\n* Removed an unneeded copy of the `jmp_buf` on the stack of `zeros.c:call_solver`.\r\n* Added `volatile` to the declaration of a variable needed after a `longjmp` returns.\r\n* Split some functionality in `_lib/src/ccallback.h` into multiple functions to enable reuse."},"comment":{"url":"https://api.github.com/repos/scipy/scipy/issues/comments/433627926","html_url":"https://github.com/scipy/scipy/pull/9314#issuecomment-433627926","issue_url":"https://api.github.com/repos/scipy/scipy/issues/9314","id":433627926,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMzYyNzkyNg==","user":{"login":"pvanmulbregt","id":23403152,"node_id":"MDQ6VXNlcjIzNDAzMTUy","avatar_url":"https://avatars0.githubusercontent.com/u/23403152?v=4","gravatar_id":"","url":"https://api.github.com/users/pvanmulbregt","html_url":"https://github.com/pvanmulbregt","followers_url":"https://api.github.com/users/pvanmulbregt/followers","following_url":"https://api.github.com/users/pvanmulbregt/following{/other_user}","gists_url":"https://api.github.com/users/pvanmulbregt/gists{/gist_id}","starred_url":"https://api.github.com/users/pvanmulbregt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pvanmulbregt/subscriptions","organizations_url":"https://api.github.com/users/pvanmulbregt/orgs","repos_url":"https://api.github.com/users/pvanmulbregt/repos","events_url":"https://api.github.com/users/pvanmulbregt/events{/privacy}","received_events_url":"https://api.github.com/users/pvanmulbregt/received_events","type":"User","site_admin":false},"created_at":"2018-10-27T14:59:52Z","updated_at":"2018-10-27T14:59:52Z","author_association":"CONTRIBUTOR","body":"@pv Some builds pass tests (all MSWindows; Linux Py3.4, 3.5 & 3.6).  Some builds fail with crashes (PyPy; Linux 2.7 & 3.7)  Of course all builds pass on my Mac (Anaconda py3.6 & 3.7).  \r\nI thought it might be due to the user_data, but the failures are crashes for even the simple function `xcubed_minus_2` which has no extra arguments.  Either all the `optimize.tests.test_zeros::TestLowLevelCallable` test cases pass, or all fail.  \r\nAny suggestions as to how to debug this?  What kinds of C/Cython operations might be candidates for problems across Pythons/platforms?\r\n"}}
{"actor":{"display_login":"pvanmulbregt"}}