diff --git a/include/convex_bodies/hpolytope.h b/include/convex_bodies/hpolytope.h index bd13b4a97..979703137 100644 --- a/include/convex_bodies/hpolytope.h +++ b/include/convex_bodies/hpolytope.h @@ -573,61 +573,23 @@ class HPolytope { VT& Ar, VT& Av, NT const& lambda_prev, - VT& distances_vec, set_type& distances_set, AA_type const& AA, update_parameters& params) const { NT inner_prev = params.inner_vi_ak; - - // real Ar = Ar + params.moved_dist * Av - // real r = r + params.moved_dist * v - // real distances_vec = distances_vec - params.moved_dist NT* Av_data = Av.data(); - //NT* Ar_data = Ar.data(); - //NT* dvec_data = distances_vec.data(); const NT* b_data = b.data(); for (Eigen::SparseMatrix::InnerIterator it(AA, params.facet_prev); it; ++it) { - // NT old_Av = *(Av_data + it.row()); - *(Av_data + it.row()) += (-2.0 * inner_prev) * it.value(); - //*(Ar_data + it.row()) -= (-2.0 * inner_prev * params.moved_dist) * it.value(); - - //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()); - // *(dvec_data + it.row()) = (*(dvec_data + it.row()) - params.moved_dist) * old_Av / *(Av_data + it.row()) + params.moved_dist; - // *(dvec_data + it.row()) += (*(dvec_data + it.row()) - params.moved_dist) * 2.0 * inner_prev * it.value() / *(Av_data + it.row()); - NT val = distances_set.get_val(it.row()); val += (val - params.moved_dist) * 2.0 * inner_prev * it.value() / *(Av_data + it.row()); distances_set.change_val(it.row(), val, params.moved_dist); - - //if(*(dvec_data + it.row()) > params.moved_dist) - // distances_set.insert(std::make_pair(*(dvec_data + it.row()), it.row())); } - /* - std::cout << "got here post!!" << std::endl; - std::cout << std::endl; - std::cout << distances_set.heap_size << std::endl; - std::cout << params.moved_dist << std::endl; - std::cout << lambda_prev << std::endl; - for(int i = 0; i < num_of_hyperplanes(); ++i) { - std::cout << distances_set.heap[i].first << ' '; - } - std::cout << std::endl << std::endl;*/ - - /*auto it = distances_set.upper_bound(std::make_pair(-9999999, 0)); - - if(it == distances_set.end()) { - std::cout << "something went wrong when trying to get lowest positive value" << std::endl; - throw "all values from the set were negative"; - } - */ + std::pair ans = distances_set.get_min(); ans.first -= params.moved_dist; diff --git a/include/random_walks/uniform_accelerated_billiard_walk.hpp b/include/random_walks/uniform_accelerated_billiard_walk.hpp index 075f771e5..960871017 100644 --- a/include/random_walks/uniform_accelerated_billiard_walk.hpp +++ b/include/random_walks/uniform_accelerated_billiard_walk.hpp @@ -233,19 +233,12 @@ struct AcceleratedBilliardWalk _lambda_prev = dl * pbpair.first; if constexpr (std::is_same>::value) { _update_parameters.moved_dist = _lambda_prev; - //_distances_set.clear(); - _distances_vec.setZero(P.num_of_hyperplanes()); typename Point::Coeff b = P.get_vec(); NT* b_data = b.data(); - //NT* dvec_data = _distances_vec.data(); NT* Ar_data = _lambdas.data(); NT* Av_data = _Av.data(); for(int i = 0; i < P.num_of_hyperplanes(); ++i) { _distances_set.vec[i].first = ( *(b_data + i) - (*(Ar_data + i)) ) / (*(Av_data + i)); - //std::cout << _distances_set.vec[i].first << ' '; - //*(dvec_data + i) = ( *(b_data + i) - (*(Ar_data + i)) ) / (*(Av_data + i)); - //if(*(dvec_data + i) > _update_parameters.moved_dist) - // _distances_set.insert(std::make_pair(*(dvec_data + i), i)); } _distances_set.rebuild(_update_parameters.moved_dist); } else { @@ -259,7 +252,7 @@ struct AcceleratedBilliardWalk { std::pair pbpair; if constexpr (std::is_same>::value) { - pbpair = P.line_positive_intersect(_p, _lambdas, _Av, _lambda_prev, _distances_vec, + pbpair = P.line_positive_intersect(_p, _lambdas, _Av, _lambda_prev, _distances_set, _AA, _update_parameters); } else { pbpair = P.line_positive_intersect(_p, _v, _lambdas, _Av, _lambda_prev, @@ -450,9 +443,7 @@ struct AcceleratedBilliardWalk update_parameters _update_parameters; typename Point::Coeff _lambdas; typename Point::Coeff _Av; - typename Point::Coeff _distances_vec; Heap _distances_set; - //std::set> _distances_set; }; };