Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sparse optimizations for UniformABW sampling #329

Merged
merged 15 commits into from
Aug 21, 2024

Conversation

lucaperju
Copy link
Contributor

@lucaperju lucaperju commented Aug 7, 2024

optimized the complexity of the reflection when the A matrix is sparse

Sampled 1000 points from the same order polytope with the same seed using both sparse and dense abw, here are the last 2 points:
Dense:
0.947133 0.13444 0.417853 0.499325 0.995814 0.775422 0.728527 0.715522 0.0377974 0.428896
0.708553 0.119995 0.224509 0.549352 0.919391 0.649939 0.648627 0.55607 0.0863634 0.500581

Sparse:
0.947133 0.13444 0.417853 0.499325 0.995814 0.775422 0.728527 0.715522 0.0377974 0.428896
0.708553 0.119995 0.224509 0.549352 0.919391 0.649939 0.648627 0.55607 0.0863634 0.500581

points_sparse.txt
points_dense.txt

Comment on lines 599 to 602
/*if(ans.first < 0.00000001) {
std::cout << "distance of 0 found" << std::endl;
exit(0);
}*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need these lines?

const double eps = 0.000000001;

template<typename NT>
class Heap {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to rename it to BoundaryOracleHeap?

Comment on lines 244 to 245
typename Point::Coeff b = P.get_vec();
NT* b_data = b.data();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since be the vector b doesn't change, why don't you initialize the b_data before the loop?

const double eps = 0.000000001;

template<typename NT>
class Heap {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a few lines of comments to briefly explain what does this data structure does?
You could add what is the improvement it gives regarding the previous implementation.
Don't be afraid to add some equations to help your explanation, e.g., how Av and Ar are updated now etc.

@TolisChal
Copy link
Member

Hi @lucaperju! This is a really high quality PR! Thanks a lot!

  1. I left a few comments on your changes.
  2. Could you please copy paste in the description of this PR the results of an example that shows that the new implementation gives the same result with the previous one? For example, fix the seed and sample 1000 points from a 10-th dimensional order polytope with the current implementation and this new implementation. Print the last 10 points sampled from each polytope to the description of this PR. Also attach the txt files that contain the samples and add a script (in any programming language) that does an epsilon equality check for all points. Does this make sense?

@TolisChal TolisChal closed this Aug 15, 2024
@TolisChal TolisChal reopened this Aug 15, 2024
Copy link

codecov bot commented Aug 15, 2024

Codecov Report

Attention: Patch coverage is 75.23810% with 26 lines in your changes missing coverage. Please review.

Project coverage is 57.32%. Comparing base (d424f3e) to head (fe5641d).

Files Patch % Lines
...random_walks/uniform_accelerated_billiard_walk.hpp 74.69% 4 Missing and 17 partials ⚠️
include/convex_bodies/hpolytope.h 77.27% 0 Missing and 5 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #329      +/-   ##
===========================================
+ Coverage    56.95%   57.32%   +0.37%     
===========================================
  Files          114      114              
  Lines         7155     7241      +86     
  Branches      3215     3236      +21     
===========================================
+ Hits          4075     4151      +76     
+ Misses         978      976       -2     
- Partials      2102     2114      +12     
Files Coverage Δ
include/preprocess/rounding_util_functions.hpp 58.62% <ø> (ø)
...andom_walks/gaussian_accelerated_billiard_walk.hpp 61.47% <ø> (ø)
include/convex_bodies/hpolytope.h 76.64% <77.27%> (+1.24%) ⬆️
...random_walks/uniform_accelerated_billiard_walk.hpp 64.84% <74.69%> (+8.84%) ⬆️

... and 2 files with indirect coverage changes

#include <set>
#include <vector>

const double eps = 0.0000000001;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use scientifuc notation of const double eps = 1e-XY

@TolisChal TolisChal merged commit c1a724c into GeomScale:develop Aug 21, 2024
25 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants