20 #ifndef FST_PRODUCT_WEIGHT_H_ 21 #define FST_PRODUCT_WEIGHT_H_ 36 template <
class W1,
class W2>
48 :
PairWeight<W1, W2>(std::move(w1), std::move(w2)) {}
65 static const std::string &
Type() {
66 static const std::string *
const type =
67 new std::string(W1::Type() +
"_X_" + W2::Type());
72 return W1::Properties() & W2::Properties() &
85 template <
class W1,
class W2>
92 template <
class W1,
class W2>
99 template <
class W1,
class W2>
108 template <
class W1,
class W2>
126 adder1_.Reset(w.Value1());
127 adder2_.Reset(w.Value2());
138 template <
class W1,
class W2>
145 bool allow_zero =
true)
146 : generate_(seed, allow_zero) {}
156 #endif // FST_PRODUCT_WEIGHT_H_ ProductWeight Quantize(float delta=kDelta) const
static const std::string & Type()
WeightGenerate(uint64_t seed=std::random_device()(), bool allow_zero=true)
Weight Add(const Weight &w)
ErrorWeight Plus(const ErrorWeight &, const ErrorWeight &)
ProductWeight(const PairWeight< W1, W2 > &weight)
ErrorWeight Times(const ErrorWeight &, const ErrorWeight &)
Weight operator()() const
const W2 & Value2() const
static constexpr uint64_t Properties()
constexpr uint64_t kIdempotent
static const ProductWeight & NoWeight()
static const ProductWeight & Zero()
static const ProductWeight & One()
void Reset(Weight w=Weight::Zero())
constexpr uint64_t kRightSemiring
ReverseWeight Reverse() const
constexpr uint64_t kCommutative
ErrorWeight Divide(const ErrorWeight &, const ErrorWeight &)
ProductWeight(W1 w1, W2 w2)
constexpr uint64_t kLeftSemiring
ProductWeight< typename W1::ReverseWeight, typename W2::ReverseWeight > ReverseWeight
const W1 & Value1() const