You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey again Miles. Sort of following up to your comment on Discourse, were you thinking of just having an extra method or two like:
Base.:*(A::AbstractArray, q::UnionAbstractQuantity) =QuantityArray(A, q)
Base.:*(q::UnionAbstractQuantity, A::AbstractArray) = A * q
so that things like this will work?
julia> (0:1.5:10)u"km"
7-element QuantityArray(::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, ::Quantity{Float64, Dimensions{FixedRational{Int32, 25200}}}):
0.0 m
1500.0 m
3000.0 m
4500.0 m
6000.0 m
7500.0 m
9000.0 m
julia> u"km"* [3, 4, 5]
3-element QuantityArray(::Vector{Float64}, ::Quantity{Float64, Dimensions{FixedRational{Int32, 25200}}}):
3000.0 m
4000.0 m
5000.0 m
julia> [3, 4, 5] *u"km"
3-element QuantityArray(::Vector{Float64}, ::Quantity{Float64, Dimensions{FixedRational{Int32, 25200}}}):
3000.0 m
4000.0 m
5000.0 m
julia> [3, 4, 5] .*u"km"# Maintain original behavior
3-element Vector{Quantity{Float64, Dimensions{FixedRational{Int32, 25200}}}}:
3000.0 m
4000.0 m
5000.0 m
Happy to get a quick PR going with some docs and tests if so!
The text was updated successfully, but these errors were encountered:
Hi @MilesCranmer, after putting up #165, I was wondering if this might also be good for making plots internally?
I see that this would break a lot of the unit tests that assume that the return type is still a vector of quantities though. Should I update those too, or is this an indicator that I probably shouldn't be doing it this way 😅
Uh oh!
There was an error while loading. Please reload this page.
Hey again Miles. Sort of following up to your comment on Discourse, were you thinking of just having an extra method or two like:
so that things like this will work?
Happy to get a quick PR going with some docs and tests if so!
The text was updated successfully, but these errors were encountered: