dimforge / nalgebra

Linear algebra library for Rust.
https://nalgebra.org
Apache License 2.0
3.85k stars 459 forks source link

Addition of the Lie Algebra on the Lie Groups #700

Open ProfFan opened 4 years ago

ProfFan commented 4 years ago

Hi everyone,

I am building a sensor fusion framework based on nalgebra, and found out that we do not have support for Lie algebra operations like expmap and logmap. Is is appropriate to add them here or should I implement them in my own crate by using some traits?

Many thanks,

Fan

sebcrozet commented 4 years ago

Hi! I think it would make sense to add those to nalgebra since our existing structures like Rotation and Isometry can be seen as implementations of Lie groups.

ProfFan commented 4 years ago

@sebcrozet Glad that you think so :) Do you have any ideas that where should these functions go, and where to put the corresponding traits?

Best

Fan

sebcrozet commented 4 years ago

I'm not an expert in lie algebra so I don't have a precise idea of what would all these functions be exactly. But I expect most functions to be either methods or static methods of types like Isometry or Rotation. In that case, they would go in files in the geometry folder. For example src/geometry/isometry_lie_algebra.rs.

If you happen to have a listing of all the signature of those functions, I could get a better idea.

The corresponding traits should not be part of nalgebra. They should be added to alga. But I suggest starting by implementing those functions without a trait, and then adding the corresponding traits to alga in a second time (once the work on algebra is merged).

vadixidav commented 4 years ago

@ProfFan I am starting to work on this as well for the purposes of rust-cv, as we would like to optimize rotations using so(3). If you have already started on this I would like to sync up. I am not an expert in lie algebras, but I think I can structure the code. You can contact me on the rust-cv Discord or my email (from my GitHub profile) if you don't do discord.

For you and others, there is some prior art in this repo: https://github.com/mpizenberg/visual-odometry-rs/blob/master/src/math/so3.rs. Previous discussions here: https://discourse.nphysics.org/t/lie-algebra-se3/233.

ProfFan commented 4 years ago

@vadixidav I already have an implementation in https://github.com/CoreRC/rtsam/tree/master/src/geometry

That is a long long time ago :) It is hard to implement in nalgebra because of the traits, but as @sebcrozet said you can try first do it without them.

vadixidav commented 4 years ago

@ProfFan Thank you for sharing. Just to get going I will develop my implementation separately initially and then try and integrate it fully into nalgebra once it is battle-tested in rust-cv (on some MVG tasks). I will report on here when there is progress.