-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Form of callback in new Python binding #71
Comments
It's a matter of design, I decided to stay close to the Fortran callback, because it does not require additional allocations of ndarrays in the callback. There is no problem with creating a callback using |
We can of course add the possibility to pass-through |
I forgot to add a question label. I didn't want to imply we should (or should not) follow the SciPy conventions. It was more a matter of where/how do we draw a line between our bindings, and the established SciPy interface in a way that will ease maintenance and minimize the number of interface crossings. For example do we reject handling If I understand correctly, there are entire files in the SciPy MINPACK interface, such as https://github.com/scipy/scipy/blob/main/scipy/optimize/__minpack.h and https://github.com/scipy/scipy/blob/main/scipy/optimize/_minpackmodule.c, which would become obsolete if the bindings in this repository were to be used instead in the future. |
Adding |
That's an argument against handling I guess it depends on what is the role of the Python bindings. If it's just for SciPy, then I would let them handle it. But if we want the bindings also for other Python packages (who may want to stick with smaller and more specific dependencies than SciPy), then If we handle |
I think we want to have the Python bindings working for everyone. But SciPy is an important "customer", so we want to make sure they work great there as well. |
In the newly added Python bindings, the expected callback is of form
fcn(x, fvec) -> None
wherefvec
is an output vector, of the same size asx
, which is modified in-place. The full set of Python callback interfaces is defined here: python/minpack/typing.pyThe SciPy least-squares on the other hand, expects a callback with the following description:
Is the reason for the different interfaces since the present Fortran MINPACK interface cannot handle extra arguments?
Is the idea that the SciPy layer on top of the new Python binding, would nest a small adaptor function?
The text was updated successfully, but these errors were encountered: