Home | History | Annotate | Download | only in lib

Lines Matching refs:w2

28 // Product semiring: W1 * W2
29 template<class W1, class W2>
32 typedef ProductWeight<typename W1::ReverseWeight, typename W2::ReverseWeight>
37 ProductWeight(W1 w1, W2 w2) : value1_(w1), value2_(w2) {}
39 static const ProductWeight<W1, W2> &Zero() {
40 static const ProductWeight<W1, W2> zero(W1::Zero(), W2::Zero());
44 static const ProductWeight<W1, W2> &One() {
45 static const ProductWeight<W1, W2> one(W1::One(), W2::One());
50 static const string type = W1::Type() + "_X_" + W2::Type();
64 ProductWeight<W1, W2> &operator=(const ProductWeight<W1, W2> &w) {
80 ProductWeight<W1, W2> Quantize(float delta = kDelta) const {
81 return ProductWeight<W1, W2>(value1_.Quantize(), value2_.Quantize());
90 uint64 props2 = W2::Properties();
97 W2 Value2() const { return value2_; }
101 W2 value2_;
104 template <class W1, class W2>
105 inline bool operator==(const ProductWeight<W1, W2> &w,
106 const ProductWeight<W1, W2> &v) {
110 template <class W1, class W2>
111 inline bool operator!=(const ProductWeight<W1, W2> &w1,
112 const ProductWeight<W1, W2> &w2) {
113 return w1.Value1() != w2.Value1() || w1.Value2() != w2.Value2();
117 template <class W1, class W2>
118 inline bool ApproxEqual(const ProductWeight<W1, W2> &w1,
119 const ProductWeight<W1, W2> &w2,
121 return w1 == w2;
124 template <class W1, class W2>
125 inline ostream &operator<<(ostream &strm, const ProductWeight<W1, W2> &w) {
131 template <class W1, class W2>
132 inline istream &operator>>(istream &strm, ProductWeight<W1, W2> &w) {
163 W2 w2 = W2::Zero();
164 strm >> w2;
166 w = ProductWeight<W1, W2>(w1, w2);
170 template <class W1, class W2>
171 inline ProductWeight<W1, W2> Plus(const ProductWeight<W1, W2> &w,
172 const ProductWeight<W1, W2> &v) {
173 return ProductWeight<W1, W2>(Plus(w.Value1(), v.Value1()),
177 template <class W1, class W2>
178 inline ProductWeight<W1, W2> Times(const ProductWeight<W1, W2> &w,
179 const ProductWeight<W1, W2> &v) {
180 return ProductWeight<W1, W2>(Times(w.Value1(), v.Value1()),
184 template <class W1, class W2>
185 inline ProductWeight<W1, W2> Divide(const ProductWeight<W1, W2> &w,
186 const ProductWeight<W1, W2> &v,
188 return ProductWeight<W1, W2>(Divide(w.Value1(), v.Value1(), typ),