-
Notifications
You must be signed in to change notification settings - Fork 25
Additional QuantityArray constructions
#178
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
Changes from 9 commits
392701a
2feea5c
b84257e
2c27270
f1b4706
5a59406
2e72c26
f08023b
c15675f
12b20d2
096ca12
52a54fd
8b00bb0
1e6b410
0c8b97a
b27ec64
4c88d04
87e8b1f
046b8d4
0d3fcd8
3b185a9
227ece9
51270a2
768972b
cdfce08
42d62b4
e110662
8f34f3b
7869b73
3c97dab
017d5d4
97ec277
7ae45ef
c475043
7dab92a
01b9e5e
22767a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -265,6 +265,7 @@ end | |||||||||
| end | ||||||||||
|
|
||||||||||
| @testset "Arrays" begin | ||||||||||
| T_QA_GenericQuantity(T, N) = QuantityArray{T, N, D, Q, V} where {T, D<:Dimensions, Q<:UnionAbstractQuantity, V<:AbstractArray{T, N}} | ||||||||||
| for T in [Float16, Float32, Float64], R in [Rational{Int16}, Rational{Int32}, SimpleRatio{Int}, SimpleRatio{SafeInt16}] | ||||||||||
| D = Dimensions{R} | ||||||||||
|
|
||||||||||
|
|
@@ -288,9 +289,9 @@ end | |||||||||
| @test ustrip(x + ones(T, 32))[32] == 2 | ||||||||||
| @test typeof(x + ones(T, 32)) <: GenericQuantity{Vector{T}} | ||||||||||
| @test typeof(x - ones(T, 32)) <: GenericQuantity{Vector{T}} | ||||||||||
| @test typeof(ones(T, 32) * GenericQuantity(T(1), D, length=1)) <: GenericQuantity{Vector{T}} | ||||||||||
| @test typeof(ones(T, 32) / GenericQuantity(T(1), D, length=1)) <: GenericQuantity{Vector{T}} | ||||||||||
| @test ones(T, 32) / GenericQuantity(T(1), length=1) == GenericQuantity(ones(T, 32), length=-1) | ||||||||||
| @test typeof(ones(T, 32) * GenericQuantity(T(1), D, length=1)) <: T_QA_GenericQuantity(T, 1) | ||||||||||
| @test typeof(ones(T, 32) / GenericQuantity(T(1), D, length=1)) <: T_QA_GenericQuantity(T, 1) | ||||||||||
| @test ones(T, 32) / GenericQuantity(T(1), length=1) == QuantityArray(ones(T, 32), GenericQuantity(T(1), length=-1)) | ||||||||||
| end | ||||||||||
|
|
||||||||||
| @testset "isapprox" begin | ||||||||||
|
|
@@ -395,17 +396,19 @@ end | |||||||||
| end | ||||||||||
|
|
||||||||||
| @testset "Multiplying ranges with units" begin | ||||||||||
| T_QA_StepRangeLen = QuantityArray{T, 1, D, Q, V} where {T, D<:Dimensions, Q<:UnionAbstractQuantity, V<:StepRangeLen} | ||||||||||
| T_QA_s_StepRangeLen = QuantityArray{T, 1, D, Q, V} where {T, D<:SymbolicDimensions, Q<:UnionAbstractQuantity, V<:StepRangeLen} | ||||||||||
| # Test multiplying ranges with units | ||||||||||
| x = (1:0.25:4)u"inch" | ||||||||||
| @test x isa StepRangeLen | ||||||||||
| @test x isa T_QA_StepRangeLen | ||||||||||
|
||||||||||
| @test x isa T_QA_StepRangeLen | |
| @test x isa QuantityArray | |
| @test DQ.array_type(x) <: StepRangeLen | |
| @test DQ.dim_type(x) <: Dimensions |
bit more readable like this.
Same comment for other T_QA_AbstractArray types - we can swap them for using the interface to inspect the type parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, will swap these out. Sorry, by using the interface to inspect type parameters, is there something else that you would like to see instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh oh!
There was an error while loading. Please reload this page.