Skip to content

Commit a1b9f01

Browse files
committed
Update algebra plugins to v0.28.0
This commit updates the algebra plugins external to v0.28.0 and uses its new transposed product function in the Kálmán filter code.
1 parent fa2e216 commit a1b9f01

File tree

3 files changed

+23
-15
lines changed

3 files changed

+23
-15
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,14 @@ struct gain_matrix_updater {
100100
getter::element(V, 1u, 1u) = 1.f;
101101
}
102102

103-
const matrix_type<D, D> M =
104-
H * predicted_cov * matrix::transpose(H) + V;
103+
const matrix_type<e_bound_size, D> projected_cov =
104+
algebra::matrix::transposed_product<false, true>(predicted_cov, H);
105+
106+
const matrix_type<D, D> M = H * projected_cov + V;
105107

106108
// Kalman gain matrix
107109
assert(matrix::determinant(M) != 0.f);
108-
const matrix_type<6, D> K =
109-
predicted_cov * matrix::transpose(H) * matrix::inverse(M);
110+
const matrix_type<6, D> K = projected_cov * matrix::inverse(M);
110111

111112
// Calculate the filtered track parameters
112113
const matrix_type<6, 1> filtered_vec =
@@ -119,7 +120,9 @@ struct gain_matrix_updater {
119120
// Calculate the chi square
120121
const matrix_type<D, D> R = (I_m - H * K) * V;
121122
const matrix_type<1, 1> chi2 =
122-
matrix::transpose(residual) * matrix::inverse(R) * residual;
123+
algebra::matrix::transposed_product<true, false>(
124+
residual, matrix::inverse(R)) *
125+
residual;
123126

124127
// Return false if track is parallel to z-axis or phi is not finite
125128
const scalar theta = bound_params.theta();

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

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,16 @@ struct two_filters_smoother {
123123
// Eq (3.39) of "Pattern Recognition, Tracking and Vertex
124124
// Reconstruction in Particle Detectors"
125125
const matrix_type<D, D> R_smt =
126-
V - H * smoothed_cov * matrix::transpose(H);
126+
V - H * algebra::matrix::transposed_product<false, true>(
127+
smoothed_cov, H);
127128

128129
// Eq (3.40) of "Pattern Recognition, Tracking and Vertex
129130
// Reconstruction in Particle Detectors"
130131
assert(matrix::determinant(R_smt) != 0.f);
131-
const matrix_type<1, 1> chi2_smt = matrix::transpose(residual_smt) *
132-
matrix::inverse(R_smt) *
133-
residual_smt;
132+
const matrix_type<1, 1> chi2_smt =
133+
algebra::matrix::transposed_product<true, false>(
134+
residual_smt, matrix::inverse(R_smt)) *
135+
residual_smt;
134136

135137
if (getter::element(chi2_smt, 0, 0) < 0.f) {
136138
return kalman_fitter_status::ERROR_SMOOTHER_CHI2_NEGATIVE;
@@ -156,14 +158,15 @@ struct two_filters_smoother {
156158
matrix::identity<matrix_type<e_bound_size, e_bound_size>>();
157159
const auto I_m = matrix::identity<matrix_type<D, D>>();
158160

159-
const matrix_type<D, D> M =
160-
H * predicted_cov * matrix::transpose(H) + V;
161+
const matrix_type<e_bound_size, D> projected_cov =
162+
algebra::matrix::transposed_product<false, true>(predicted_cov, H);
163+
164+
const matrix_type<D, D> M = H * projected_cov + V;
161165

162166
// Kalman gain matrix
163167
assert(matrix::determinant(M) != 0.f);
164168
assert(std::isfinite(matrix::determinant(M)));
165-
const matrix_type<6, D> K =
166-
predicted_cov * matrix::transpose(H) * matrix::inverse(M);
169+
const matrix_type<6, D> K = projected_cov * matrix::inverse(M);
167170

168171
// Calculate the filtered track parameters
169172
const matrix_type<6, 1> filtered_vec =
@@ -178,7 +181,9 @@ struct two_filters_smoother {
178181
// assert(matrix::determinant(R) != 0.f);
179182
assert(std::isfinite(matrix::determinant(R)));
180183
const matrix_type<1, 1> chi2 =
181-
matrix::transpose(residual) * matrix::inverse(R) * residual;
184+
algebra::matrix::transposed_product<true, false>(
185+
residual, matrix::inverse(R)) *
186+
residual;
182187

183188
// Update the bound track parameters
184189
bound_params.set_vector(filtered_vec);

extern/algebra-plugins/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ message( STATUS "Building Algebra Plugins as part of the TRACCC project" )
1313

1414
# Declare where to get Algebra Plugins from.
1515
set( TRACCC_ALGEBRA_PLUGINS_SOURCE
16-
"URL;https://github.com/acts-project/algebra-plugins/archive/refs/tags/v0.27.0.tar.gz;URL_MD5;d59270836aba4cebc27369acea6a995f"
16+
"URL;https://github.com/acts-project/algebra-plugins/archive/refs/tags/v0.28.0.tar.gz;URL_MD5;24fa671f564a332858599df60fb2228f"
1717
CACHE STRING "Source for Algebra Plugins, when built as part of this project" )
1818
mark_as_advanced( TRACCC_ALGEBRA_PLUGINS_SOURCE )
1919
FetchContent_Declare( AlgebraPlugins SYSTEM ${TRACCC_ALGEBRA_PLUGINS_SOURCE} )

0 commit comments

Comments
 (0)