py::vectorize with multiple outputs #5703
Unanswered
grzegorz-graczyk
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I was wondering what are the options of vectorizing function with multiple outputs. A good example, maybe missing in tests/examples could be just a divmod operation:
[](int a, int b) -> T { return { a / b, a % b }; }
. But it is probably much more common in practice when dealing with 2d or 3d coordinates.I know it is possible to have a custom type and bind it to a structured array. It works great, but the resulting Python code is a bit unusual - because structured arrays are not typically used for that.
What I am wondering is if there already is a way to use py::vectorize to get API that is more consistent with how this is typically done:
or
Beta Was this translation helpful? Give feedback.
All reactions