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

Change inv() usage to pinv() in ChernoffUpdater #989

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions stonesoup/updater/chernoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ def update(self, hypothesis, force_symmetric_covariance=False, **kwargs):
)

# Calculate the updated mean and covariance from covariance intersection
posterior_covariance = np.linalg.inv(self.omega*np.linalg.inv(measurement_covar) +
(1-self.omega)*np.linalg.inv(predicted_covar))
posterior_mean = posterior_covariance @ (self.omega*np.linalg.inv(measurement_covar)
posterior_covariance = np.linalg.pinv(self.omega*np.linalg.pinv(measurement_covar) +
(1-self.omega)*np.linalg.pinv(predicted_covar))
posterior_mean = posterior_covariance @ (self.omega*np.linalg.pinv(measurement_covar)
@ measurement_mean +
(1-self.omega)*np.linalg.inv(predicted_covar)
(1-self.omega)*np.linalg.pinv(predicted_covar)
@ predicted_mean)

# Optionally force the posterior covariance to be a symmetric matrix
Expand Down