42 }
else if (tmp == 1) {
44 }
else if (tmp == 2) {
67 LatticeWeight l3 =
Plus(l1, l2);
68 LatticeWeight l4 =
Times(l1, l2);
83 NaturalLess<LatticeWeight> nl;
85 bool b = (
Plus(l1, l2) == l1 && l1 != l2);
95 std::cout <<
"l1 = " << l1 <<
", l2 = " << l2
96 <<
", l5 = " << l5 <<
", l6 = " << l6 <<
"\n";
97 std::cout <<
"ERROR: " << wa <<
" != " << wb <<
"\n";
104 && l5.
Member() && l6.Member());
109 std::ostringstream s1;
111 std::istringstream s2(s1.str());
114 std::cout << s1.str() <<
'\n';
116 std::ostringstream s1b;
118 std::istringstream s2b(s1b.str());
129 CompactLatticeWeight l3 =
Plus(l1, l2);
130 CompactLatticeWeight l4 =
Times(l1, l2);
137 NaturalLess<CompactLatticeWeight> nl;
139 bool b = (
Plus(l1, l2) == l1 && l1 != l2);
148 && l5.
Member() && l6.Member());
155 std::ostringstream s1;
157 std::istringstream s2(s1.str());
160 std::cout << s1.str() <<
'\n';
163 std::ostringstream s1b;
165 std::istringstream s2b(s1b.str());
171 std::cout <<
"l5 = " << l5 <<
'\n';
172 std::cout <<
"l6 = " << l6 <<
'\n';
173 l1 = divisor(l5, l6);
174 std::cout <<
"div = " << l1 <<
'\n';
176 l2 =
Divide(l5, l1, DIVIDE_LEFT);
177 l3 =
Divide(l6, l1, DIVIDE_LEFT);
178 std::cout <<
"l2 = " << l2 <<
'\n';
179 std::cout <<
"l3 = " << l3 <<
'\n';
180 l4 = divisor(l2, l3);
181 std::cout <<
"l4 = " << l4 <<
'\n';
LatticeWeightTpl Quantize(float delta=kDelta) const
CompactLatticeWeight RandomCompactLatticeWeight()
LatticeWeightTpl< FloatType > Divide(const LatticeWeightTpl< FloatType > &w1, const LatticeWeightTpl< FloatType > &w2, DivideType typ=DIVIDE_ANY)
LatticeWeightTpl< FloatType > Reverse() const
static const LatticeWeightTpl One()
For an extended explanation of the framework of which grammar-fsts are a part, please see Support for...
std::istream & Read(std::istream &strm)
LatticeWeightTpl< FloatType > Plus(const LatticeWeightTpl< FloatType > &w1, const LatticeWeightTpl< FloatType > &w2)
float RandGauss(struct RandomState *state=NULL)
bool ApproxEqual(const LatticeWeightTpl< FloatType > &w1, const LatticeWeightTpl< FloatType > &w2, float delta=kDelta)
std::istream & Read(std::istream &strm)
LatticeWeightTpl< FloatType > Times(const LatticeWeightTpl< FloatType > &w1, const LatticeWeightTpl< FloatType > &w2)
static const CompactLatticeWeightTpl< WeightType, IntType > One()
static const LatticeWeightTpl Zero()
int Rand(struct RandomState *state)
int Compare(const LatticeWeightTpl< FloatType > &w1, const LatticeWeightTpl< FloatType > &w2)
Compare returns -1 if w1 < w2, +1 if w1 > w2, and 0 if w1 == w2.
#define KALDI_ASSERT(cond)
LatticeWeight RandomLatticeWeight()
static const CompactLatticeWeightTpl< WeightType, IntType > Zero()
static void AssertEqual(float a, float b, float relative_tolerance=0.001)
assert abs(a - b) <= relative_tolerance * (abs(a)+abs(b))
CompactLatticeWeightTpl Quantize(float delta=kDelta) const
LatticeWeightTpl< BaseFloat > LatticeWeight
CompactLatticeWeightTpl< LatticeWeight, int32 > CompactLatticeWeight
CompactLatticeWeightCommonDivisorTpl< LatticeWeight, int32 > CompactLatticeWeightCommonDivisor
void CompactLatticeWeightTest()