Skip to content

Commit

Permalink
1118 Update of Damping not working with negative coefficients (#1119)
Browse files Browse the repository at this point in the history
remove cwiseMax to also update for negative damping coefficients.
  • Loading branch information
HenrZu authored Sep 3, 2024
1 parent d4ed967 commit a1028b5
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions cpp/memilio/epidemiology/damping.h
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,6 @@ void Dampings<S>::update_active_dampings(
});
//remove active with the same type and level and add new one
get<MatrixIdx>(sum_same_level) += get<MatrixIdx>(damping) - get<MatrixIdx>(active_same_type).get();
//avoid negative values due to rounding error if e.g. a previous damping is lifted
get<MatrixIdx>(sum_same_level) = get<MatrixIdx>(sum_same_level).cwiseMax(0.);
get<MatrixIdx>(active_same_type) = get<MatrixIdx>(damping);
}
else {
Expand Down

0 comments on commit a1028b5

Please sign in to comment.