Home | History | Annotate | Download | only in fst

Lines Matching refs:X2

42 // X2 is usually a random variable or vector
45 // If X1 is distinct from X2, it is required that there is an external
46 // product between X1 and X2 and if both semriring are commutative, or
48 template <class X1, class X2>
49 class ExpectationWeight : public PairWeight<X1, X2> {
51 using PairWeight<X1, X2>::Value1;
52 using PairWeight<X1, X2>::Value2;
54 using PairWeight<X1, X2>::Reverse;
55 using PairWeight<X1, X2>::Quantize;
56 using PairWeight<X1, X2>::Member;
59 typedef X2 W2;
62 typename X2::ReverseWeight> ReverseWeight;
64 ExpectationWeight() : PairWeight<X1, X2>(Zero()) { }
66 ExpectationWeight(const ExpectationWeight<X1, X2>& w)
67 : PairWeight<X1, X2> (w) { }
69 ExpectationWeight(const PairWeight<X1, X2>& w)
70 : PairWeight<X1, X2> (w) { }
72 ExpectationWeight(const X1& x1, const X2& x2)
73 : PairWeight<X1, X2>(x1, x2) { }
75 static const ExpectationWeight<X1, X2> &Zero() {
76 static const ExpectationWeight<X1, X2> zero(X1::Zero(), X2::Zero());
80 static const ExpectationWeight<X1, X2> &One() {
81 static const ExpectationWeight<X1, X2> one(X1::One(), X2::Zero());
85 static const ExpectationWeight<X1, X2> &NoWeight() {
86 static const ExpectationWeight<X1, X2> no_weight(X1::NoWeight(),
87 X2::NoWeight());
92 static const string type = "expectation_" + X1::Type() + "_" + X2::Type();
96 PairWeight<X1, X2> Quantize(float delta = kDelta) const {
97 return PairWeight<X1, X2>::Quantize();
101 return PairWeight<X1, X2>::Reverse();
105 return PairWeight<X1, X2>::Member();
116 template <class X1, class X2>
117 inline ExpectationWeight<X1, X2> Plus(const ExpectationWeight<X1, X2> &w,
118 const ExpectationWeight<X1, X2> &v) {
119 return ExpectationWeight<X1, X2>(Plus(w.Value1(), v.Value1()),
124 template <class X1, class X2>
125 inline ExpectationWeight<X1, X2> Times(const ExpectationWeight<X1, X2> &w,
126 const ExpectationWeight<X1, X2> &v) {
127 return ExpectationWeight<X1, X2>(Times(w.Value1(), v.Value1()),
132 template <class X1, class X2>
133 inline ExpectationWeight<X1, X2> Divide(const ExpectationWeight<X1, X2> &w,
134 const ExpectationWeight<X1, X2> &v,
137 return ExpectationWeight<X1, X2>::NoWeight();