-
Notifications
You must be signed in to change notification settings - Fork 768
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
Using a random number generator in translation averaging #1120
Conversation
I just realized there might have been an existing branch called "ta-seed", but looks like nothing has been changed on it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo one comment.
gtsam/sfm/TranslationRecovery.cpp
Outdated
// Create a lambda expression that checks whether value exists and randomly | ||
// initializes if not. | ||
Values initial; | ||
auto insert = [&initial](Key j) { | ||
auto insert = [&initial, &rng, &randomVal](Key j) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you can just do [&]
to capture all the variables in the initializeRandomly
scope.
gtsam/sfm/TranslationRecovery.h
Outdated
* @param rng random number generator | ||
* @return Values | ||
*/ | ||
Values initializeRandomly(std::mt19937 &rng) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think it should be std::mt19937 *rng
: use a pointer for i/o, not a reference. This should also be fixed in all other cases, but let's not add another case.
Updated translation averaging to use a random number generator (RNG) just like Shonan averaging.