> Do you think it would be possible to develop your examples to the point where it's an easier tutorial for using LowlevelCallable? ==> TLDR: It depends.
It really depends on what you mean by "using LowlevelCallable" >From a "user" point of view, creating a LowLevelCallable given a cython >function is rather easy using scipy.LowLevelCallable.from_cython. On the other hand, dealing with the LowLevelCallable in your own code is a mess! Especially (like I did) if you want to somewhat abstract the return type of the function (for the purposes of integrating scalar and vector functions for instance). The code I came up with is much too verbose and cluttered to my liking. AND there is the issue that I raised a few months ago which attracted little attention. Cf https://github.com/scipy/scipy/issues/19148 Until this issue has been addressed, users won't be able to use LowLevelCallable without my dirty workaround anyways, so having a nice tutorial is counter productive. This being said, I would be thrilled to contribute with a nice tutorial once this roadblock has been lifted. > Personally I find it hard to follow the scipy repo example for using a LowlevelCallable from cython/c. The examples you present at https://github.com/gabrielfougeron/choreo/tree/main/choreo/scipy_plus/cython are slightly easier to follow, but could be made clearer still - it's taken me a while of glazing at the screen to start to follow things there. You're very kind although I build my code following what I could make out of the scipy code, so I find it hard to believe my version is any easier to read. To be fair, a few months after having written it I feel like I need a rosetta stone to get back into it. > I also didn't see an example (either yours or in scipy repo) for where the LowlevelCallable could return an array/memoryview ==> Indeed, I don't have any although I'm not sure I can remember the reason. I half remember that I wanted to (as much as possible) put the whole thing in a nogil block to be able to call the function on different arguments in parallel. Returning an array would have been a problem because creating an array (or a memoryview) requires the gil, although modifying it in place doesn't. _______________________________________________ SciPy-Dev mailing list -- scipy-dev@python.org To unsubscribe send an email to scipy-dev-le...@python.org https://mail.python.org/mailman3/lists/scipy-dev.python.org/ Member address: arch...@mail-archive.com