-
Notifications
You must be signed in to change notification settings - Fork 44
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
Skew-symmetric matrices as generators for rotations #30
Comments
It would be great to have the type of "Lie algebra element" be distinct from "Lie group element." Currently, I think the conflating of Lie group elements with Lie algebra elements is the root cause of #126. Also, there should be some type for which |
One option could be to use |
To fix #128, I think we may also need a distinct representation for the Lie algebra of unit quaternions. Related to that, I have some use cases [1] that rely on distinguishing between the quaternions [1] I'm working with generative models of continuously changing quaternions, so I think I need to rely on |
I'd be tempted to build a family of representations of real 3x3 skew-symmetric matrices, starting with the obvious matrix-like one, but then also generators for For unit quaternions our representation has an aditional Z(2) "gauge" (is it basically isomorphic to O(3) x Z(2)?). I could possibly imagine an additional group element which is basically an identity matrix but maps (We can't put that bit inside the quaternion generator because then addition becomes ambiguous). |
Representing skew-symmetric matrices by their three free entries sounds
great. For quaternions though, representation of the unit quaternion Lie
algebra is even more straightforward than the so(3) Lie algebra: a tangent
vector at the identity quaternion can be written as a pure-imaginary
infinitesimal (a * ∂/∂x + b * ∂/∂y + c * ∂/∂z), and I think it is best to
use this natural identification of the unit quaternion Lie algebra with
R^3, rather than trying to build some other bijection (especially if it's
discontinuous).
Regarding the Lie groups, (if I understand the notation correctly) the unit
quaternions are not isomorphic to SO(3) × (Z/2Z). The map from unit
quaternions to SO(3) is a connected two-sheeted cover, so (very)
schematically speaking it looks like this
<https://en.wikipedia.org/wiki/Riemann_surface#/media/File:Riemann_sqrt.svg>
rather than like this
<https://en.wikipedia.org/wiki/Covering_space#/media/File:Covering_space_diagram.svg>.
Any particular choice of how to locally decompose into a direct product
would have singularities when one attempts to extend it to a global
definition, thus losing the advantages quaternions have over other
representations. So I think it's best to stick with representing unit
quaternions directly as `(w, x, y, z)`.
(We can't put that bit inside the quaternion generator because then
addition becomes ambiguous).
More ambiguous than it already is? The log function is already
multi-valued. Actually I'm now realizing that even in the original
formalism, a definition like q^t = exp(t * log(q)) depends on the branch
cut when t isn't an integer, and I'm wondering what that means for the
behavior of SLERP interpolation... [Edit: Ah, looks like changing the
branch just causes SLERP to traverse the geodesic multiple times.]
…On Fri, Jul 24, 2020 at 7:02 PM Andy Ferris ***@***.***> wrote:
I'd be tempted to build a family of representations of real 3x3
skew-symmetric matrices, starting with the obvious matrix-like one, but
then also generators for RotationVec and Quaternion and so on. We can
define exp and log to map between the group and algebra elements.
For unit quaternions our *representation* has an aditional Z(2) "gauge"
(is it basically isomorphic to SU(2) x Z(2)?) I could possibly imagine an
additional group element which is basically an identity matrix but maps q
to "-q" under multiplication (the quotes are because - is actually
defined in terms of 3x3 matrices here...). I suppose there's an actual
quaternion for that but I'm not sure if an explicit singleton or 1-bit
struct would be good so each quaternion can be represented exactly as exp(quaternion_generator)
* quaternion_guage. Would that be useful to anyone?
(We can't put that bit inside the quaternion generator because then
addition becomes ambiguous).
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#30 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABA7VV5GFHUEA5DOFDQHQXDR5IHH7ANCNFSM4DILZZ3Q>
.
|
What would be an appropriate name for the abstract type to represent the Lie algebra (Skew-symmetric matrices)? |
I don't think @hyrodium, are you planning to take a crack at implementing this? |
Indeed, some operations are not algebraically closed in julia> using Rotations
julia> RotX(1) + RotY(2.3)
3×3 StaticArrays.SMatrix{3, 3, Float64, 9} with indices SOneTo(3)×SOneTo(3):
0.333724 0.0 0.745705
0.0 1.5403 -0.841471
-0.745705 0.841471 -0.125974 Therefore, if the operation is not closed, I think we just need to return
Yes, I'm planning. But not sure the type namings and detailed implementation. |
I'd love to help! |
This is a judgment call, but I think the implicit conversion to |
This also interacts with the issue described above in #30 (comment): And again, we might want to not implement infinitesimal unit quaternions in the first PR, instead sticking to just the other types which convert losslessly to elements of SO(3). One reason being that the exponential map is different for infinitesimal unit quaternions than it is for infinitesimal rotations. (The conversion is known and straightforward, but they are not the same return type.) |
Hmm, that makes breaking changes, so I would like to keep
Do you have any examples? I think
I agree with that. But maybe, we can just return
It's a small detail, but I think conversions from
Okay, understood. I'll proceed that way:+1: |
@andyferris |
Agreed.
Main example that comes to mind (admittedly, it's the language itself, not julia> nothing || 5
ERROR: TypeError: non-boolean (Nothing) used in boolean context
julia> if [] 1 else 0 end
ERROR: TypeError: non-boolean (Vector{Any}) used in boolean context Vaguely similar but not the same, checked casts: julia> Int(3.3)
ERROR: InexactError: Int64(3.3)
To me that is a big detail 🙂 I agree "narrowing" is not the right word, I'd say the conversion is co-widening. That is, a widening conversion is an injective function, whereas what we have here is a surjection, the 2-to-1 covering map. The non-injectivity of that map is why your above suggestion, " |
Ah, I made a wrong reply here. I think it's ok to narrow |
What about julia> using Rotations
julia> Rotations.UnitQuaternion(1,0,0,0) + rand(3,3)
3×3 StaticArrays.SMatrix{3, 3, Float64, 9} with indices SOneTo(3)×SOneTo(3):
1.72595 0.936594 0.125292
0.197989 1.7558 0.827308
0.258292 0.037621 1.90299
julia> Complex(1, 0) + rand(2, 2)
ERROR: MethodError: no method matching +(::Complex{Int64}, ::Matrix{Float64})
For element-wise addition, use broadcasting with dot syntax: scalar .+ array A unit-magnitude complex (respectively quaternion) number has a representation as 2-by-2 (respectively 3-by-3) real orthogonal matrix. Personally, I am in favor of a breaking release of this package that removes the behavior that conflates elements of the rotation group with their linear representation. Not to mention the double-cover issue. |
It seems the example is not correct here, because
I think that will break the main concept of the package. Making a new package with a different name will be better, I guess. |
That's exactly what I mean. A unit-complex/unit-quaternion is an efficient parameterization for a rotation in 2D/3D. btw, this did introduce 2D
It is a big part of |
See #29.
I think it would be great to have a skew-symmetric matrix type that can be exponentiated into a
Rotation
, and vice-versa vialog
. These would form a Lie algebra to complement the Lie group of rotations.Similarly to the rotations, these could have simplified parameterizations that are similar to
AngleAxis
andRodriguesVec
.The text was updated successfully, but these errors were encountered: