From 146c5d7efa6b722b6841a136d760d8e0cfdf90ac Mon Sep 17 00:00:00 2001 From: lucaperju Date: Wed, 7 Aug 2024 13:47:16 +0200 Subject: [PATCH] minor optimization --- include/convex_bodies/hpolytope.h | 5 +++-- include/random_walks/uniform_accelerated_billiard_walk.hpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/convex_bodies/hpolytope.h b/include/convex_bodies/hpolytope.h index f27e7c934..99036ef0c 100644 --- a/include/convex_bodies/hpolytope.h +++ b/include/convex_bodies/hpolytope.h @@ -570,9 +570,9 @@ class HPolytope { template std::pair line_positive_intersect(Point const& r, - Point const& v, VT& Ar, VT& Av, + NT const& lambda_prev, VT& distances_vec, set_type& distances_set, AA_type const& AA, @@ -593,7 +593,8 @@ class HPolytope { *(Av_data + it.row()) += (-2.0 * inner_prev) * it.value(); *(Ar_data + it.row()) -= (-2.0 * inner_prev * params.moved_dist) * it.value(); - distances_set.erase(std::make_pair(*(dvec_data + it.row()), it.row())); + if(*(dvec_data + it.row()) > params.moved_dist - lambda_prev) + distances_set.erase(std::make_pair(*(dvec_data + it.row()), it.row())); *(dvec_data + it.row()) = (*(b_data + it.row()) - *(Ar_data + it.row())) / *(Av_data + it.row()); diff --git a/include/random_walks/uniform_accelerated_billiard_walk.hpp b/include/random_walks/uniform_accelerated_billiard_walk.hpp index 604ff202e..76cf4c27f 100644 --- a/include/random_walks/uniform_accelerated_billiard_walk.hpp +++ b/include/random_walks/uniform_accelerated_billiard_walk.hpp @@ -159,7 +159,7 @@ struct AcceleratedBilliardWalk { std::pair pbpair; if constexpr (std::is_same>::value) { - pbpair = P.line_positive_intersect(_p, _v, _lambdas, _Av, _distances_vec, + pbpair = P.line_positive_intersect(_p, _lambdas, _Av, _lambda_prev, _distances_vec, _distances_set, _AA, _update_parameters); } else { pbpair = P.line_positive_intersect(_p, _v, _lambdas, _Av, _lambda_prev,