From 3db6b004ae1e2319f52862d428c20be5a1538993 Mon Sep 17 00:00:00 2001 From: redpony Date: Tue, 28 Sep 2010 17:06:08 +0000 Subject: use boost mpi, fix L1 stochastic optimizer git-svn-id: https://ws10smt.googlecode.com/svn/trunk@659 ec762483-ff6d-05da-a07a-a48fb63a330f --- utils/weights.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'utils/weights.cc') 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& 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& w) { + wv_.clear(); + wv_.resize(FD::NumFeats(), 0.0); + for (int i = 1; i < FD::NumFeats(); ++i) + wv_[i] = w.value(i); +} -- cgit v1.2.3