Skip to content

Commit 2915a69

Browse files
committed
Update example
1 parent ae45074 commit 2915a69

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/pyprob_cpp/test/test_set_defaults_and_addresses.cpp

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,30 @@ xt::xarray<double> forward()
99

1010
pyprob_cpp::setDefaultControl(true);
1111
pyprob_cpp::setDefaultReplace(false);
12-
1312
auto normal1 = pyprob_cpp::distributions::Normal(prior_mean, prior_stddev);
14-
auto mu1 = pyprob_cpp::sample(normal1, "mu1");
15-
mu1 = pyprob_cpp::sample(normal1, "mu1");
13+
xt::xarray<double> mu1;
14+
for (int i = 0; i < 2; i++)
15+
{
16+
mu1 = pyprob_cpp::sample(normal1, "mu1");
17+
}
1618

1719
pyprob_cpp::setDefaultControl(true);
1820
pyprob_cpp::setDefaultReplace(true);
19-
2021
auto normal2 = pyprob_cpp::distributions::Normal(mu1, prior_stddev);
21-
auto mu2 = pyprob_cpp::sample(normal2, "mu2");
22-
mu2 = pyprob_cpp::sample(normal2, "mu2");
22+
xt::xarray<double> mu2;
23+
for (int i = 0; i < 2; i++)
24+
{
25+
mu2 = pyprob_cpp::sample(normal2, "mu2");
26+
}
2327

2428
pyprob_cpp::setDefaultControl(false);
2529
pyprob_cpp::setDefaultReplace(false);
26-
2730
auto normal3 = pyprob_cpp::distributions::Normal(mu2, prior_stddev);
28-
auto mu3 = pyprob_cpp::sample(normal3, "mu3");
29-
mu3 = pyprob_cpp::sample(normal3, "mu3");
31+
xt::xarray<double> mu3;
32+
for (int i = 0; i < 2; i++)
33+
{
34+
mu3 = pyprob_cpp::sample(normal3, "mu3");
35+
}
3036

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

0 commit comments

Comments
 (0)