-
Notifications
You must be signed in to change notification settings - Fork 38
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
Drop normalize for quaternions #69
Comments
I lean towards "bug". Here's why:
|
I think you mis-typed. To be clear, the standard behavior is I agree that deprecating As you point out, there really is no right way to produce a unit quaternion from a zero quaternion. It is up to the specific use site to dictate whether there is a reasonable value one can use (eg, one) or whether For user-written functions, they will (they must) handle this on their own -- it's not the package's job to hand them an arbitrary value. For the package function |
Yes, thanks for correcting me! I agree with all of your points. |
LinearAlgebra only implements 2
normalize
methods:Notably, there is no
normalize(::Real)
ornormalize(::Complex)
. For good reason, as for numbers, this is the role of thesign
function, which is defined generically for all numbers:https://github.com/JuliaLang/julia/blob/bb2d8630f3aeb99c38c659a35ee9aa57bb71012a/base/number.jl#L161
We should deprecate
normalize
then and refer users to thesign
function.A difference between our
normalize
andsign
functions, however, is how they treat zero quaternions:There are at least 4 different ways one could handle
normalize
for zero quaternions:sign
)Quaternion(1)
)I don't like the last 2, as they are arbitrary. The question is whether the current behavior is a bug or the desired behavior. If a bug, then we are free to define
Base.@deprecate normalize(x) sign(x)
. If desired, then we should define a different function for normalizing instead of overridingLinearAlgebra.normalize
and deprecatenormalize
.The text was updated successfully, but these errors were encountered: