Open
Conversation
added 2 commits
September 28, 2015 10:35
An initial commit of unumpy. I use the numpy.vectorize function to vectorize each of the umath functions so that they may be applied to numpy arrays. Note that, at the moment, the abs function is not included, as this conflicts with a python keyword. I’m sure there is a better way to handle this?
Added some extensions to operators to handle numpy arrays of UncertainFunction objects. If it is an instance of a numpy array, I vectorize a lambda function representing the operation with numpy.vectorize, and return the array with the operation applied. I use the to_uncertain_func to ensure they are UncertainFunction objects throughout the array. If you think this approach is sound, then the CONSTANT_TYPES should be expanded to include other numpy data types (ie. np.float32, np.float16, np.uint64, np.uint32, np.uint16, np.uint8, np.int64, np.int32, np.int16, np.int8)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Added a ‘unumpy’ component that simply vectorizes each of the functions in the existing umath file.
Added some extensions to operators to handle numpy arrays of
UncertainFunction objects. If it is an instance of a numpy array, I
vectorize a lambda function representing the operation with
numpy.vectorize, and return the array with the operation applied. I use
the to_uncertain_func to ensure they are UncertainFunction objects
throughout the array.
If you think this approach is sound, then the CONSTANT_TYPES should be
expanded to include other numpy data types (ie. np.float32, np.float16,
np.uint64, np.uint32, np.uint16, np.uint8, np.int64, np.int32,
np.int16, np.int8)