Skip to content
Snippets Groups Projects
Commit 60c98edf authored by Anton Kullberg's avatar Anton Kullberg
Browse files

py: vectorized the gating

parent aef9f0c5
No related branches found
No related tags found
No related merge requests found
...@@ -45,9 +45,9 @@ class MahalanobisGater: ...@@ -45,9 +45,9 @@ class MahalanobisGater:
# Derivative # Derivative
H = self.sensor_model['dhdx'](x.flatten()) H = self.sensor_model['dhdx'](x.flatten())
# Mahalanobis Gating # Mahalanobis Gating
T = np.zeros((y.shape[1],)) Sk = H@P@H.T+self.sensor_model['R']
for j in range(y.shape[1]): invSk = np.linalg.inv(Sk)
Sk = H@P@H.T+self.sensor_model['R'] # Computes the normalized residual for all measurements simultaneously
T[j] = eps[:, j].T@np.linalg.inv(Sk)@eps[:, j] T = np.diag(np.dot(np.tensordot(eps, invSk, (0,0)), eps))
accepted_meas = T < self.gamma accepted_meas = T < self.gamma
return accepted_meas return accepted_meas
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment