Skip to content

Commit

Permalink
[samples] power function tidy type narrowing
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancoisCarouge committed Feb 3, 2025
1 parent 34e7925 commit e52397b
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions sample/kf_8x4x0_deep_sort_bounding_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,29 @@ using state = fcarouge::state<vector<8>>;
estimate_uncertainty{
[&position_weight, &velocity_weight, &initial_box]() {
matrix<float, 8, 8> value{zero<matrix<float, 8, 8>>};
value(0, 0) = std::pow(2.F * position_weight * initial_box(3), 2);
value(1, 1) = std::pow(2.F * position_weight * initial_box(3), 2);
value(2, 2) = std::pow(1e-2F, 2);
value(3, 3) = std::pow(2.F * position_weight * initial_box(3), 2);
value(4, 4) = std::pow(10.F * velocity_weight * initial_box(3), 2);
value(5, 5) = std::pow(10.F * velocity_weight * initial_box(3), 2);
value(6, 6) = std::pow(1e-5F, 2);
value(7, 7) = std::pow(10.F * velocity_weight * initial_box(3), 2);
value(0, 0) = std::powf(2.F * position_weight * initial_box(3), 2);
value(1, 1) = std::powf(2.F * position_weight * initial_box(3), 2);
value(2, 2) = std::powf(1e-2F, 2);
value(3, 3) = std::powf(2.F * position_weight * initial_box(3), 2);
value(4, 4) = std::powf(10.F * velocity_weight * initial_box(3), 2);
value(5, 5) = std::powf(10.F * velocity_weight * initial_box(3), 2);
value(6, 6) = std::powf(1e-5F, 2);
value(7, 7) = std::powf(10.F * velocity_weight * initial_box(3), 2);
return value;
}()},
// Q
process_uncertainty{[](const state::type &x) {
const float weight_position{1.F / 20.F};
const float weight_velocity{1.F / 160.F};
matrix<float, 8, 8> value{zero<matrix<float, 8, 8>>};
value(0, 0) = std::pow(weight_position * x(3), 2);
value(1, 1) = std::pow(weight_position * x(3), 2);
value(2, 2) = std::pow(1e-2F, 2);
value(3, 3) = std::pow(weight_position * x(3), 2);
value(4, 4) = std::pow(weight_velocity * x(3), 2);
value(5, 5) = std::pow(weight_velocity * x(3), 2);
value(6, 6) = std::pow(1e-5F, 2);
value(7, 7) = std::pow(weight_velocity * x(3), 2);
value(0, 0) = std::powf(weight_position * x(3), 2);
value(1, 1) = std::powf(weight_position * x(3), 2);
value(2, 2) = std::powf(1e-2F, 2);
value(3, 3) = std::powf(weight_position * x(3), 2);
value(4, 4) = std::powf(weight_velocity * x(3), 2);
value(5, 5) = std::powf(weight_velocity * x(3), 2);
value(6, 6) = std::powf(1e-5F, 2);
value(7, 7) = std::powf(weight_velocity * x(3), 2);
return value;
}},
// R
Expand All @@ -79,10 +79,10 @@ using state = fcarouge::state<vector<8>>;
[](const state::type &x, [[maybe_unused]] const vector<4> &z) {
const float weight_position{1.F / 20.F};
matrix<float, 4, 4> value{zero<matrix<float, 4, 4>>};
value(0, 0) = std::pow(weight_position * x(3), 2);
value(1, 1) = std::pow(weight_position * x(3), 2);
value(2, 2) = std::pow(1e-1F, 2);
value(3, 3) = std::pow(weight_position * x(3), 2);
value(0, 0) = std::powf(weight_position * x(3), 2);
value(1, 1) = std::powf(weight_position * x(3), 2);
value(2, 2) = std::powf(1e-1F, 2);
value(3, 3) = std::powf(weight_position * x(3), 2);
return value;
}},
// The state transition F:
Expand Down

0 comments on commit e52397b

Please sign in to comment.