Refactor some functions to support batch invocation on numpy arrays #55
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit provides vectorized implementations for the following functions:
affines.compose
affines.decompose44
euler.euler2mat
euler.mat2euler
I tried to keep the code as close as possible to the current implementation, using idiomatic Numpy code to handle scalars and batches in a single code path. The functions accept inputs with an arbitrary number of batch dimensions in front of the expected input shape. Functions that expect a (3, 3) matrix, for example, will accept arrays with shape (..., 3, 3).
I propose to discuss any changes to bring these to a mergeable state, then same approach can be used to vectorize other functions in the library.
The changes should be backwards compatible and entirely transparent for existing users. Existing tests all pass, let me know if you had something specific in mind on additional tests for this functionality in #14.