-
Notifications
You must be signed in to change notification settings - Fork 113
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
Conversation
There was a problem hiding this 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.
include/convex_bodies/hpolytope.h
Outdated
//Nudging correction | ||
NT eps = -1e-7; | ||
|
||
NT eps_1 = -(*b_data - A.row(i) * p.getCoefficients()); |
There was a problem hiding this comment.
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.
include/convex_bodies/hpolytope.h
Outdated
NT eps = -1e-7; | ||
|
||
NT eps_1 = -(*b_data - A.row(i) * p.getCoefficients()); | ||
MT A_nor = A; |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this 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(); |
There was a problem hiding this comment.
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
383ed83
to
6dc3108
Compare
include/convex_bodies/hpolytope.h
Outdated
row_norm = A.row(i).norm(); | ||
A.row(i) = A.row(i) / row_norm; | ||
b(i) = b(i) / row_norm; | ||
if(!is_normalized()){ |
There was a problem hiding this comment.
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.
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(); |
There was a problem hiding this comment.
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;
f6bd5a9
to
95ee8e1
Compare
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
Fixed the problem related to points being rendered outside due to float arithmetic computation during the update_position() function.