From c61c4bdaa77cc3a228438c83b335f13dac5fbb9b Mon Sep 17 00:00:00 2001 From: lucaperju Date: Wed, 7 Aug 2024 11:37:07 +0200 Subject: [PATCH] temporary fix to failing tests --- include/convex_bodies/hpolytope.h | 10 ++++++++-- .../random_walks/uniform_accelerated_billiard_walk.hpp | 8 ++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/include/convex_bodies/hpolytope.h b/include/convex_bodies/hpolytope.h index 6f9e7eaba..ccfa9ae1e 100644 --- a/include/convex_bodies/hpolytope.h +++ b/include/convex_bodies/hpolytope.h @@ -974,7 +974,7 @@ class HPolytope { normalized = true; } - void compute_reflection(Point& v, Point& p, int const& facet) const + void compute_reflection(Point& v, Point const&, int const& facet) const { v += -2 * v.dot(A.row(facet)) * A.row(facet); } @@ -1009,7 +1009,13 @@ class HPolytope { } template - void compute_reflection(Point &v, Point &p, update_parameters const& params) const { + void compute_reflection(Point &v, Point const&, update_parameters const& params) const { + Point a((-2.0 * params.inner_vi_ak) * A.row(params.facet_prev)); + v += a; + } + + template + void compute_reflection_abw(Point &v, Point &p, update_parameters const& params) const { if constexpr (std::is_same>::value) { // MT must be in RowMajor format NT* v_data = v.pointerToData(); NT* p_data = p.pointerToData(); diff --git a/include/random_walks/uniform_accelerated_billiard_walk.hpp b/include/random_walks/uniform_accelerated_billiard_walk.hpp index b0ee860a7..c593b9e6f 100644 --- a/include/random_walks/uniform_accelerated_billiard_walk.hpp +++ b/include/random_walks/uniform_accelerated_billiard_walk.hpp @@ -152,7 +152,7 @@ struct AcceleratedBilliardWalk _p += (_lambda_prev * _v); } T -= _lambda_prev; - P.compute_reflection(_v, _p, _update_parameters); + P.compute_reflection_abw(_v, _p, _update_parameters); it++; while (it < _rho) @@ -177,7 +177,7 @@ struct AcceleratedBilliardWalk _p += (_lambda_prev * _v); } T -= _lambda_prev; - P.compute_reflection(_v, _p, _update_parameters); + P.compute_reflection_abw(_v, _p, _update_parameters); it++; } _p += _update_parameters.moved_dist * _v; @@ -298,7 +298,7 @@ struct AcceleratedBilliardWalk _lambda_prev = dl * pbpair.first; _p += (_lambda_prev * _v); T -= _lambda_prev; - P.compute_reflection(_v, _p, _update_parameters); + P.compute_reflection_abw(_v, _p, _update_parameters); while (it <= _rho) { @@ -316,7 +316,7 @@ struct AcceleratedBilliardWalk _lambda_prev = dl * pbpair.first; _p += (_lambda_prev * _v); T -= _lambda_prev; - P.compute_reflection(_v, _p, _update_parameters); + P.compute_reflection_abw(_v, _p, _update_parameters); it++; } }