artivis / manif

A small C++11 header-only library for Lie theory.
https://artivis.github.io/manif
MIT License
1.46k stars 239 forks source link

Add Lie bracket #300

Closed artivis closed 1 month ago

artivis commented 1 month ago

Add the Lie bracket in vector form ([x,y]^v = adj(x) . y).

It is implemented as both :

with the later being a personal favorite in terms of notation.

The actual bracket in the Lie algebra can then be computed as Tangent::Bracket(x, y).hat().

Note: the vee operator will be implemented in a subsequent pr.

Closes #267 .

artivis commented 1 month ago

@joansola Your opinion about the api and more importantly about the fact that it is in vector form? Calling it 'bracket' isn't too much of a stretch since it is actually 'bracket^vee'?

Doing so has the advantage that it doesn't requires the vee operator (which will come in a subsequent pr).

nielsvd commented 1 month ago

This is great, looking forward to seeing this merged. One question and one comment from my side:

joansola commented 1 month ago

@joansola Your opinion about the api and more importantly about the fact that it is in vector form? Calling it 'bracket' isn't too much of a stretch since it is actually 'bracket^vee'?

Doing so has the advantage that it doesn't requires the vee operator (which will come in a subsequent pr).

From a mathematical standpoint, yes, our vector representation of the Lie algebra is indeed a Lie algebra, and it has a bracket operator, which is this one, and they are both equivalent, because both spaces are isomorphic.

From a code standpoint. What´s the best way to document this so that a foreign can FIND this documentation trivially? Like, you are on vscode and you hover your mouse over. Then the doc appears and you can read this note just there. Because this is the only point of concern, it does not require a serious documentation, just a note. But this note needs to be findable very easily.

I´d say normally document it in the .h file as any other doxygen documentation. At least this. But being all templated, would the IDEs, by hovering over the function calls, display such doc? I dont know.

artivis commented 1 month ago

@joansola Regarding documentation, hopefully the doxygen+api is clear enough and should do the job.

joansola commented 1 month ago
L366   * @return @return LieAlg The Lie bracket [a,b] in vector form.

OK sounds good but here you have two @return statements and say that the return type is LieAlg :-D

artivis commented 1 month ago

@joansola Fixed the doc.

artivis commented 1 month ago

@nielsvd Thanks for the feedback. I've implemented the specialisation for Rn :+1: . However I'll leave the group specific tests as futur work ;)