summaryrefslogtreecommitdiff
path: root/decoder/kbest.h
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-16 22:08:37 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-16 22:08:37 +0000
commitd484433d9ad566076b7d078c77443ce7841f4f3e (patch)
tree6d6eb905ed25589821b7bec12a38b1fb211c37b1 /decoder/kbest.h
parent0a11da06831d5a062b6703f1aa1431cc33689e23 (diff)
smallvector template
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@302 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/kbest.h')
-rw-r--r--decoder/kbest.h12
1 files changed, 6 insertions, 6 deletions
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<double>& 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<double> 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<double> 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) {