Skip to content

fix no_multiphase sampling interface #116

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions dingo/bindings/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,50 +112,50 @@ double HPolytopeCPP::apply_sampling(int walk_len,

NT variance = variance_value;

if (strcmp(method, "cdhr")) { // cdhr
if (strcmp(method, "cdhr") == 0) { // cdhr
uniform_sampling<CDHRWalk>(rand_points, HP, rng, walk_len, number_of_points,
starting_point, number_of_points_to_burn);
} else if (strcmp(method, "rdhr")) { // rdhr
} else if (strcmp(method, "rdhr") == 0) { // rdhr
uniform_sampling<RDHRWalk>(rand_points, HP, rng, walk_len, number_of_points,
starting_point, number_of_points_to_burn);
} else if (strcmp(method, "billiard_walk")) { // accelerated_billiard
} else if (strcmp(method, "billiard_walk") == 0) { // accelerated_billiard
uniform_sampling<AcceleratedBilliardWalk>(rand_points, HP, rng, walk_len,
number_of_points, starting_point,
number_of_points_to_burn);
} else if (strcmp(method, "ball_walk")) { // ball walk
} else if (strcmp(method, "ball_walk") == 0) { // ball walk
uniform_sampling<BallWalk>(rand_points, HP, rng, walk_len, number_of_points,
starting_point, number_of_points_to_burn);
} else if (strcmp(method, "dikin_walk")) { // dikin walk
} else if (strcmp(method, "dikin_walk") == 0) { // dikin walk
uniform_sampling<DikinWalk>(rand_points, HP, rng, walk_len, number_of_points,
starting_point, number_of_points_to_burn);
} else if (strcmp(method, "john_walk")) { // john walk
} else if (strcmp(method, "john_walk") == 0) { // john walk
uniform_sampling<JohnWalk>(rand_points, HP, rng, walk_len, number_of_points,
starting_point, number_of_points_to_burn);
} else if (strcmp(method, "vaidya_walk")) { // vaidya walk
} else if (strcmp(method, "vaidya_walk") == 0) { // vaidya walk
uniform_sampling<VaidyaWalk>(rand_points, HP, rng, walk_len, number_of_points,
starting_point, number_of_points_to_burn);
} else if (strcmp(method, "mmcs")) { // vaidya walk
} else if (strcmp(method, "mmcs") == 0) { // vaidya walk
MT S;
int total_ess;
//TODO: avoid passing polytopes as non-const references
const Hpolytope HP_const = HP;
mmcs(HP_const, ess, S, total_ess, walk_len, rng);
samples = S.data();
} else if (strcmp(method, "gaussian_hmc_walk")) { // Gaussian sampling with exact HMC walk
} else if (strcmp(method, "gaussian_hmc_walk") == 0) { // Gaussian sampling with exact HMC walk
NT a = NT(1)/(NT(2)*variance);
gaussian_sampling<GaussianHamiltonianMonteCarloExactWalk>(rand_points, HP, rng, walk_len, number_of_points, a,
starting_point, number_of_points_to_burn);
} else if (strcmp(method, "exponential_hmc_walk")) { // exponential sampling with exact HMC walk
} else if (strcmp(method, "exponential_hmc_walk") == 0) { // exponential sampling with exact HMC walk
VT c(d);
for (int i = 0; i < d; i++){
c(i) = bias_vector_[i];
}
Point bias_vector(c);
exponential_sampling<ExponentialHamiltonianMonteCarloExactWalk>(rand_points, HP, rng, walk_len, number_of_points, bias_vector, variance,
starting_point, number_of_points_to_burn);
} else if (strcmp(method, "hmc_leapfrog_gaussian")) { // HMC with Gaussian distribution
} else if (strcmp(method, "hmc_leapfrog_gaussian") == 0) { // HMC with Gaussian distribution
rand_points = hmc_leapfrog_gaussian(walk_len, number_of_points, number_of_points_to_burn, variance, starting_point, HP);
} else if (strcmp(method, "hmc_leapfrog_exponential")) { // HMC with exponential distribution
} else if (strcmp(method, "hmc_leapfrog_exponential") == 0) { // HMC with exponential distribution
VT c(d);
for (int i = 0; i < d; i++) {
c(i) = bias_vector_[i];
Expand All @@ -170,7 +170,7 @@ double HPolytopeCPP::apply_sampling(int walk_len,
throw std::runtime_error("This function must not be called.");
}

if (!strcmp(method, "mmcs")) {
if (strcmp(method, "mmcs") != 0) {
// The following block of code allows us to copy the sampled points
auto n_si=0;
for (auto it_s = rand_points.cbegin(); it_s != rand_points.cend(); it_s++){
Expand Down