Baseline Flop Count Update, New Float Baseline

This commit is contained in:
[Quy Anh] «Elliot» Nguyen
2026-05-23 20:50:59 +02:00
committed by Ahmed Kallala
parent 40f4421d60
commit 43e54871df
18 changed files with 241860 additions and 68 deletions
+23 -13
View File
@@ -35,9 +35,21 @@ using namespace std;
// forces.cpp
// Flop count: 2 ADDs, 5 MULTs, 1 SQRT
double w(Vector2d e, Vector2d f) {
if (e.dot(f) >= f.norm() * cos_phi)
// Flop count: 2 ADDs, 6 MULTs
double w_ped(Vector2d e, Vector2d f) {
double f_norm_sq = f.dot(f);
double rhs = f_norm_sq * cos_phi_sq;
double e_dot_f = e.dot(f);
double e_dot_f_sq = e_dot_f * e_dot_f;
if (e_dot_f >= 0.0 || e_dot_f_sq <= rhs)
return dt_neg;
else
return c_neg_times_dt;
}
double w_obstacle(Vector2d e, Vector2d f) {
double e_dot_f = (f.y == 0) ? 0 : (f.y < 0 ? -e.y : e.y);
if (e_dot_f >= cos_phi)
return dt_neg;
else
return c_neg_times_dt;
@@ -57,7 +69,7 @@ Vector2d acceleration_term_dt(const Pedestrian &alpha) {
return f_alpha_0_dt;
}
// Flop count: 12 ADDs, 23 MULTs, 1 DIV, 4 SQRTs, 1 EXP
// Flop count: 12 ADDs, 24 MULTs, 1 DIV, 3 SQRTs, 1 EXP
Vector2d pedestrian_repulsion_dt(const Pedestrian &alpha, const Pedestrian &beta) {
// # 2 ADDs
@@ -129,16 +141,16 @@ Vector2d pedestrian_repulsion_dt(const Pedestrian &alpha, const Pedestrian &beta
//
Vector2d f_alpha_beta_neg = r_ab * scalar_mult_r_ab + r_ab2 * scalar_mult_r_ab2;
// # 2 ADDs, 7 MULTs, 1 SQRT
// # 2 ADDs, 8 MULTs
//
// $\vec{F}_{\alpha\beta}(\vec{e}_{\alpha}, \vec{r}_{\alpha \beta}).dt = w(\vec{e}_{\alpha}, -\vec{f}_{\alpha\beta}(\vec{r}_{\alpha \beta})).\vec{f}_{\alpha\beta}(\vec{r}_{\alpha \beta}).dt$
//
Vector2d f_alpha_beta_dt = f_alpha_beta_neg * w(alpha.e, f_alpha_beta_neg);
Vector2d f_alpha_beta_dt = f_alpha_beta_neg * w_ped(alpha.e, f_alpha_beta_neg);
return f_alpha_beta_dt;
}
// Flop count: 10 ADDs, 18 MULTs, 1 DIVs, 2 SQRTs, 1 EXP
// Flop count: 8 ADDs, 13 MULTs, 1 DIV, 1 SQRT, 1 EXP
Vector2d obstacle_repulsion_dt(const Pedestrian &alpha, const Obstacle &B) {
// # 7 ADDs, 5 MULTs
@@ -162,11 +174,11 @@ Vector2d obstacle_repulsion_dt(const Pedestrian &alpha, const Obstacle &B) {
//
Vector2d f_alpha_B_neg = r_aB * scalar_mult;
// # 2 ADDs, 7 MULTs, 1 SQRT
// # 2 MULTs
//
// $\vec{F}_{\alpha B}(\vec{e}_{\alpha}, \vec{r}_{\alpha B}).dt = w(\vec{e}_{\alpha}, -\vec{F}_{\alpha B}(\vec{r}_{\alpha B})).\vec{F}_{\alpha B}(\vec{r}_{\alpha B}).dt$
//
Vector2d f_alpha_B_dt = f_alpha_B_neg * w(alpha.e, f_alpha_B_neg);
Vector2d f_alpha_B_dt = f_alpha_B_neg * w_obstacle(alpha.e, f_alpha_B_neg);
return f_alpha_B_dt;
}
@@ -280,8 +292,7 @@ int run_simulation(Pedestrian *pedestrians, Board &board, int n_p, int n_iter, c
//
Vector2d f_alpha_dt = acceleration_term_dt(p);
// # (N-1) * (12 ADDs, 23 MULTs, 1 DIV, 4 SQRTs, 1 EXP)
// + (N-1) * 2 ADDs
// # (N-1) * (14 ADDs, 24 MULTs, 1 DIV, 3 SQRTs, 1 EXP)
//
// $\sum_{\beta} \vec{F}_{\alpha\beta}(\vec{e}_{\alpha},\vec{r}_{\alpha} - \vec{r}_{\beta})$
//
@@ -292,8 +303,7 @@ int run_simulation(Pedestrian *pedestrians, Board &board, int n_p, int n_iter, c
f_alpha_dt += pedestrian_repulsion_dt(p, pedestrians[j]);
}
// # board.n_obstacles * (10 ADDs, 18 MULTs, 1 DIV, 2 SQRTs, 1 EXP)
// + board.n_obstacles * 2 ADDs
// # board.n_obstacles * (10 ADDs, 13 MULTs, 1 DIV, 1 SQRT, 1 EXP)
//
// $\sum_{B} \vec{F}_{\alpha B}(\vec{e}_{\alpha}, \vec{r}_{\alpha} - \vec{r}_{B})$
//