-
Notifications
You must be signed in to change notification settings - Fork 111
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
Inconsistency with ustrip(array)
and mixed units
#630
Comments
the downside of broadcasting is that
|
wait, hold up! the method of ustrip that is deprecated is the one that inputs a non-unitful array. still, i wonder why, because broadcasting ustrip onto a non-unitful array allocates, and it'd be nice to avoid that when writing generic code. |
It’s not great that I propose the following for Unitful 2.0:
|
by
however, if i simply add a new method identical to this one but with
to be all inclusive, i think the right way to go here is just use |
here's another pain point with composing Unitful and CUDA. everything is fine w/o Unitful.
doing the same thing as above, but this time with both arrays having units, and using the
|
I was mainly thinking about the structured matrices for which we already have specialized methods: Lines 89 to 92 in 69ffe80
But it would be nice to define it for generic AbstractArray s as well.
I don’t know whether defining a generic |
the only case where without that method, i'm not sure i see the need to add |
The fact that the method is deprecated does not mean that we can remove it without making a breaking release. Deprecating just means “we recommend not using this method and may remove it in the next breaking release”, so we would still have to release v2.0 if we want to remove that method. The reason why I would like to introduce |
my bad about semvar deprecations. you're right. re. missing a dot to broadcast-- i don't think many julian developers would make that mistake. it's too common in the language. |
When calling
ustrip
on a quantity with mixed units likedBV/m
, both logarithmic and linear units are stripped. When callingustrip
on an array of these quantities, only the linear part is stripped:This is because calling
ustrip
on anArray{<:Quantity}
actuallyreinterpret
s the array. It is not possible toreinterpret
the value5.0dBV/m
to the value5.0
, because theLevel
type stores the linear quantity (in this case1.7782794100389228 V
, not the number5.0
).The text was updated successfully, but these errors were encountered: