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

Reason for 0.5 factor in the error #31

Open
nkhedekar opened this issue Oct 29, 2024 · 1 comment
Open

Reason for 0.5 factor in the error #31

nkhedekar opened this issue Oct 29, 2024 · 1 comment

Comments

@nkhedekar
Copy link

In the IntegratedMatchingCostFactor (and others), the error is evaluated as const double error = 0.5 * residual.transpose() * residual; . This error is then used to create the HessianFactor as new gtsam::HessianFactor(keys()[0], H_source, -b_source, error).

As per the documentation of the HessianFactor, the constant term that needs to be provided to the constructor is $f = b^Tb$ where $b = \Sigma^{-1/2} (z - h(x_0))$ is the whitened negative error at the linearization point $x_0$.
image

Maybe I am misunderstanding something but I don't follow the reason for the factor of 0.5 in the code?

@koide3
Copy link
Owner

koide3 commented Oct 30, 2024

Hmmm, maybe I added that constant for some reasons (consistency with GTSAM factors?), but I'm not very confident now. While the error value itself does not affect the optimization as long as H and b are correct, I'll re-check whether 0.5 is necessary.

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

No branches or pull requests

2 participants