20 #include <boost/range/adaptors.hpp>
41 template <
typename source_link_t>
46 ACTS_VERBOSE(
"Invoked GainMatrixSmoother on entry index: " << entryIndex);
47 using namespace boost::adaptors;
53 prev_ts.smoothed() = prev_ts.filtered();
54 prev_ts.smoothedCovariance() = prev_ts.filteredCovariance();
60 std::optional<std::error_code> error{std::nullopt};
62 ACTS_VERBOSE(
"Only one track state given, smoothing terminates early");
64 ACTS_VERBOSE(
"Start smoothing from previous track state at index: "
65 << prev_ts.previous());
71 assert(ts.hasFiltered());
72 assert(ts.hasPredicted());
73 assert(ts.hasJacobian());
76 assert(prev_ts.hasSmoothed());
77 assert(prev_ts.hasPredicted());
80 ACTS_VERBOSE(
"Filtered covariance:\n" << ts.filteredCovariance());
83 << prev_ts.predictedCovariance() <<
"\n, inverse: \n"
84 << prev_ts.predictedCovariance().inverse());
89 G = ts.filteredCovariance() * prev_ts.jacobian().transpose() *
90 prev_ts.predictedCovariance().inverse();
93 error = KalmanFitterError::SmoothFailed;
100 ACTS_VERBOSE(
"Filtered parameters: " << ts.filtered().transpose());
102 "Prev. smoothed parameters: " << prev_ts.smoothed().transpose());
104 "Prev. predicted parameters: " << prev_ts.predicted().transpose());
108 ts.filtered() + G * (prev_ts.smoothed() - prev_ts.predicted());
110 ACTS_VERBOSE(
"Smoothed parameters are: " << ts.smoothed().transpose());
114 << prev_ts.smoothedCovariance());
117 ts.smoothedCovariance() =
118 ts.filteredCovariance() -
119 G * (prev_ts.predictedCovariance() - prev_ts.smoothedCovariance()) *
130 "Smoothed covariance is not positive definite. Could result in "
131 "negative covariance!");
134 ts.smoothedCovariance() = smoothedCov;
135 ACTS_VERBOSE(
"Smoothed covariance is: \n" << ts.smoothedCovariance());