-
Notifications
You must be signed in to change notification settings - Fork 55
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
Issues integrating on a Lie group #609
Comments
(Answering to myself about 3.: it makes sense that |
This is actually a very interesting example! I will answer your questions a bit out of order.
Integration on Lie groups with metrics that are not bi-invariant can be quite confusing. In your example solver takes steps according to the metric: alg = ManifoldDiffEq.ManifoldLieEuler(M, ExponentialRetraction(), action) It can be changed so that the steps are taken according to the group exponential: alg = ManifoldDiffEq.ManifoldLieEuler(M, Manifolds.GroupExponentialRetraction(), action) This is part of the reason behind the difference. Next, Lie group solvers don't actually "go" in the direction returned by your
I made
Some parts of OrdinaryDiffEq need
That may be my error -- ManifoldDiffEq.jl doesn't make copies for some caches. I will fix that. |
Thanks for your answer. Some background to my thinking here: I wanted to be able to integrate the differential equation g' = ξg, g(0) = 1, on a Lie group, where ξ is a constant in the Lie algebra. How would I go about to setup such an equation on either of the groups defined in (Of course, I want to solve any differential equation on a Lie group, defined as g'(t) = ξ(g(t))g(t), but I wanted to check that the constant case was done right first). The exact solution to such an equation is g(t) = exp(tξ). Moreover, I wish to integrate using the connection defined by either one of the Cartan–Schouten family. When using any of those, any Lie group integrator should give the same result as computing the exponential of ξ directly (so, essentially the exact result). I didn't know Some references to this point of view on integration on Lie groups (and in general homogeneous spaces): https://arxiv.org/abs/1402.6981 This being said, even using |
Your code should work fine for bi-invariant groups, and I didn't try before solving ODEs on special euclidean so there might be some issue somewhere. Your example works on special orthogonal and that product group (though the tolerance needs to be increased a bit). I tried writing out explicitly what should happen in a two-step forward Euler (t = 0.5), here is where I got: G_TR = ConnectionManifold(G, CartanSchoutenZero()) # let's use Cartan-Schouten connection
u0_aff = affine_matrix(G, u0) # it's a bit easier to experiment with affine matrices
vel_aff = affine_matrix(G, vel)
a_aff = exp(G_TR, u0_aff, vel_aff/2)
a_aff = exp(G_TR, a_aff, translate_diff(G, a_aff, a_aff, vel_aff/2, LeftAction())) After the last line |
Thank you for looking into this. There is probably a bug somewhere with Then, in mathematical notations, it should just be the infinitesimal action of Actually, i find it easier in this case to work with the appropriate +/- Cartan connection (the one for which the derivative of the vector field ξg is zero in all directions), then the implementation (using connections) is exactly u1 = exp(ξ/2)u0, and u2 = exp(ξ/2)u1, where we see that u2 = exp(ξ) u0, the exact solution. (I am pretty sure that any of the Cartan–Schouten connection should work though, since the geodesics are the same. The intermediate u1 would also be the same. Explicitly, if you used the other +/- CS connection, you would compute u2 = u1 exp(u1^{1}ξ/2 u1), which is the same as the u2 above.) |
HI Olivier, If you could open issues for those we can check how much we can help adding them. Concerning Integrators – we do not have many until now in ManifoldDiff – so if you have a cool one and you see how you can contribute said method, that would be very welcome! Best regards from Trondheim, |
Yes, you are correct, and actually this fixes my example. By the way, I think I've identified the bug -- actually fairly easy to fix. |
@mateuszbaran Yes! Well done, it seems that you have fixed the bug in e6702d6. The assertion now passes for in the The only remaining (less urgent) issue is the confusion stemming from Thanks again! 🤩 |
@kellertuer Thanks for your message! I knew this package is developed partly from NTNU. 😃 Originally, I wanted features for manifolds like getting a basis at a tangent space. I started doing that in Python before realizing that you all have got much further along those lines. This alone drove me into the Julia world! I have implemented a bunch of Lie group integrators in Python in (Other than that, there are some parts in Cheers! |
Yes, not all methods are implemented everywhere, that is correct. We try to do that step by step, but together with proper testing and documentation, that takes some time; when at the same time none of the main developers (currently) works with the Semidirectproduct, some methods might still be missing. Open issues for missing methods already helps (pointing to where such a method could be found in literature would be awesome!) to keep track. We are always open for PR on that – keep track of missing methods with issues and try to work through them step by step. But 3 people working on JuliaManifolds is not so many (for example compared to the near-infinite-it-seems team of geomstats), so we are not that fast in coding sometimes. We hope to be well-documented, well-tested and reasonably fast in runtime, though. homogint sounds very promising, it would be very interesting to see whether that scheme could be realised in ManifoldsDiffEq together with DifferentialEquations.jl – though also that is not my main area I work on (that's Manopt.jl), I try to help there as well :) edit: Oh, I just checked, currently Manifolds.jl is 31k lines of code (including documentation, excluding tests) and we run 15k tests to cover 98+% of the code. We hope that makes bugs rare – but the one you discovered (an in-place side effect) are sometimes also hard to get right :) but: Thanks for finding that, only reporting those makes code better! |
Sure! I guess a first step would be to have automated testing for all (or many) of the group configurations (arbitrary products of semidirect products etc.), and testing generic things such as exp(ad ξ) = Ad_{exp ξ), or Ad_g Ad_{g'} = Ad_{gg'}, or solving a trivial differential equation just as I did. I guess the missing methods would quickly appear this way?
That is remarkable indeed. 👍
My pleasure, thanks again to @mateuszbaran for this very quick fix!! |
Sure – I would love to get our test suite to a bit more automated testing – and where then certain tests are disabled indicating that those methods are missing.
Very kind of you to say. I personally never worked with geomstats, since I “skipped” Python and moved from Matlab directly to Julia. They do have a systematic (object oriented) way as well, as far as I am aware; though it is – I think – a quire flat hierarchy and not much focused on “features” (like whether a manifold is a Lie group).
Yes! More tutorials would be great. But those also take time. I started ManoptExamples.jl recently as a collection of (well-tested, well-documented) optimisation problems / benchmarks and according tutorials. Sadly the mentioned PR you linked seems to have been discontinued or is inactive for now for a while. |
You're welcome 🙂 . I will replace
Cool, I will have to take a look at your package. When I was designing ManifoldDiffEq.jl, I missed it somehow and I only knew about DiffMan. It was very difficult to design good abstractions based on papers I've been reading and I'm sure I must've missed some concepts. For example I still don't have a good understanding of isotropy. By the way, there wasn't much activity in ManifoldDiffEq.jl recently but I'm planning to go back to it later this year, mostly with the goal of parameter estimation of ODEs/SDEs on SE(n).
Yes, we have some missing methods. We are a small team and there is a massive amount of things that could be useful, so we implement what we need or are interested in, and sometimes people ask for some functionality and we implement it. Feel free to open issues about things that are missing or incorrect 🙂 .
Yes, we are aware of a lot of missing methods but we need to prioritize different tasks. If something is nontrivial (and for example many things on semidirect product groups are nontrivial) and we don't really need it at the moment, it is often left for later. For example, I remember spending a couple of hours trying to work out a generic implementation of differential of the right translation on semidirect product groups but in the end I managed to only work it out for SE(n).
Thank you 🙂 . I personally appreciate the work of
More tutorials is a very good idea, I will try to make something when I have more time. |
That would be awesome!
Understanding isotropy was the motivation of writing the paper Integrators on homogeneous spaces: Isotropy choice and connections. The paper explains isotropy in §5 (in particular, in most homogeneous space, there is a canonical isotropy, in one-to-one correspondence to the invariant affine connections). The paper also shows how to put all the Lie group integrators in the same general framework in §4. This allows to implement any Lie group integrator with minimal efforts (and
Thanks, I will! |
Integrating a constant differential equation on a Lie group starting at the identity should give the same as the exponential. I have many problems trying to make sure this is the case. Did I misunderstand how integration is supposed to work? Here is a minimal working example with various configurations.
Here is the code that produces the problem, I have some questions after the code
G = SpecialEuclidean
? (namelyArrayPartition
andProductRepr
) For instance,rand(G)
andrand(G; vector_at=Identity(G))
produce different types?length
function needed to solve differential equations? In that case, should it be implemented forProductRepr
or/andArrayPartition
?solve
should change variable outside the scope, in particular,expected
(happens for the translation group)?SpecialEuclidean
case. Am I doing something wrong?The text was updated successfully, but these errors were encountered: