From d484433d9ad566076b7d078c77443ce7841f4f3e Mon Sep 17 00:00:00 2001 From: graehl Date: Fri, 16 Jul 2010 22:08:37 +0000 Subject: smallvector template git-svn-id: https://ws10smt.googlecode.com/svn/trunk@302 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/kbest.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'decoder/kbest.h') diff --git a/decoder/kbest.h b/decoder/kbest.h index fcd40fcd..35e79bcc 100644 --- a/decoder/kbest.h +++ b/decoder/kbest.h @@ -49,7 +49,7 @@ namespace KBest { struct Derivation { Derivation(const Hypergraph::Edge& e, - const SmallVector& jv, + const SmallVectorInt& jv, const WeightType& w, const SparseVector& f) : edge(&e), @@ -59,11 +59,11 @@ namespace KBest { // dummy constructor, just for query Derivation(const Hypergraph::Edge& e, - const SmallVector& jv) : edge(&e), j(jv) {} + const SmallVectorInt& jv) : edge(&e), j(jv) {} T yield; const Hypergraph::Edge* const edge; - const SmallVector j; + const SmallVectorInt j; const WeightType score; const SparseVector feature_values; }; @@ -141,7 +141,7 @@ namespace KBest { // the yield is computed in LazyKthBest before the derivation is added to D // returns NULL if j refers to derivation numbers larger than the // antecedent structure define - Derivation* CreateDerivation(const Hypergraph::Edge& e, const SmallVector& j) { + Derivation* CreateDerivation(const Hypergraph::Edge& e, const SmallVectorInt& j) { WeightType score = w(e); SparseVector feats = e.feature_values_; for (int i = 0; i < e.Arity(); ++i) { @@ -161,7 +161,7 @@ namespace KBest { const Hypergraph::Node& node = g.nodes_[v]; for (int i = 0; i < node.in_edges_.size(); ++i) { const Hypergraph::Edge& edge = g.edges_[node.in_edges_[i]]; - SmallVector jv(edge.Arity(), 0); + SmallVectorInt jv(edge.Arity(), 0); Derivation* d = CreateDerivation(edge, jv); assert(d); s.cand.push_back(d); @@ -178,7 +178,7 @@ namespace KBest { void LazyNext(const Derivation* d, CandidateHeap* cand, UniqueDerivationSet* ds) { for (int i = 0; i < d->j.size(); ++i) { - SmallVector j = d->j; + SmallVectorInt j = d->j; ++j[i]; const Derivation* ant = LazyKthBest(d->edge->tail_nodes_[i], j[i]); if (ant) { -- cgit v1.2.3