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

Support intersection between an Hpolytope and an ellipsoid #287

Open
wants to merge 205 commits into
base: develop
Choose a base branch
from

Conversation

TolisChal
Copy link
Member

@TolisChal TolisChal commented Nov 11, 2023

This PR:
i) Provides a new C++ class that represents the intersection between an Hpolytope and an ellipsoid,
ii) Implements C++ examples on how to sample from the intersection between an Hpolytope and an ellipsoid,
iii) Exposes to R the new class using a new Rcpp module,
iv) Implements R example on how to sample from the intersection between an Hpolytope and an ellipsoid,
v) Provides the Dirichlet's distribution oracles in C++,
vi) Provides C++ examples to sample from the Dirichlet distribution,
vii) Implements R examples on how to sample from the Dirichlet distribution.

Apostolos Chalkis and others added 19 commits October 16, 2023 16:10
* initialize nuts sampler class

* implement the burnin of nuts sampler

* add tests and resolve bugs

* implement e0 estimation in burnin of nuts

* optimize leapfrog

* integrate nuts into the R interface

* document random walk in sample_points.cpp in R interface

* fix burnin for the non-truncated case

* resolve bugs in hmc and nuts pipelines

* improve the preprocess in burin step of nuts

* split large lines in sample_points.cpp

* Add NUTS C++ example and update CMake (#29)

* resolve PR comments

* fix minor bug

* fix compiler bug

* fix error in building the C++ examples

* resolve warnings in sample_points

* fix lpsolve cran warning

* fix cran warning on mac

* improve lpsolve cmake for cran check

* fix R warning in mac test

* remove lpsolve header

* resolve PR comments

---------

Co-authored-by: Marios Papachristou <[email protected]>
Co-authored-by: Apostolos Chalkis <[email protected]>
@TolisChal TolisChal changed the title Support intersection between an Hpolytope and adn ellipsoid Support intersection between an Hpolytope and and ellipsoid Nov 12, 2023
@TolisChal TolisChal changed the title Support intersection between an Hpolytope and and ellipsoid Support intersection between an Hpolytope and an ellipsoid Nov 12, 2023
Copy link
Member

@vissarion vissarion 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 have a few comments.


/// This class represents a polytope intersected with an ellipsoid
/// \tparam Polytope Polytope Type
/// \tparam CEllipsoid Ellipsoid Type
Copy link
Member

Choose a reason for hiding this comment

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

why you call it CEllipsoid instead of just Ellipsoid?

/// \tparam Polytope Polytope Type
/// \tparam CEllipsoid Ellipsoid Type
template <typename Polytope, typename CEllipsoid>
class EllipsoidIntersectPolytope {
Copy link
Member

Choose a reason for hiding this comment

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

Why not inherit from BallIntersectPolytope class? A lot of methods are the same. Also do we need this class at all or we can just use BallIntersectPolytope for both ball and ellipsoid intersections? The only difference I see is in the last 3 methods.

*grad_data = ((params.a_vec.coeff(i) - NT(1)) / x.getCoefficients().coeff(i));
grad_data++;
}
Point y(grad);
Copy link
Member

Choose a reason for hiding this comment

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

Why are you creating a VT and then copy it to a Point instead of creating a Point and assign the desired values directly into it?

*grad_data = ((params.a_vec.coeff(i) - NT(1)) / x.getCoefficients().coeff(i));
grad_data++;
}
Point y(grad);
Copy link
Member

Choose a reason for hiding this comment

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

same here, is there a copy here? Can we avoid it?

template <typename NT>
static NT compute(EllipsoidIntersectPolytope<Polytope, Ellipsoid<Point>> &P)
{
return NT(1.5) * P.radius();
Copy link
Member

Choose a reason for hiding this comment

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

Where 1.5 comes from?

parameters() : order(2), L(2), m(2), kappa(1) {};

parameters(unsigned int order_) :
order(order),
Copy link
Member

Choose a reason for hiding this comment

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

you probably mean order(order_) here

// Copyright (c) 2018-2023 Apostolos Chalkis
// Copyright (c) 2020-2023 Elias Tsigaridas

// Contributed and/or modified by Ioannis Iakovidis, as part of Google Summer of
Copy link
Member

Choose a reason for hiding this comment

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

Is this a typo?

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

Successfully merging this pull request may close these issues.

None yet

3 participants