summaryrefslogtreecommitdiff
path: root/dpmert
diff options
context:
space:
mode:
authorPatrick Simianer <simianer@cl.uni-heidelberg.de>2012-04-07 16:58:55 +0200
committerPatrick Simianer <simianer@cl.uni-heidelberg.de>2012-04-07 16:58:55 +0200
commite91553ae70907e243a554e4a549c53df57b78478 (patch)
treea4d044093f5937d0152b573c99914746b5a2b8ef /dpmert
parentfb714888562845a8ae10fd4411cf199961193833 (diff)
parent2fe4323cbfc34de906a2869f98c017b41e4ccae7 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'dpmert')
-rw-r--r--dpmert/ces.cc3
-rw-r--r--dpmert/lo_test.cc13
-rw-r--r--dpmert/mert_geometry.cc15
3 files changed, 14 insertions, 17 deletions
diff --git a/dpmert/ces.cc b/dpmert/ces.cc
index a85454da..c6cb1cdf 100644
--- a/dpmert/ces.cc
+++ b/dpmert/ces.cc
@@ -11,7 +11,6 @@
#include "error_surface.h"
#include "ns.h"
-using boost::shared_ptr;
using namespace std;
const bool minimize_segments = true; // if adjacent segments have equal scores, merge them
@@ -22,7 +21,7 @@ void ComputeErrorSurface(const SegmentEvaluator& ss,
const EvaluationMetric* metric,
const Hypergraph& hg) {
vector<WordID> prev_trans;
- const vector<shared_ptr<MERTPoint> >& ienv = ve.GetSortedSegs();
+ const vector<boost::shared_ptr<MERTPoint> >& ienv = ve.GetSortedSegs();
env->resize(ienv.size());
SufficientStats prev_score; // defaults to 0
int j = 0;
diff --git a/dpmert/lo_test.cc b/dpmert/lo_test.cc
index d9b909b8..5d90aabb 100644
--- a/dpmert/lo_test.cc
+++ b/dpmert/lo_test.cc
@@ -19,7 +19,6 @@
#include "line_optimizer.h"
using namespace std;
-using boost::shared_ptr;
class OptTest : public testing::Test {
protected:
@@ -44,12 +43,12 @@ TEST_F(OptTest, TestCheckNaN) {
}
TEST_F(OptTest,TestConvexHull) {
- shared_ptr<MERTPoint> a1(new MERTPoint(-1, 0));
- shared_ptr<MERTPoint> b1(new MERTPoint(1, 0));
- shared_ptr<MERTPoint> a2(new MERTPoint(-1, 1));
- shared_ptr<MERTPoint> b2(new MERTPoint(1, -1));
- vector<shared_ptr<MERTPoint> > sa; sa.push_back(a1); sa.push_back(b1);
- vector<shared_ptr<MERTPoint> > sb; sb.push_back(a2); sb.push_back(b2);
+ boost::shared_ptr<MERTPoint> a1(new MERTPoint(-1, 0));
+ boost::shared_ptr<MERTPoint> b1(new MERTPoint(1, 0));
+ boost::shared_ptr<MERTPoint> a2(new MERTPoint(-1, 1));
+ boost::shared_ptr<MERTPoint> b2(new MERTPoint(1, -1));
+ vector<boost::shared_ptr<MERTPoint> > sa; sa.push_back(a1); sa.push_back(b1);
+ vector<boost::shared_ptr<MERTPoint> > sb; sb.push_back(a2); sb.push_back(b2);
ConvexHull a(sa);
cerr << a << endl;
ConvexHull b(sb);
diff --git a/dpmert/mert_geometry.cc b/dpmert/mert_geometry.cc
index 81b25af9..d6973658 100644
--- a/dpmert/mert_geometry.cc
+++ b/dpmert/mert_geometry.cc
@@ -4,13 +4,12 @@
#include <limits>
using namespace std;
-using boost::shared_ptr;
ConvexHull::ConvexHull(int i) {
if (i == 0) {
// do nothing - <>
} else if (i == 1) {
- points.push_back(shared_ptr<MERTPoint>(new MERTPoint(0, 0, 0, shared_ptr<MERTPoint>(), shared_ptr<MERTPoint>())));
+ points.push_back(boost::shared_ptr<MERTPoint>(new MERTPoint(0, 0, 0, boost::shared_ptr<MERTPoint>(), boost::shared_ptr<MERTPoint>())));
assert(this->IsMultiplicativeIdentity());
} else {
cerr << "Only can create ConvexHull semiring 0 and 1 with this constructor!\n";
@@ -27,7 +26,7 @@ const ConvexHull ConvexHullWeightFunction::operator()(const Hypergraph::Edge& e)
ostream& operator<<(ostream& os, const ConvexHull& env) {
os << '<';
- const vector<shared_ptr<MERTPoint> >& points = env.GetSortedSegs();
+ const vector<boost::shared_ptr<MERTPoint> >& points = env.GetSortedSegs();
for (int i = 0; i < points.size(); ++i)
os << (i==0 ? "" : "|") << "x=" << points[i]->x << ",b=" << points[i]->b << ",m=" << points[i]->m << ",p1=" << points[i]->p1 << ",p2=" << points[i]->p2;
return os << '>';
@@ -37,7 +36,7 @@ ostream& operator<<(ostream& os, const ConvexHull& env) {
#ifdef ORIGINAL_MERT_IMPLEMENTATION
struct SlopeCompare {
- bool operator() (const shared_ptr<MERTPoint>& a, const shared_ptr<MERTPoint>& b) const {
+ bool operator() (const boost::shared_ptr<MERTPoint>& a, const boost::shared_ptr<MERTPoint>& b) const {
return a->m < b->m;
}
};
@@ -93,7 +92,7 @@ const ConvexHull& ConvexHull::operator*=(const ConvexHull& other) {
if (this->IsEdgeEnvelope()) {
// if (other.size() > 1)
// cerr << *this << " (TIMES) " << other << endl;
- shared_ptr<MERTPoint> edge_parent = points[0];
+ boost::shared_ptr<MERTPoint> edge_parent = points[0];
const double& edge_b = edge_parent->b;
const double& edge_m = edge_parent->m;
points.clear();
@@ -102,13 +101,13 @@ const ConvexHull& ConvexHull::operator*=(const ConvexHull& other) {
const double m = p.m + edge_m;
const double b = p.b + edge_b;
const double& x = p.x; // x's don't change with *
- points.push_back(shared_ptr<MERTPoint>(new MERTPoint(x, m, b, edge_parent, other.points[i])));
+ points.push_back(boost::shared_ptr<MERTPoint>(new MERTPoint(x, m, b, edge_parent, other.points[i])));
assert(points.back()->p1->edge);
}
// if (other.size() > 1)
// cerr << " = " << *this << endl;
} else {
- vector<shared_ptr<MERTPoint> > new_points;
+ vector<boost::shared_ptr<MERTPoint> > new_points;
int this_i = 0;
int other_i = 0;
const int this_size = points.size();
@@ -124,7 +123,7 @@ const ConvexHull& ConvexHull::operator*=(const ConvexHull& other) {
const double m = this_point.m + other_point.m;
const double b = this_point.b + other_point.b;
- new_points.push_back(shared_ptr<MERTPoint>(new MERTPoint(cur_x, m, b, points[this_i], other.points[other_i])));
+ new_points.push_back(boost::shared_ptr<MERTPoint>(new MERTPoint(cur_x, m, b, points[this_i], other.points[other_i])));
int comp = 0;
if (this_next_val < other_next_val) comp = -1; else
if (this_next_val > other_next_val) comp = 1;