inv(I::UniformScaling{Bool}) = UniformScaling{Float64}

This seems like it shouldn’t convert to a UniformScaling{Float64}:

julia> inv(I)
UniformScaling{Float64}
1.0*I

at least I don’t see a reason for this and it could cause some type instabilities!? Possibly there is a reason why inv(I) !== I ?

You also have

julia> inv(true)
1.0

so I would assume it stems from this since

julia> UniformScaling(1//1)
UniformScaling{Rational{Int64}}
1//1*I

julia> inv(ans)
UniformScaling{Rational{Int64}}
1//1*I

and it seems like dispatching specifically on I might not be optimal since you can also create

julia> UniformScaling(false)
UniformScaling{Bool}
false*I

which would not fulfill inv(false*I) = false*I but still have the same type.

4 Likes

I see the point, and I guess the conversion is pretty much irrelevant in most use-cases since 1.0 is exactly represented by a Float64. It just seemed like an oddly specific type, when I simply use I.