diff options
author | jfouet <jfouet@1f5c12ca-751b-0410-a591-d2e778427230> | 2008-05-14 18:25:07 +0400 |
---|---|---|
committer | jfouet <jfouet@1f5c12ca-751b-0410-a591-d2e778427230> | 2008-05-14 18:25:07 +0400 |
commit | cb5305ab4633bb47f962c01babf61c060f24b902 (patch) | |
tree | f503f8af9f4f209925a38c6324c19a462476ff44 /mert/Point.cpp | |
parent | 9202738527586ef1e5f603998b4537912b2788ac (diff) |
implementation of LineOptimizer
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1659 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'mert/Point.cpp')
-rw-r--r-- | mert/Point.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/mert/Point.cpp b/mert/Point.cpp index 2e6ebc425..1bb6adbd8 100644 --- a/mert/Point.cpp +++ b/mert/Point.cpp @@ -1,6 +1,6 @@ #include "Point.h" #include<cmath> - +#include <cassert> using namespace std; void Point::randomize(const vector<lambda>& min,const vector<lambda>& max){ for (int i=0; i<size(); i++) @@ -23,3 +23,20 @@ double Point::operator*(FeatureStats& F)const{ for (int i=0; i<size(); i++) prod+= operator[](i)*F.get(i); } + +Point Point::operator+(const Point& p2)const{ + assert(p2.size()==size()); + Point Res(*this); + for(unsigned i=0;i<size();i++) + Res[i]+=p2[i]; + Res.score=numeric_limits<statscore>::max(); + return Res; +}; + +Point Point::operator*(float& l)const{ + Point Res(*this); + for(unsigned i=0;i<size();i++) + Res[i]*=l; + Res.score=numeric_limits<statscore>::max(); + return Res; +}; |