-
Notifications
You must be signed in to change notification settings - Fork 25
Support dispatches on Number
via union type
#49
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
Merged
Merged
Changes from all commits
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
a491992
Define `AbstractQuantity <: Number`
MilesCranmer 69f3fd5
Remove defiitions for `Missing`
MilesCranmer a8f25f7
Create AbstractUnionQuantity for multiple abstract quantities
MilesCranmer 1410e05
Create GenericQuantity
MilesCranmer cd1dd2e
Update array to allow generic quantities
MilesCranmer 37cb7e6
Fix some method ambiguities
MilesCranmer b282ad1
Start separate file for ambiguities
MilesCranmer 66113e2
Fix ambiguity in AbstractDimensions + Quantity
MilesCranmer 670ab84
Fix ambiguity in powers
MilesCranmer 3e920f9
Fix ambiguity in constructors
MilesCranmer 7491a93
Fix ambiguity in getindex
MilesCranmer 613b2f0
Move other methods to ambiguities
MilesCranmer b735283
Rename to `disambiguities`
MilesCranmer 37289c8
Fix ambiguities in promotion rules
MilesCranmer d1414ea
Merge branch 'main' into union-type
gaurav-arya 810ed86
Export generic quantity
gaurav-arya 561ba11
Merge branch 'main' into union-type
MilesCranmer 679057c
Add docstrings for generic quantities
MilesCranmer 61b35bf
More types on missing
MilesCranmer 042d3eb
Prevent invalid dimension conversions
MilesCranmer d24d3ac
Remove old missing test
MilesCranmer 4e8b750
Fix string test for local version
MilesCranmer f38d630
Fix method hierarchy in constructors
MilesCranmer 913228b
Add GenericQuantity tests
MilesCranmer d68b041
Revert "Remove old missing test"
MilesCranmer 22d12d0
Fix rounding behavior
MilesCranmer ad2ed1c
Remove overkill promotion function
MilesCranmer cc519ea
Formatting
MilesCranmer 72addf4
Add missing promotion utility between symbolic and regular
MilesCranmer 6b1607c
Merge branch 'prevent-invalid-conversions' into union-type
MilesCranmer bca03f2
Make SymbolicDimensions conversion work for union type
MilesCranmer b6b3245
Test promotion with both symbolic/non and quantity/generic
MilesCranmer 0567e47
Remove unused constructors
MilesCranmer 1d85f85
Formatting
MilesCranmer 9ac4df0
More generic quantity tests
MilesCranmer b20998b
Add promotion rule for generic numbers
MilesCranmer c49c648
Add explicit promote_type tests
MilesCranmer 097cd31
Test conversion to `Vector{Any}`
MilesCranmer 3a73997
Merge branch 'main' into union-type
MilesCranmer f437e6e
Add docs for union quantity
MilesCranmer bc5a9f4
Add docs on `GenericQuantity`
MilesCranmer 21c9823
Clean up docs
MilesCranmer 8267824
Refactor + and - definitions
MilesCranmer 0c68bb9
More docs
MilesCranmer ddd4894
Add more examples
MilesCranmer 452d18c
Add projectile motion example
MilesCranmer c495b83
Split out projectile motion example
MilesCranmer a65d8ba
Add custom dimensions example
MilesCranmer 78b87ef
Fix documentation number
MilesCranmer aa60738
Expand unittest coverage
MilesCranmer 9ebd6bc
Example of custom quantity
MilesCranmer 5248189
Add example of `uconvert` on `GenericQuantity`
MilesCranmer f8b6e98
Improve cookie example
MilesCranmer 3bb9452
Refactor internal utilities
MilesCranmer ce9d527
Add compatibility for generic quantities in measurements
MilesCranmer d02b466
Add GenericQuantity to array tests
MilesCranmer 1f0b39d
More GenericQuantity tests
MilesCranmer 3faa4ee
Ensure convert(Number, q) is tested
MilesCranmer e9e7b8c
Apply suggestions from code review
MilesCranmer 697037a
Reformat tests
MilesCranmer 108aada
Refactor QuantityArray for GenericQuantity
MilesCranmer 46abb61
Fix documentation build
MilesCranmer 68ff3c1
Clean up quantity array docs
MilesCranmer cc28197
Update name to UnionAbstractQuantity
MilesCranmer a401e86
Update fieldname check from code review
MilesCranmer 2a1c7ad
Update internal_utils.jl
MilesCranmer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
module DynamicQuantitiesLinearAlgebraExt | ||
|
||
import LinearAlgebra: norm | ||
import DynamicQuantities: AbstractQuantity, ustrip, dimension, new_quantity | ||
import DynamicQuantities: UnionAbstractQuantity, ustrip, dimension, new_quantity | ||
|
||
norm(q::AbstractQuantity, p::Real=2) = new_quantity(typeof(q), norm(ustrip(q), p), dimension(q)) | ||
norm(q::UnionAbstractQuantity, p::Real=2) = new_quantity(typeof(q), norm(ustrip(q), p), dimension(q)) | ||
|
||
end |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.