Skip to content
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

Fix rekey of LinearContainerFactor #777

Merged
merged 2 commits into from
May 31, 2021
Merged

Fix rekey of LinearContainerFactor #777

merged 2 commits into from
May 31, 2021

Conversation

varunagrawal
Copy link
Collaborator

As per #568, LinearContainerFactor's rekey method fails because the rekey method doesn't update the keys for the Gaussian Factor and Linearization point properties.

This PR fixes #568 by overriding rekey and doing the necessary updates.

@varunagrawal varunagrawal added the bugfix Fixes an issue or bug label May 30, 2021
@varunagrawal varunagrawal self-assigned this May 30, 2021
}

/* ************************************************************************* */
NonlinearFactor::shared_ptr LinearContainerFactor::rekey(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can just reuse the method for std::map here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please explain more?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I understand now. I don't think that is doable, because the std::map version is doing a replacement, while the other one is doing an update. The assignment in the KeyVector version makes it cleaner and I am not sure how we would create the map without making some assumptions about what the user intended.

Copy link
Collaborator

@ProfFan ProfFan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dellaert
Copy link
Member

dellaert commented May 30, 2021

I’m ok if this fixes a bug , but I do want to note, for the record, that “re-keying” goes against the functional nature of GTSAM. I question the need for it and would recommend people using this to re-examine why they’re using it :-) Try to be functional unless it is really affecting performance.

@varunagrawal
Copy link
Collaborator Author

@pshea76 check out @dellaert's comment, that's great advice right there.

@varunagrawal varunagrawal merged commit d5dbaf7 into develop May 31, 2021
@varunagrawal varunagrawal deleted the fix/linear-rekey branch May 31, 2021 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Fixes an issue or bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LinearFactorContainer rekey()
3 participants