Skip to content

Commit 8fb2188

Browse files
committed
adjust example for paper
1 parent 515cb7f commit 8fb2188

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

examples/examples

-48 Bytes
Binary file not shown.

examples/svol_comparison.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// some template parameters
1212
#define dimstate 1
1313
#define dimobs 1
14-
#define numparts 5000
14+
#define numparts 100
1515
#define FLOATTYPE float // choose float (faster) or double (slower)
1616

1717

@@ -58,8 +58,12 @@ void run_svol_comparison(const std::string &csv)
5858
apfsvol.filter(data[row], v);
5959
sisrsvol.filter(data[row], v);
6060

61-
std::cout << bssvol.getExpectations()[0] << ", " << apfsvol.getExpectations()[0] << ", " << sisrsvol.getExpectations()[0] << "\n";
62-
//std::cout << bssvol.getLogCondLike() << ", " << apfsvol.getLogCondLike() <<", " << sisrsvol.getLogCondLike() << "\n";
61+
std::cout << bssvol.getExpectations()[0] << ", "
62+
<< apfsvol.getExpectations()[0] << ", "
63+
<< sisrsvol.getExpectations()[0] << ", "
64+
<< bssvol.getLogCondLike() << ", "
65+
<< apfsvol.getLogCondLike() << ", "
66+
<< sisrsvol.getLogCondLike() << "\n";
6367
}
6468

6569
}

include/auxiliary_pf.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ void APF<nparts, dimx, dimy, resamp_t, float_t>::filter(const osv &data, const s
176176

177177
if(m_now == 0)
178178
{
179-
float_t max(-1.0/0.0);
179+
float_t max(-std::numeric_limits<float_t>::infinity());
180180
for(size_t ii = 0; ii < nparts; ++ii)
181181
{
182182
// sample particles
@@ -227,8 +227,8 @@ void APF<nparts, dimx, dimy, resamp_t, float_t>::filter(const osv &data, const s
227227
// set up "first stage weights" to make k index sampler
228228
arrayfloat_t logFirstStageUnNormWeights = m_logUnNormWeights;
229229
arrayVec oldPartics = m_particles;
230-
float_t m3(-1.0/0.0);
231-
float_t m2(-1.0/0.0);
230+
float_t m3(-std::numeric_limits<float_t>::infinity());
231+
float_t m2(-std::numeric_limits<float_t>::infinity());
232232
for(size_t ii = 0; ii < nparts; ++ii)
233233
{
234234
// update m3
@@ -249,7 +249,7 @@ void APF<nparts, dimx, dimy, resamp_t, float_t>::filter(const osv &data, const s
249249
arrayUInt myKs = m_kGen.sample(logFirstStageUnNormWeights);
250250

251251
// now draw xts
252-
float_t m1(-1.0/0.0);
252+
float_t m1(-std::numeric_limits<float_t>::infinity());
253253
float_t first_cll_sum(0.0);
254254
float_t second_cll_sum(0.0);
255255
float_t third_cll_sum(0.0);
@@ -319,9 +319,5 @@ auto APF<nparts, dimx, dimy, resamp_t, float_t>::getExpectations() const -> std:
319319
return m_expectations;
320320
}
321321

322-
323-
324-
325-
326322
#endif //APF_H
327323

0 commit comments

Comments
 (0)