Skip to content

Commit e2c041d

Browse files
committed
Switch Kálmán filters to use Joseph form
This commit switches the Kálmán filters to use the Joseph form covariance update which is known to be usable for any gain matrix $K$ even if the gain matrix is distorted by numerical imprecision. Empirically, this seems to resolve quite a few issues with our filtering algorithms.
1 parent 673d408 commit e2c041d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

core/include/traccc/fitting/kalman_filter/gain_matrix_updater.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ struct gain_matrix_updater {
111111
// Calculate the filtered track parameters
112112
const matrix_type<6, 1> filtered_vec =
113113
predicted_vec + K * (meas_local - H * predicted_vec);
114-
const matrix_type<6, 6> filtered_cov = (I66 - K * H) * predicted_cov;
114+
const matrix_type<6, 6> i_minus_kh = I66 - K * H;
115+
const matrix_type<6, 6> filtered_cov =
116+
i_minus_kh * predicted_cov * matrix::transpose(i_minus_kh) +
117+
K * V * matrix::transpose(K);
115118

116119
// Residual between measurement and (projected) filtered vector
117120
const matrix_type<D, 1> residual = meas_local - H * filtered_vec;

core/include/traccc/fitting/kalman_filter/two_filters_smoother.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,10 @@ struct two_filters_smoother {
168168
// Calculate the filtered track parameters
169169
const matrix_type<6, 1> filtered_vec =
170170
predicted_vec + K * (meas_local - H * predicted_vec);
171-
const matrix_type<6, 6> filtered_cov = (I66 - K * H) * predicted_cov;
171+
const matrix_type<6, 6> i_minus_kh = I66 - K * H;
172+
const matrix_type<6, 6> filtered_cov =
173+
i_minus_kh * predicted_cov * matrix::transpose(i_minus_kh) +
174+
K * V * matrix::transpose(K);
172175

173176
// Residual between measurement and (projected) filtered vector
174177
const matrix_type<D, 1> residual = meas_local - H * filtered_vec;

0 commit comments

Comments
 (0)