Lines Matching refs:Weight

43   typedef typename Arc::Weight Weight;
53 Weight weight_threshold; // pruning weight threshold.
58 bool fp = false, Weight w = Weight::Zero(),
80 vector<typename Arc::Weight> *distance,
83 typedef typename Arc::Weight Weight;
100 Weight f_distance = Weight::Zero();
111 if (opts.weight_threshold != Weight::Zero() ||
118 if ((Weight::Properties() & (kPath | kRightSemiring))
120 FSTERROR() << "SingleShortestPath: Weight needs to have the path"
121 << " property and be right distributive: " << Weight::Type();
126 distance->push_back(Weight::Zero());
129 arc_parent.push_back(Arc(kNoLabel, kNoLabel, Weight::Zero(), kNoStateId));
131 distance->push_back(Weight::One());
133 arc_parent.push_back(Arc(kNoLabel, kNoLabel, Weight::Zero(), kNoStateId));
141 Weight sd = (*distance)[s];
142 if (ifst.Final(s) != Weight::Zero()) {
143 Weight w = Times(sd, ifst.Final(s));
160 distance->push_back(Weight::Zero());
163 arc_parent.push_back(Arc(kNoLabel, kNoLabel, Weight::Zero(),
166 Weight &nd = (*distance)[arc.nextstate];
167 Weight w = Times(sd, arc.weight);
211 typedef W Weight;
212 typedef pair<StateId, Weight> Pair;
215 const vector<Weight>& distance,
222 Weight dx = px.first == superfinal_ ? Weight::One() :
223 px.first < distance_.size() ? distance_[px.first] : Weight::Zero();
224 Weight dy = py.first == superfinal_ ? Weight::One() :
225 py.first < distance_.size() ? distance_[py.first] : Weight::Zero();
226 Weight wx = Times(dx, px.second);
227 Weight wy = Times(dy, py.second);
242 const vector<Weight> &distance_;
245 NaturalLess<Weight> less_;
278 const vector<typename Arc::Weight> &distance,
281 typename Arc::Weight weight_threshold = Arc::Weight::Zero(),
284 typedef typename Arc::Weight Weight;
285 typedef pair<StateId, Weight> Pair;
286 typedef typename RevArc::Weight RevWeight;
289 if ((Weight::Properties() & (kPath | kSemiring)) != (kPath | kSemiring)) {
290 FSTERROR() << "NShortestPath: Weight needs to have the "
292 << Weight::Type();
306 // distance from 'superfinal' to the final state is 'Weight::One()',
309 ShortestPathCompare<StateId, Weight>
316 NaturalLess<Weight> less;
319 distance[ifst.Start()] == Weight::Zero() ||
320 less(weight_threshold, Weight::One()) ||
327 ofst->SetFinal(final, Weight::One());
329 pairs.push_back(Pair(kNoStateId, Weight::Zero()));
330 pairs[final] = Pair(ifst.Start(), Weight::One());
332 Weight limit = Times(distance[ifst.Start()], weight_threshold);
339 Weight d = p.first == superfinal ? Weight::One() :
340 p.first < distance.size() ? distance[p.first] : Weight::Zero();
350 ofst->AddArc(ofst->Start(), Arc(0, 0, Weight::One(), state));
360 Weight w = Times(p.second, arc.weight);
369 Weight finalw = ifst.Final(p.first).Reverse();
370 if (finalw != Weight::Zero()) {
371 Weight w = Times(p.second, finalw);
414 vector<typename Arc::Weight> *distance,
417 typedef typename Arc::Weight Weight;
426 if ((Weight::Properties() & (kPath | kSemiring)) != (kPath | kSemiring)) {
427 FSTERROR() << "ShortestPath: n-shortest: Weight needs to have the "
429 << Weight::Type();
445 Weight d = Weight::Zero();
459 vector<Weight> ddistance;
487 typename Arc::Weight weight_threshold = Arc::Weight::Zero(),
489 vector<typename Arc::Weight> distance;