summaryrefslogtreecommitdiff
path: root/utils/weights.cc
diff options
context:
space:
mode:
authorredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-09-28 17:06:08 +0000
committerredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-09-28 17:06:08 +0000
commit3db6b004ae1e2319f52862d428c20be5a1538993 (patch)
treeb35c697027afd92324d8d9a63c8e6b27c32d2339 /utils/weights.cc
parent521dc2fdbf7eee7d6a86410f490ba7a76691590b (diff)
use boost mpi, fix L1 stochastic optimizer
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@659 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'utils/weights.cc')
-rw-r--r--utils/weights.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/utils/weights.cc b/utils/weights.cc
index ea8bd816..53089f89 100644
--- a/utils/weights.cc
+++ b/utils/weights.cc
@@ -81,3 +81,10 @@ void Weights::InitFromVector(const std::vector<double>& w) {
cerr << "WARNING: initializing weight vector has more features than the global feature dictionary!\n";
wv_.resize(FD::NumFeats(), 0);
}
+
+void Weights::InitFromVector(const SparseVector<double>& w) {
+ wv_.clear();
+ wv_.resize(FD::NumFeats(), 0.0);
+ for (int i = 1; i < FD::NumFeats(); ++i)
+ wv_[i] = w.value(i);
+}