Skip to content

Commit

Permalink
resolve PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Apostolos Chalkis committed Jul 5, 2024
1 parent a32319e commit 9d5a13f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions include/preprocess/barrier_center_ellipsoid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
Note: Using MT as to deal with both dense and sparse matrices, MT_dense will be the type of result matrix
*/
template <typename MT_dense, int BarrierType, typename MT, typename VT, typename NT>
template <typename MT_dense, int BarrierType, typename NT, typename MT, typename VT>
std::tuple<MT_dense, VT, bool> barrier_center_ellipsoid_linear_ineq(MT const& A, VT const& b, VT const& x0,
unsigned int const max_iters = 500,
NT const grad_err_tol = 1e-08,
Expand Down Expand Up @@ -102,14 +102,14 @@ std::tuple<MT_dense, VT, bool> barrier_center_ellipsoid_linear_ineq(MT const& A
return std::make_tuple(MT_dense(H), x, converged);
}

template <typename MT_dense, int BarrierType, typename MT, typename VT, typename NT>
template <typename MT_dense, int BarrierType, typename NT, typename MT, typename VT>
std::tuple<MT_dense, VT, bool> barrier_center_ellipsoid_linear_ineq(MT const& A, VT const& b,
unsigned int const max_iters = 500,
NT const grad_err_tol = 1e-08,
NT const rel_pos_err_tol = 1e-12)
{
VT x0 = compute_feasible_point(A, b);
return barrier_center_ellipsoid_linear_ineq<MT_dense, BarrierType, MT, VT, NT>(A, b, x0, max_iters, grad_err_tol, rel_pos_err_tol);
return barrier_center_ellipsoid_linear_ineq<MT_dense, BarrierType>(A, b, x0, max_iters, grad_err_tol, rel_pos_err_tol);
}

#endif // BARRIER_CENTER_ELLIPSOID_HPP
2 changes: 1 addition & 1 deletion include/preprocess/inscribed_ellipsoid_rounding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ compute_inscribed_ellipsoid(Custom_MT A, VT b, VT const& x0,
} else if constexpr (ellipsoid_type == EllipsoidType::LOG_BARRIER ||
ellipsoid_type == EllipsoidType::VOLUMETRIC_BARRIER)
{
return barrier_center_ellipsoid_linear_ineq<MT, ellipsoid_type, Custom_MT, VT, NT>(A, b, x0);
return barrier_center_ellipsoid_linear_ineq<MT, ellipsoid_type, NT>(A, b, x0);
} else
{
std::runtime_error("Unknown rounding method.");
Expand Down
8 changes: 4 additions & 4 deletions test/test_internal_points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ void call_test_analytic_center() {
P = skinny_random_hpoly<Hpolytope, NT, PolyRNGType>(3, 15, pre_rounding, max_min_eig_ratio, 127);
P.normalize();

auto [Hessian, analytic_center, converged] = barrier_center_ellipsoid_linear_ineq<MT, EllipsoidType::LOG_BARRIER, MT, VT, NT>(P.get_mat(), P.get_vec());
auto [Hessian, analytic_center, converged] = barrier_center_ellipsoid_linear_ineq<MT, EllipsoidType::LOG_BARRIER, NT>(P.get_mat(), P.get_vec());

SpMT Asp = P.get_mat().sparseView();
auto [Hessian_sp, analytic_center2, converged2] = barrier_center_ellipsoid_linear_ineq<MT, EllipsoidType::LOG_BARRIER, SpMT, VT, NT>(Asp, P.get_vec());
auto [Hessian_sp, analytic_center2, converged2] = barrier_center_ellipsoid_linear_ineq<MT, EllipsoidType::LOG_BARRIER, NT>(Asp, P.get_vec());

CHECK(P.is_in(Point(analytic_center)) == -1);
CHECK(converged);
Expand Down Expand Up @@ -166,9 +166,9 @@ void call_test_volumetric_center() {
P = skinny_random_hpoly<Hpolytope, NT, PolyRNGType>(3, 15, pre_rounding, max_min_eig_ratio, 127);
P.normalize();

auto [Hessian, volumetric_center, converged] = barrier_center_ellipsoid_linear_ineq<MT, EllipsoidType::VOLUMETRIC_BARRIER, MT, VT, NT>(P.get_mat(), P.get_vec());
auto [Hessian, volumetric_center, converged] = barrier_center_ellipsoid_linear_ineq<MT, EllipsoidType::VOLUMETRIC_BARRIER, NT>(P.get_mat(), P.get_vec());
SpMT Asp = P.get_mat().sparseView();
auto [Hessian_sp, volumetric_center2, converged2] = barrier_center_ellipsoid_linear_ineq<MT, EllipsoidType::VOLUMETRIC_BARRIER, SpMT, VT, NT>(Asp, P.get_vec());
auto [Hessian_sp, volumetric_center2, converged2] = barrier_center_ellipsoid_linear_ineq<MT, EllipsoidType::VOLUMETRIC_BARRIER, NT>(Asp, P.get_vec());
CHECK(P.is_in(Point(volumetric_center)) == -1);
CHECK(converged);
CHECK(std::abs(volumetric_center(0) + 1.49031) < 1e-04);
Expand Down

0 comments on commit 9d5a13f

Please sign in to comment.