-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Define +(::UniformScaling{Bool}) #36668
Comments
Why not have (+)(J::UniformScaling) = J to avoid unnecessary promotion of |
I think I'd do: (+)(J::UniformScaling) = UniformScaling(+J.λ) |
The only problem here is that we will have a different behavior between julia> import Base: +
julia> (+)(J::UniformScaling) = J
+ (generic function with 290 methods)
julia> -I
UniformScaling{Int64}
-1*I
julia> +I
UniformScaling{Bool}
true*I
This seems to be fine since it replicates that same behavior of julia> import Base: +
julia> (+)(J::UniformScaling) = UniformScaling(+J.λ)
+ (generic function with 167 methods)
julia> -I
UniformScaling{Int64}
-1*I
julia> +I
UniformScaling{Int64}
1*I I will wait a couple of days for any new ideas and then I submit the PR. |
Done! In Brazil, couple of days === 8 days 😅 (sorry for the delay, completely forgot about this...) |
In Julia, we can use
-I
:which is exactly the same as
-1*I
. However,+I
is not defined:This seems confusing at first glance. Hence, I propose that we define
+I
as+1*I
to keep consistency.If this is approved, then I can do a PR.
The text was updated successfully, but these errors were encountered: