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

Position Nudging after Position Update #308

Merged
merged 9 commits into from
Jun 25, 2024

Conversation

vgnecula
Copy link
Contributor

Fixed the problem related to points being rendered outside due to float arithmetic computation during the update_position() function.

Copy link
Contributor

@vfisikop vfisikop left a comment

Choose a reason for hiding this comment

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

Thanks for this PR, I added a few comments.

//Nudging correction
NT eps = -1e-7;

NT eps_1 = -(*b_data - A.row(i) * p.getCoefficients());
Copy link
Contributor

Choose a reason for hiding this comment

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

This is already computed above.

NT eps = -1e-7;

NT eps_1 = -(*b_data - A.row(i) * p.getCoefficients());
MT A_nor = A;
Copy link
Contributor

Choose a reason for hiding this comment

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

You do not need to normalize the whole matrix A but only the violated facet.

@@ -105,6 +105,8 @@ struct Walk
_lambda_prev = pbpair.first;
T -= _lambda_prev;
update_position(_p, _v, _lambda_prev, _omega);
if(P.is_in(_p) != -1)
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to check if _p is in P, this is tested by nudge_in.

Copy link
Contributor

@vfisikop vfisikop left a comment

Choose a reason for hiding this comment

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

Thanks!

@@ -89,6 +89,9 @@ struct Walk
unsigned int n = P.dimension();
NT T;

//normalize the Polyope
P.normalize();
Copy link
Contributor

Choose a reason for hiding this comment

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

The walk should not (ideally) change the Polytope!
This is a design mistake since P should be a const &.
However, changing $P$ should be avoided.

@vgnecula vgnecula force-pushed the reflection_nudging branch 3 times, most recently from 383ed83 to 6dc3108 Compare June 16, 2024 01:08
row_norm = A.row(i).norm();
A.row(i) = A.row(i) / row_norm;
b(i) = b(i) / row_norm;
if(!is_normalized()){
Copy link
Contributor

Choose a reason for hiding this comment

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

please fix style and indentation here.

Comment on lines 242 to 250
MT A = P.get_mat();
VT b = P.get_vec();

int m = A.rows();
const NT* b_data = b.data();

for (int i = 0; i < m; i++) {

NT dist = *b_data - A.row(i) * p.getCoefficients();
Copy link
Member

Choose a reason for hiding this comment

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

You can do it as follows (because it is more efficient):

VT b_Ax = P.get_mat()p.getCoefficients();
NT
b_Ax_data() = b_Ax.data();

for (int = 0; i < m; i++) { // then dist = *b_Ax_data;

@vgnecula vgnecula force-pushed the reflection_nudging branch 2 times, most recently from f6bd5a9 to 95ee8e1 Compare June 24, 2024 03:35
@vissarion vissarion merged commit d076bf0 into GeomScale:develop Jun 25, 2024
25 of 27 checks passed
TolisChal pushed a commit that referenced this pull request Jul 7, 2024
* Position Nudging after Position Update

* Complexity improvements and Polytope Normalization

* HPolytope Normalization Flag

* Polytope normalization within Walk Constructor

* Alias HPolytope Normalization for Nudging inside Gaussian HMC

* Polytope Normalization in ComputeInner Ball Fixed

* Polytope Normalization Style change

* Nudge in function within Gaussian HMC, and restore Hpoly file

* More efficient Nudge in Process
TolisChal pushed a commit that referenced this pull request Jul 7, 2024
* Position Nudging after Position Update

* Complexity improvements and Polytope Normalization

* HPolytope Normalization Flag

* Polytope normalization within Walk Constructor

* Alias HPolytope Normalization for Nudging inside Gaussian HMC

* Polytope Normalization in ComputeInner Ball Fixed

* Polytope Normalization Style change

* Nudge in function within Gaussian HMC, and restore Hpoly file

* More efficient Nudge in Process
TolisChal pushed a commit to TolisChal/volume_approximation that referenced this pull request Jul 7, 2024
* Position Nudging after Position Update

* Complexity improvements and Polytope Normalization

* HPolytope Normalization Flag

* Polytope normalization within Walk Constructor

* Alias HPolytope Normalization for Nudging inside Gaussian HMC

* Polytope Normalization in ComputeInner Ball Fixed

* Polytope Normalization Style change

* Nudge in function within Gaussian HMC, and restore Hpoly file

* More efficient Nudge in Process
TolisChal pushed a commit to TolisChal/volume_approximation that referenced this pull request Jul 7, 2024
* Position Nudging after Position Update

* Complexity improvements and Polytope Normalization

* HPolytope Normalization Flag

* Polytope normalization within Walk Constructor

* Alias HPolytope Normalization for Nudging inside Gaussian HMC

* Polytope Normalization in ComputeInner Ball Fixed

* Polytope Normalization Style change

* Nudge in function within Gaussian HMC, and restore Hpoly file

* More efficient Nudge in Process
TolisChal pushed a commit to TolisChal/volume_approximation that referenced this pull request Jul 8, 2024
* Position Nudging after Position Update

* Complexity improvements and Polytope Normalization

* HPolytope Normalization Flag

* Polytope normalization within Walk Constructor

* Alias HPolytope Normalization for Nudging inside Gaussian HMC

* Polytope Normalization in ComputeInner Ball Fixed

* Polytope Normalization Style change

* Nudge in function within Gaussian HMC, and restore Hpoly file

* More efficient Nudge in Process
TolisChal pushed a commit to TolisChal/volume_approximation that referenced this pull request Jul 8, 2024
* Position Nudging after Position Update

* Complexity improvements and Polytope Normalization

* HPolytope Normalization Flag

* Polytope normalization within Walk Constructor

* Alias HPolytope Normalization for Nudging inside Gaussian HMC

* Polytope Normalization in ComputeInner Ball Fixed

* Polytope Normalization Style change

* Nudge in function within Gaussian HMC, and restore Hpoly file

* More efficient Nudge in Process
TolisChal pushed a commit to TolisChal/volume_approximation that referenced this pull request Jul 8, 2024
* Position Nudging after Position Update

* Complexity improvements and Polytope Normalization

* HPolytope Normalization Flag

* Polytope normalization within Walk Constructor

* Alias HPolytope Normalization for Nudging inside Gaussian HMC

* Polytope Normalization in ComputeInner Ball Fixed

* Polytope Normalization Style change

* Nudge in function within Gaussian HMC, and restore Hpoly file

* More efficient Nudge in Process
TolisChal pushed a commit that referenced this pull request Jul 17, 2024
* Position Nudging after Position Update

* Complexity improvements and Polytope Normalization

* HPolytope Normalization Flag

* Polytope normalization within Walk Constructor

* Alias HPolytope Normalization for Nudging inside Gaussian HMC

* Polytope Normalization in ComputeInner Ball Fixed

* Polytope Normalization Style change

* Nudge in function within Gaussian HMC, and restore Hpoly file

* More efficient Nudge in Process
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants