Open
Conversation
Member
Author
vissarion
reviewed
Jan 28, 2026
| void operator-= (const T& other) | ||
| { | ||
| this->coeffs += coeffs; | ||
| if (other.rows() == 1 && other.cols() == d && d > 1) { |
Author
There was a problem hiding this comment.
I had initially put that in, keeping in mind this bit of code from hpolytope.h
void compute_reflection(Point& v, Point const&, int const& facet) const
{
v += -2 * v.dot(A.row(facet)) * A.row(facet);
}
to my knowledge, a row vector was being added to a column vector, which is why the tranpose was needed. But I tried it out, removing the check and it seems to work? perhaps it has something to do with how Eigen handles it, but yes, the check seems to not be necessary.
vissarion
reviewed
Jan 28, 2026
Member
vissarion
left a comment
There was a problem hiding this comment.
It is not clear where are the implementations of template overloads for operators.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Optimize point class arithmetic
Summary
This PR introduces significant performance optimizations to the core
pointclass.Changes
Performance Optimizations
File:
include/cartesian_geom/point.h1-> (
squared_length):return length() * length()withreturn coeffs.squaredNorm().2->(Overloading):
operator+=andoperator-=that acceptEigen::MatrixBase<Derived>.From running the benchmarks, I have found there to be a speedup of about 10% ( 9~12), which i think is pretty significant for some of the much heavier computations that occur.
Adresses #434
Currently this runs into an issue with two tests:
1: volume_cg_hpolytope_simplex
2: test_max_ball_sparse
The reason for the issue is that the previous implementation required a temp variable to be created when doing a step like a+= bc. Here, bc used to be temporarily stored and then added to a. This causes two rounding operations: one during the b*c process and one during the addition. In a sense, this was less accurate.
The change I have made now only does one rounding operation, but due to this, the values don't match what the tests are expecting.
@vissarion, how would you suggest moving forward with this?