Lines Matching defs:w2
37 template<class W1, class W2> class PairWeight;
38 template <class W1, class W2>
39 istream &operator>>(istream &strm, PairWeight<W1, W2> &w);
41 template<class W1, class W2>
44 friend istream &operator>><W1, W2>(istream&, PairWeight<W1, W2>&);
47 typename W2::ReverseWeight>
54 PairWeight(W1 w1, W2 w2) : value1_(w1), value2_(w2) {}
56 static const PairWeight<W1, W2> &Zero() {
57 static const PairWeight<W1, W2> zero(W1::Zero(), W2::Zero());
61 static const PairWeight<W1, W2> &One() {
62 static const PairWeight<W1, W2> one(W1::One(), W2::One());
66 static const PairWeight<W1, W2> &NoWeight() {
67 static const PairWeight<W1, W2> no_weight(W1::NoWeight(), W2::NoWeight());
81 PairWeight<W1, W2> &operator=(const PairWeight<W1, W2> &w) {
97 PairWeight<W1, W2> Quantize(float delta = kDelta) const {
98 return PairWeight<W1, W2>(value1_.Quantize(delta),
108 const W2& Value2() const { return value2_; }
112 void SetValue2(const W2 &w) { value2_ = w; }
116 istream &strm, PairWeight<W1, W2>& w, char separator) {
136 W2 w2 = W2::Zero();
137 strm >> w2;
139 w = PairWeight<W1, W2>(w1, w2);
145 istream &strm, PairWeight<W1, W2>& w,
199 W2 w2 = W2::Zero();
200 strm2 >> w2;
202 w = PairWeight<W1, W2>(w1, w2);
208 W2 value2_;
212 template <class W1, class W2>
213 inline bool operator==(const PairWeight<W1, W2> &w,
214 const PairWeight<W1, W2> &v) {
218 template <class W1, class W2>
219 inline bool operator!=(const PairWeight<W1, W2> &w1,
220 const PairWeight<W1, W2> &w2) {
221 return w1.Value1() != w2.Value1() || w1.Value2() != w2.Value2();
225 template <class W1, class W2>
226 inline bool ApproxEqual(const PairWeight<W1, W2> &w1,
227 const PairWeight<W1, W2> &w2,
229 return ApproxEqual(w1.Value1(), w2.Value1(), delta) &&
230 ApproxEqual(w1.Value2(), w2.Value2(), delta);
233 template <class W1, class W2>
234 inline ostream &operator<<(ostream &strm, const PairWeight<W1, W2> &w) {
255 template <class W1, class W2>
256 inline istream &operator>>(istream &strm, PairWeight<W1, W2> &w) {
270 return PairWeight<W1, W2>::ReadWithParen(
274 return PairWeight<W1, W2>::ReadNoParen(strm, w, separator);