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

Dikin, Vaidya, John walk #88

Merged
merged 25 commits into from
Sep 18, 2020
Merged

Conversation

AlexManochis
Copy link
Contributor

This PR includes c++ and R wrappers for the three c++ implementations of vaidya walk, dikin walk and john walk in https://github.com/rzrsk/vaidya-walk.

  1. I have modified the original c++ code to avoid the use of virtual classes.
  2. I have used the volesti c++ code structure to use the code from (1).
  3. I have implemented R wrappers in sample_points.cpp in R-proj/src folder.
  4. I have updated Rd files.

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 Alex for your PR! I have a few comments.

@@ -22,7 +24,8 @@
template <typename Polytope, typename RNGType, typename PointList, typename NT, typename Point>
void sample_from_polytope(Polytope &P, RNGType &rng, PointList &randPoints, unsigned int const& walkL, unsigned int const& numpoints,
bool const& gaussian, NT const& a, NT const& L, bool const& boundary, Point const& StartingPoint, unsigned int const& nburns,
bool const& set_L, bool const& cdhr, bool const& rdhr, bool const& billiard, bool const& ball_walk)
bool const& set_L, bool const& cdhr, bool const& rdhr, bool const& billiard, bool const& ball_walk, bool const& dikin,
Copy link
Member

Choose a reason for hiding this comment

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

please use at least an enum this list of bools is becoming too long

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I have implemented it.

// Eigen::Dynamic>& cons_A, const Eigen::Matrix<Dtype, Eigen::Dynamic, 1>& cons_b, const Dtype r) :
// Walker<Dtype>(initialization, cons_A, cons_b), r_(r){}

void init(const Eigen::Matrix<Dtype, Eigen::Dynamic, 1> &initialization, const Eigen::Matrix <Dtype,
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 at construction time ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I have removed the init function.


JohnWalker() {}

//JohnWalker(const Eigen::Matrix<Dtype, Eigen::Dynamic, 1> &initialization,
Copy link
Member

Choose a reason for hiding this comment

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

similar as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done as above

#include <boost/random.hpp>
#include <cmath>

//namespace pwalk {
Copy link
Member

Choose a reason for hiding this comment

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

if not used remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I have removed all unused comments

}

template <typename Dtype>
Dtype gaussian_density(const Eigen::Matrix<Dtype, Eigen::Dynamic, 1>& x, const Eigen::Matrix<Dtype, Eigen::Dynamic, 1>& mu, const Eigen::Matrix<Dtype, Eigen::Dynamic, Eigen::Dynamic>& sqrt_cov) {
Copy link
Member

Choose a reason for hiding this comment

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

too long line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wrapped it among others.

sample_gaussian<Dtype>(this->nb_dim_, 0., 1., gaussian_step);

// get hessian
Eigen::Matrix <Dtype, Eigen::Dynamic, Eigen::Dynamic> new_sqrt_inv_hess = Eigen::Matrix<Dtype, Eigen::Dynamic, Eigen::Dynamic>::Zero(
Copy link
Member

Choose a reason for hiding this comment

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

please wrap long lines

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I wrapped all long lines.

@vissarion vissarion added this to the 1.1.2 milestone Sep 18, 2020
@TolisChal TolisChal merged commit 0fad1ce into GeomScale:develop Sep 18, 2020
vissarion pushed a commit that referenced this pull request Oct 26, 2020
* implement dikin walk

* implement john walk

* implement vaidya walk

* include random walk

* add c++ wrappers for the ellipsoid random walks

* update R interface for sampling and parameterized ellipsoid walks

* update Rd files and roxygen comments

* implement PR comments

* use constructors in dikin,vaidya and john walks

* improve implementations

* improve computation of inner ball for H-polytopes

* improve inner ball computation and improve tests

* update termination criterions in rounding methods

* update Rd file of Birkhoff R generator

* improve univariate psrf implemetations

* fix c++ tests

* update parameters in rounding and minor improvements

* fix gcc tests and improve birkhoff generator Rd file

* fix c++ tests

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

Successfully merging this pull request may close these issues.

3 participants