-
Notifications
You must be signed in to change notification settings - Fork 122
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
ReHMC support for spectrahedra and general convex bodies with refactored Spectrahedra classes #194
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #194 +/- ##
===========================================
- Coverage 55.83% 55.44% -0.40%
===========================================
Files 64 85 +21
Lines 3845 4801 +956
Branches 1687 2107 +420
===========================================
+ Hits 2147 2662 +515
- Misses 732 889 +157
- Partials 966 1250 +284
|
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 have some comments.
Regarding coverage I think you should ask more tests to cover your code, then codecov will not complain.
Also, do you agree to merge #190 before this PR? Then your examples here could be simplified.
|
||
// get the minimum positive eigenvalue of At^2 + Bt + C | ||
EigenvaluesProblems<NT, MT, VT> quadraticEigenvaluesProblem; | ||
NT distance = quadraticEigenvaluesProblem.minPosQuadraticEigenvalue(precomputedValues.A, precomputedValues.B, | ||
NT distance = EigenvaluesProblem.minPosQuadraticEigenvalue(precomputedValues.A, precomputedValues.B, | ||
precomputedValues.C, precomputedValues.X, |
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.
indentation seems wrong after this
struct PrecomputationOfValues { | ||
|
||
/// These flags indicate whether the corresponding matrices are computed | ||
/// if yes, we can use them and not compute them fro scratch |
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.
OK I understand that the use of flags is not the intent of this PR but why not including a TODO in the comments to avoid the use of flags in the future?
@@ -28,6 +28,8 @@ void print_diagnostics(MT const& samples, unsigned int &min_ess, StreamType &str | |||
VT ess = effective_sample_size<NT, VT, MT>(samples, min_ess); | |||
VT intv_psrf = interval_psrf<VT, NT, MT>(samples); | |||
|
|||
//std::cout << "interval_psrf = " << intv_psrf.maxCoeff() << "us" << std::endl; |
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.
is this needed?
|
||
#include <../../external/arpack++/include/arssym.h> | ||
//#include <../../external/arpack++/include/arssym.h> |
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.
leftover?
/// ARPACK++ standard eigenvalues solver | ||
#define ARPACK_EIGENVALUES_SOLVER | ||
//#define ARPACK_EIGENVALUES_SOLVER |
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.
leftover?
/// Samples random points from the spectrahedron from the Boltzmann distribution | ||
/// \param[in] spectrahedron A spectrahedron | ||
/// \param[in] interiorPoint A point in the interior of the spectrahedron | ||
/// \param[in] pointsNum The number of points to sample | ||
/// \param[out] points The list of the sampled points | ||
/// \tparam Point class Point with NT and VT as declared above in this class | ||
template <typename Point> | ||
void apply(SPECTRAHEDRON &spectrahedron, Point const & interiorPoint, const unsigned int pointsNum, | ||
void apply(ConvexBody &spectrahedron, Point const & interiorPoint, const unsigned int pointsNum, |
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 parameter name should be renamed as well, right? From spectahedron
to convexbody
/// \tparam Point | ||
template <typename Point> | ||
void getNextPoint(SPECTRAHEDRON &spectrahedron, VT &p, PrecomputedValues &precomputedValues) { | ||
void getNextPoint(ConvexBody &spectrahedron, VT &p) { |
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.
here as above
test/LpSolve.cmake
Outdated
@@ -0,0 +1,41 @@ | |||
function(GetLpSolve) |
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.
is this lpsolve related change needed in the tests?
test/logconcave_sampling_test.cpp
Outdated
typedef Eigen::Matrix <NT, Eigen::Dynamic, Eigen::Dynamic> MT; | ||
typedef Cartesian<NT> Kernel; | ||
typedef typename Kernel::Point Point; | ||
typedef Spectrahedron <Point> SPECTRAHEDRON; |
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.
to inline with the current writing typedef Spectrahedron<Point> Spectrahedron
test/logconcave_sampling_test.cpp
Outdated
void call_test_benchmark_spectrahedra_grid_search() { | ||
|
||
typedef Eigen::Matrix<NT, Eigen::Dynamic, 1> VT; | ||
typedef Eigen::Matrix <NT, Eigen::Dynamic, Eigen::Dynamic> MT; |
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 space needed after Matrix
Resolve PR comments and update tests
Resolve cran test errors
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, I am OK with merging. Coverage can be improved, but in a future PR that will handle spectahedra better.
Combines the following 2 PRs on a new PR with a renamed branch: