Skip to content

Commit

Permalink
Update example
Browse files Browse the repository at this point in the history
  • Loading branch information
gbaydin committed Sep 19, 2018
1 parent ae45074 commit 2915a69
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/pyprob_cpp/test/test_set_defaults_and_addresses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,30 @@ xt::xarray<double> forward()

pyprob_cpp::setDefaultControl(true);
pyprob_cpp::setDefaultReplace(false);

auto normal1 = pyprob_cpp::distributions::Normal(prior_mean, prior_stddev);
auto mu1 = pyprob_cpp::sample(normal1, "mu1");
mu1 = pyprob_cpp::sample(normal1, "mu1");
xt::xarray<double> mu1;
for (int i = 0; i < 2; i++)
{
mu1 = pyprob_cpp::sample(normal1, "mu1");
}

pyprob_cpp::setDefaultControl(true);
pyprob_cpp::setDefaultReplace(true);

auto normal2 = pyprob_cpp::distributions::Normal(mu1, prior_stddev);
auto mu2 = pyprob_cpp::sample(normal2, "mu2");
mu2 = pyprob_cpp::sample(normal2, "mu2");
xt::xarray<double> mu2;
for (int i = 0; i < 2; i++)
{
mu2 = pyprob_cpp::sample(normal2, "mu2");
}

pyprob_cpp::setDefaultControl(false);
pyprob_cpp::setDefaultReplace(false);

auto normal3 = pyprob_cpp::distributions::Normal(mu2, prior_stddev);
auto mu3 = pyprob_cpp::sample(normal3, "mu3");
mu3 = pyprob_cpp::sample(normal3, "mu3");
xt::xarray<double> mu3;
for (int i = 0; i < 2; i++)
{
mu3 = pyprob_cpp::sample(normal3, "mu3");
}

auto likelihood = pyprob_cpp::distributions::Normal(mu3, likelihood_stddev);
pyprob_cpp::observe(likelihood, "obs");
Expand Down

0 comments on commit 2915a69

Please sign in to comment.