20 #ifndef FST_PRODUCT_WEIGHT_H_ 21 #define FST_PRODUCT_WEIGHT_H_ 34 template <
class W1,
class W2>
46 :
PairWeight<W1, W2>(std::move(w1), std::move(w2)) {}
63 static const std::string &
Type() {
64 static const std::string *
const type =
65 new std::string(W1::Type() +
"_X_" + W2::Type());
70 return W1::Properties() & W2::Properties() &
83 template <
class W1,
class W2>
90 template <
class W1,
class W2>
97 template <
class W1,
class W2>
106 template <
class W1,
class W2>
124 adder1_.Reset(w.Value1());
125 adder2_.Reset(w.Value2());
136 template <
class W1,
class W2>
143 bool allow_zero =
true)
144 : generate_(seed, allow_zero) {}
154 #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