21 #ifndef KALDI_LAT_ARCTIC_WEIGHT_H_ 22 #define KALDI_LAT_ARCTIC_WEIGHT_H_ 24 #include "fst/float-weight.h" 51 static const std::string &
Type() {
52 static const std::string type = std::string(
"arctic") +
63 return Value() == Value() && Value() != std::numeric_limits<T>::infinity();
67 if (Value() == -std::numeric_limits<T>::infinity() ||
68 Value() == std::numeric_limits<T>::infinity() ||
78 return kLeftSemiring | kRightSemiring | kCommutative |
89 return w1.Value() > w2.Value() ? w1 : w2;
94 return Plus<float>(w1, w2);
99 return Plus<double>(w1, w2);
105 T f1 = w1.Value(), f2 = w2.Value();
106 if (f1 == -std::numeric_limits<T>::infinity())
108 else if (f2 == -std::numeric_limits<T>::infinity())
116 return Times<float>(w1, w2);
121 return Times<double>(w1, w2);
127 DivideType typ = DIVIDE_ANY) {
128 T f1 = w1.Value(), f2 = w2.Value();
129 if (f2 == -std::numeric_limits<T>::infinity())
130 return std::numeric_limits<T>::quiet_NaN();
131 else if (f1 == -std::numeric_limits<T>::infinity())
132 return -std::numeric_limits<T>::infinity();
139 DivideType typ = DIVIDE_ANY) {
140 return Divide<float>(w1, w2, typ);
145 DivideType typ = DIVIDE_ANY) {
146 return Divide<double>(w1, w2, typ);
153 #endif // KALDI_LAT_ARCTIC_WEIGHT_H_ LatticeWeightTpl< FloatType > Divide(const LatticeWeightTpl< FloatType > &w1, const LatticeWeightTpl< FloatType > &w2, DivideType typ=DIVIDE_ANY)
For an extended explanation of the framework of which grammar-fsts are a part, please see Support for...
LatticeWeightTpl< FloatType > Plus(const LatticeWeightTpl< FloatType > &w1, const LatticeWeightTpl< FloatType > &w2)
ArcticWeightTpl< T > ReverseWeight
static uint64 Properties()
static ArcticWeightTpl< T > NoWeight()
ArcticWeightTpl< float > ArcticWeight
LatticeWeightTpl< FloatType > Times(const LatticeWeightTpl< FloatType > &w1, const LatticeWeightTpl< FloatType > &w2)
static const ArcticWeightTpl< T > One()
static const std::string & Type()
ArcticWeightTpl< T > Quantize(float delta=kDelta) const
ArcticWeightTpl(const ArcticWeightTpl< T > &w)
static const ArcticWeightTpl< T > Zero()
ArcticWeightTpl< T > Reverse() const