Skip to content

Commit

Permalink
remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaperju committed Aug 8, 2024
1 parent 76f1a63 commit 67b0e0e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 49 deletions.
40 changes: 1 addition & 39 deletions include/convex_bodies/hpolytope.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<double>::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<NT, int> ans = distances_set.get_min();
ans.first -= params.moved_dist;

Expand Down
11 changes: 1 addition & 10 deletions include/random_walks/uniform_accelerated_billiard_walk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,19 +233,12 @@ struct AcceleratedBilliardWalk
_lambda_prev = dl * pbpair.first;
if constexpr (std::is_same<MT, Eigen::SparseMatrix<NT, Eigen::RowMajor>>::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 {
Expand All @@ -259,7 +252,7 @@ struct AcceleratedBilliardWalk
{
std::pair<NT, int> pbpair;
if constexpr (std::is_same<MT, Eigen::SparseMatrix<NT, Eigen::RowMajor>>::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,
Expand Down Expand Up @@ -450,9 +443,7 @@ struct AcceleratedBilliardWalk
update_parameters _update_parameters;
typename Point::Coeff _lambdas;
typename Point::Coeff _Av;
typename Point::Coeff _distances_vec;
Heap<NT> _distances_set;
//std::set<std::pair<NT, int>> _distances_set;
};

};
Expand Down

0 comments on commit 67b0e0e

Please sign in to comment.