Skip to content

Conversation

akshay-krishnan
Copy link
Contributor

Updated translation averaging to use a random number generator (RNG) just like Shonan averaging.

  • Added a new method that accepts an RNG
  • Using a static RNG with the existing method.
  • fixed a typo in the method name "initializeRandomly()"
  • updating a comment in Shonan averaging.

@akshay-krishnan
Copy link
Contributor Author

I just realized there might have been an existing branch called "ta-seed", but looks like nothing has been changed on it.

Copy link
Contributor

@varunagrawal varunagrawal left a 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.

// 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) {
Copy link
Contributor

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.

* @param rng random number generator
* @return Values
*/
Values initializeRandomly(std::mt19937 &rng) const;
Copy link
Member

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.

@akshay-krishnan akshay-krishnan merged commit a0d64a9 into develop Mar 2, 2022
@dellaert dellaert deleted the ta-seed branch March 27, 2022 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants