summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-25 16:24:44 +0000
committerredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-25 16:24:44 +0000
commit200e40a0beef1f8a5d808a7877d15f71d62aabf0 (patch)
treed2a61b3691c909d864aac9f4fa1b625e2157e7ed
parent9981b620b08704211d498c01a8808a3cc523fe2b (diff)
onemore
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@621 ec762483-ff6d-05da-a07a-a48fb63a330f
-rw-r--r--gi/clda/src/ccrp.h4
-rw-r--r--gi/clda/src/crp_test.cc1
2 files changed, 5 insertions, 0 deletions
diff --git a/gi/clda/src/ccrp.h b/gi/clda/src/ccrp.h
index 9b1c5284..eeccce1a 100644
--- a/gi/clda/src/ccrp.h
+++ b/gi/clda/src/ccrp.h
@@ -30,6 +30,10 @@ class CCRP {
return it->second.table_counts_.size();
}
+ unsigned num_customers() const {
+ return num_customers_;
+ }
+
// returns +1 or 0 indicating whether a new table was opened
int increment(const Dish& dish, const double& p0, MT19937* rng) {
DishLocations& loc = dish_locs_[dish];
diff --git a/gi/clda/src/crp_test.cc b/gi/clda/src/crp_test.cc
index 750d80a7..ed384f81 100644
--- a/gi/clda/src/crp_test.cc
+++ b/gi/clda/src/crp_test.cc
@@ -79,6 +79,7 @@ TEST_F(CRPTest, Exchangability) {
++hist[c];
tot += c;
}
+ EXPECT_EQ(cust, crp.num_customers());
cerr << "P(a) = " << (xt / samples) << endl;
cerr << "E[num tables] = " << (tot / samples) << endl;
double error = fabs((tot / samples) - 5.4);