Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
qparse
qparselib
Commits
f48d1108
Commit
f48d1108
authored
Jun 24, 2021
by
Florent Jacquemard
Browse files
Weights:
get_zero() -> zero() get_one() -> one() zero() -> is_zero() one() -> is_one()
parent
f199f861
Changes
28
Hide whitespace changes
Inline
Side-by-side
qparse.xcodeproj/project.pbxproj
View file @
f48d1108
...
...
@@ -833,6 +833,7 @@
43E76056237475B4004426E6
/* Voice.cpp in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
4305FB25204FD1C100CCDF10
/* Voice.cpp */
;
};
43E76057237475B4004426E6
/* Part.cpp in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
4305FB1E204FD1C000CCDF10
/* Part.cpp */
;
};
43E76058237475B4004426E6
/* Score.cpp in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
43577223203F1C7A0080B75A
/* Score.cpp */
;
};
43E7762B2684829200F90AAF
/* RunOrder.cpp in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
43E776292684829200F90AAF
/* RunOrder.cpp */
;
};
43F1799A20CACD4C0099D8E6
/* SpanningElement.cpp in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
43F1799620CACD4C0099D8E6
/* SpanningElement.cpp */
;
};
43F1799B20CACD4C0099D8E6
/* SpanningElement.cpp in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
43F1799620CACD4C0099D8E6
/* SpanningElement.cpp */
;
};
43F182111FC72F3400229992
/* CountingWeight.cpp in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
43F1820F1FC72F3400229992
/* CountingWeight.cpp */
;
};
...
...
@@ -1566,6 +1567,8 @@
43E6736D24AF303A008FA821
/* Notehead.hpp */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.cpp.h
;
path
=
Notehead.hpp
;
sourceTree
=
"<group>"
;
};
43E6736F24AF3E51008FA821
/* Stem.cpp */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.cpp.cpp
;
path
=
Stem.cpp
;
sourceTree
=
"<group>"
;
};
43E6737024AF3E51008FA821
/* Stem.hpp */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.cpp.h
;
path
=
Stem.hpp
;
sourceTree
=
"<group>"
;
};
43E776292684829200F90AAF
/* RunOrder.cpp */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.cpp.cpp
;
path
=
RunOrder.cpp
;
sourceTree
=
"<group>"
;
};
43E7762A2684829200F90AAF
/* RunOrder.hpp */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.cpp.h
;
path
=
RunOrder.hpp
;
sourceTree
=
"<group>"
;
};
43EEB0A5224ACC56002A91E7
/* Runey.hpp */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.cpp.h
;
path
=
Runey.hpp
;
sourceTree
=
"<group>"
;
xcLanguageSpecificationIdentifier
=
xcode.lang.cpp
;
};
43F1799520CACD4B0099D8E6
/* SpanningElement.hpp */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.cpp.h
;
path
=
SpanningElement.hpp
;
sourceTree
=
"<group>"
;
};
43F1799620CACD4C0099D8E6
/* SpanningElement.cpp */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.cpp.cpp
;
path
=
SpanningElement.cpp
;
sourceTree
=
"<group>"
;
};
...
...
@@ -2242,14 +2245,16 @@
43C573C8224D2FD3003FA990
/* Runey.cpp */
,
430046E52604CF3F000E9898
/* RunTerm.hpp */
,
430046E42604CF3F000E9898
/* RunTerm.cpp */
,
430046F22604CF97000E9898
/* RunInner.hpp */
,
430046F12604CF97000E9898
/* RunInner.tpp */
,
43631EC926186E7C004CC60F
/* RunInnero.hpp */
,
43631EC826186E7C004CC60F
/* RunInnero.cpp */
,
430046F22604CF97000E9898
/* RunInner.hpp */
,
430046F12604CF97000E9898
/* RunInner.tpp */
,
434F406422FB198300C3940E
/* RunRanked.hpp */
,
434F406322FB198300C3940E
/* RunRanked.tpp */
,
431864B123099B5900940ECB
/* RunCompare.hpp */
,
4313D8DD2613231800702519
/* RunCompare.cpp */
,
43E7762A2684829200F90AAF
/* RunOrder.hpp */
,
43E776292684829200F90AAF
/* RunOrder.cpp */
,
43631EB026186DAF004CC60F
/* Recordo.hpp */
,
43631EAF26186DAF004CC60F
/* Recordo.cpp */
,
4315C87522FAD873003F66AF
/* Recordey.hpp */
,
...
...
@@ -3434,6 +3439,7 @@
431F853D25DFD192001E1822
/* PS0.cpp in Sources */
,
4391F02623E9D99F004A91D6
/* InputSegmentSpiral.cpp in Sources */
,
43770CDA235872E900CC8869
/* squant2.cpp in Sources */
,
43E7762B2684829200F90AAF
/* RunOrder.cpp in Sources */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
};
...
...
src/V0/schemata/CountingWCFG.cpp
View file @
f48d1108
...
...
@@ -78,7 +78,7 @@ Weight CountingWCFG::eval(const RhythmTree& t) const
assert
(
this
->
hasWeightType
(
"CountingWeight"
));
Position
p
=
Position
();
Weight
w
=
evalCountingVerbose
(
t
,
_initial
,
p
);
if
(
w
.
zero
())
if
(
w
.
is_
zero
())
{
WARN
(
"FAIL in evaluating tree {}"
,
t
);
}
...
...
@@ -98,7 +98,7 @@ Weight CountingWCFG::evalCountingVerbose(const RhythmTree& t,
size_t
tar
=
t
.
arity
();
Weight
res
=
this
->
weight_zero
();
assert
(
!
res
.
unknown
());
assert
(
res
.
zero
());
assert
(
res
.
is_
zero
());
assert
(
res
.
hasType
(
"CountingWeight"
));
//TRACE("EVAL t={} p={} state={}", t, p, s);
...
...
@@ -134,7 +134,7 @@ Weight CountingWCFG::evalCountingVerbose(const RhythmTree& t,
}
// evaluation failed (no rule appliable)
if
(
res
.
zero
())
if
(
res
.
is_
zero
())
{
WARN
(
"FAIL in tree evaluation state = {} position = {} subtree = {}"
,
s
,
p
,
t
);
...
...
src/V1/parsers/Parser.tpp
View file @
f48d1108
...
...
@@ -130,7 +130,7 @@ void Parser<P>::printobestRun(std::ostream& o,
// QP_WEIGHT == WEIGHT_STOCHASTIC
if
(
CST_WEIGHT_TYPE
==
WeightDom
::
STOCHASTIC
)
{
if
(
cpty
.
zero
())
// 0
if
(
cpty
.
is_
zero
())
// 0
{
o
<<
"unknown"
;
}
...
...
@@ -142,7 +142,7 @@ void Parser<P>::printobestRun(std::ostream& o,
// QP_WEIGHT == WEIGHT_PENALTY
else
if
(
CST_WEIGHT_TYPE
==
WeightDom
::
PENALTY
)
{
if
(
cpty
.
zero
())
// +infinity
if
(
cpty
.
is_
zero
())
// +infinity
{
o
<<
"unknown"
;
}
...
...
src/V1/table/Ptr.cpp
View file @
f48d1108
...
...
@@ -27,7 +27,7 @@ Weight Pointer::innerWeight(const Production& tr) const
assert
(
!
tr
.
weight
().
unknown
());
assert
(
tr
.
inner
());
return
(
tr
.
weight
());
// return (tr.weight().
get_
one());
// return (tr.weight().one());
}
...
...
src/V1/table/PtrSIP.cpp
View file @
f48d1108
...
...
@@ -352,7 +352,7 @@ Weight SIPpointer::terminalWeight(const InputSegment* s,
assert
(
!
tr
.
weight
().
unknown
());
assert
(
tr
.
terminal
());
assert
(
this
->
compatible
(
tr
.
label
()));
// return (tr.weight().
get_
one()); // neutral element for *
// return (tr.weight().one()); // neutral element for *
// tweight = transition weight = complexity
Weight
tweight
=
tr
.
weight
();
...
...
src/V1/table/Record.hpp
View file @
f48d1108
...
...
@@ -38,7 +38,7 @@ template<class P> class Atable;
/// - NULL ptr to Run
/// - ptr to Run with unknown weight (i.e. weight with NULL letter)
/// that case includes null runs.
/// - ptr to Run with weight == zero (acc. to test zero()).
/// - ptr to Run with weight == zero (acc. to test
is_
zero()).
/// a Run not in these 3 case is called valid.
///
/// [update] the runs with weight zero (still invalid) can be added to records
...
...
src/V1/table/Record.tpp
View file @
f48d1108
...
...
@@ -31,7 +31,7 @@ bool Record<P>::valid(Run<P>* r)
WARN
(
"run {} with unknown weight not added to record"
,
*
r
);
return
false
;
}
else
if
(
r
->
weight
.
zero
())
else
if
(
r
->
weight
.
is_
zero
())
{
ERROR
(
"run {} with zero weight added to record"
,
*
r
);
return
true
;
...
...
@@ -42,6 +42,6 @@ bool Record<P>::valid(Run<P>* r)
}
// return ((r != NULL) &&
// (! r->weight.unknown()) &&
// (! r->weight.zero()));
// (! r->weight.
is_
zero()));
}
src/V1/table/Rune.tpp
View file @
f48d1108
...
...
@@ -58,7 +58,7 @@ _meta(false)
// segment might be NULL
weight
=
p
.
terminalWeight
(
env
->
segment
,
t
);
assert
(
!
weight
.
unknown
());
//assert(! weight.zero()); // compatibility is precondition
//assert(! weight.
is_
zero()); // compatibility is precondition
// at this point, a concrete label must be computable
// i.e. p is enough instanciated (pre value)
...
...
@@ -87,7 +87,7 @@ _meta(false)
assert
(
a
>
1
);
weight
=
p
.
innerWeight
(
t
);
assert
(
!
weight
.
unknown
());
assert
(
!
weight
.
zero
());
assert
(
!
weight
.
is_
zero
());
for
(
size_t
i
=
0
;
i
<
a
;
i
++
)
{
...
...
@@ -440,10 +440,10 @@ void Run<P>::update(const Weight& w, const DurationList& dl) // arg duration
{
assert
(
this
->
inner
());
assert
(
!
w
.
unknown
());
//assert(! w.zero()); // zero weight
//assert(! w.
is_
zero()); // zero weight
assert
(
_first_partialortoupdate
<
_children
.
size
());
assert
(
_children
[
_first_partialortoupdate
].
complete
());
// assert(! weight.zero()); // zero weight
// assert(! weight.
is_
zero()); // zero weight
weight
*=
w
;
// (flag) concatenation dur
...
...
src/V1/table/Table.tpp
View file @
f48d1108
...
...
@@ -456,7 +456,7 @@ size_t Table<P, R, H>::addUpdate(const P& p, Run<P>* r, Record<P>* it)
{
assert
(
ri
->
complete
());
if
(
ri
->
weight
.
zero
())
if
(
ri
->
weight
.
is_
zero
())
{
WARN
(
"addUpdate: child run {} with zero weight"
,
*
ri
);
}
...
...
src/schemata/CountingSWTA.cpp
View file @
f48d1108
...
...
@@ -77,7 +77,7 @@ Weight CountingSWTA::eval(const RhythmTree& t) const
assert
(
this
->
hasWeightType
(
"CountingWeight"
));
Position
p
=
Position
();
Weight
w
=
evalCountingVerbose
(
t
,
_initial
,
p
);
if
(
w
.
zero
())
if
(
w
.
is_
zero
())
{
WARN
(
"FAIL in evaluating tree {}"
,
t
);
}
...
...
@@ -97,7 +97,7 @@ Weight CountingSWTA::evalCountingVerbose(const RhythmTree& t,
size_t
tar
=
t
.
arity
();
Weight
res
=
this
->
weight_zero
();
assert
(
!
res
.
unknown
());
assert
(
res
.
zero
());
assert
(
res
.
is_
zero
());
assert
(
res
.
hasType
(
"CountingWeight"
));
//TRACE("EVAL t={} p={} state={}", t, p, s);
...
...
@@ -133,7 +133,7 @@ Weight CountingSWTA::evalCountingVerbose(const RhythmTree& t,
}
// evaluation failed (no rule appliable)
if
(
res
.
zero
())
if
(
res
.
is_
zero
())
{
WARN
(
"FAIL in tree evaluation state = {} position = {} subtree = {}"
,
s
,
p
,
t
);
...
...
src/schemata/WFSM.tpp
View file @
f48d1108
...
...
@@ -449,7 +449,7 @@ void WFSM<T>::CountingtoStochastic()
s
,
tl
.
size
());
// TBC : float sum ?
// Weight sum = _seed.
get_
zero(); // 0 of FloatWeights
// Weight sum = _seed.zero(); // 0 of FloatWeights
// assert (sum.hasType("FloatWeight"));
double
sum
=
0
;
...
...
@@ -516,7 +516,7 @@ void WFSM<T>::PenaltytoCounting()
if
(
v
==
0
)
{
WARN
(
"cast Penalty-Counting: state {}, tr. with weight=0"
,
s
);
j
->
setWeight
(
newseed
.
get_
zero
());
j
->
setWeight
(
newseed
.
zero
());
}
else
{
...
...
@@ -555,7 +555,7 @@ void WFSM<T>::StochastictoPenalty()
if
(
v
==
0
)
{
WARN
(
"cast Stochastic-Penalty: state {}, tr. with weight=0"
,
s
);
j
->
setWeight
(
newseed
.
get_
zero
());
j
->
setWeight
(
newseed
.
zero
());
}
// else if (v == 1)
// {
...
...
@@ -585,7 +585,7 @@ template<class T>
Weight
WFSM
<
T
>::
weight_zero
()
const
{
assert
(
!
_seed
.
unknown
());
return
_seed
.
get_
zero
();
return
_seed
.
zero
();
}
...
...
@@ -593,7 +593,7 @@ template<class T>
Weight
WFSM
<
T
>::
weight_one
()
const
{
assert
(
!
_seed
.
unknown
());
return
_seed
.
get_
one
();
return
_seed
.
one
();
}
...
...
src/schemata/import/SWTAFileIn.cpp
View file @
f48d1108
...
...
@@ -312,7 +312,7 @@ size_t SWTAFileIn::read_line(const std::string& line,
{
if
((
it
==
end
)
||
read_comment
(
it
,
begin
,
end
))
{
w
=
_seed
.
get_
one
();
w
=
_seed
.
one
();
}
else
return
2
;
...
...
src/weight/CountingWeight.cpp
View file @
f48d1108
...
...
@@ -116,21 +116,21 @@ Weight CountingWeight::make_unit(size_t dim, size_t i)
return
Weight
(
cw
);
}
Weight
CountingWeight
::
get_
zero
()
const
Weight
CountingWeight
::
zero
()
const
{
assert
(
_dim
>
0
);
return
Weight
(
new
CountingWeight
(
FAIL
,
this
->
_dim
));
}
Weight
CountingWeight
::
get_
one
()
const
Weight
CountingWeight
::
one
()
const
{
assert
(
_dim
>
0
);
return
CountingWeight
::
make_one
(
this
->
_dim
);
}
bool
CountingWeight
::
zero
()
const
bool
CountingWeight
::
is_
zero
()
const
{
assert
(
_dim
>
0
);
return
(
_type
==
FAIL
);
...
...
@@ -142,7 +142,7 @@ bool CountingWeight::error() const
return
(
_type
==
ERROR
);
}
bool
CountingWeight
::
one
()
const
bool
CountingWeight
::
is_
one
()
const
{
assert
(
_dim
>
0
);
...
...
@@ -410,7 +410,7 @@ void CountingWeight::rawprint(std::ostream& o) const
{
o
<<
"ERROR"
;
}
else
if
(
zero
())
else
if
(
is_
zero
())
{
o
<<
"FAIL"
;
}
...
...
@@ -435,7 +435,7 @@ std::ostream& operator<<(std::ostream& o, const CountingWeight& rhs)
{
o
<<
"ERROR"
;
}
else
if
(
rhs
.
zero
())
else
if
(
rhs
.
is_
zero
())
{
o
<<
"FAIL"
;
}
...
...
src/weight/CountingWeight.hpp
View file @
f48d1108
...
...
@@ -63,9 +63,9 @@ public:
/// @param i must be >=0 and must be < dim
static
Weight
make_unit
(
size_t
dim
,
size_t
i
);
virtual
Weight
get_
zero
()
const
;
virtual
Weight
zero
()
const
;
virtual
Weight
get_
one
()
const
;
virtual
Weight
one
()
const
;
/// @warning do not use
...
...
@@ -78,16 +78,16 @@ public:
virtual
void
invert
()
{}
/// @warning this weight is zero (FAIL)
virtual
bool
zero
()
const
;
virtual
bool
is_
zero
()
const
;
/// @warning this weight is the error value
bool
fail
()
const
{
return
zero
();
}
bool
fail
()
const
{
return
is_
zero
();
}
/// @warning this weight is the error value
bool
error
()
const
;
/// @warning this weight is one (null vector)
virtual
bool
one
()
const
;
virtual
bool
is_
one
()
const
;
virtual
size_t
dim
()
const
{
return
_dim
;
}
...
...
src/weight/Distance.hpp
View file @
f48d1108
...
...
@@ -51,13 +51,13 @@ public:
inline
static
Weight
make_zero
()
{
return
Weight
(
new
Distance
(
-
1.0
));
}
inline
virtual
Weight
get_
zero
()
const
inline
virtual
Weight
zero
()
const
{
return
Distance
::
make_zero
();
}
inline
static
Weight
make_one
()
{
return
Weight
(
new
Distance
(
0.0
));
}
inline
virtual
Weight
get_
one
()
const
inline
virtual
Weight
one
()
const
{
return
Distance
::
make_one
();
}
protected:
...
...
src/weight/FloatWeight.cpp
View file @
f48d1108
...
...
@@ -63,13 +63,13 @@ void FloatWeight::invert()
if
(
_val
!=
0
)
{
_val
=
1.0
/
_val
;
}
}
bool
FloatWeight
::
zero
()
const
bool
FloatWeight
::
is_
zero
()
const
{
//assert (0.0 <= _val);
return
(
_val
==
0.0
);
}
bool
FloatWeight
::
one
()
const
bool
FloatWeight
::
is_
one
()
const
{
//assert (0.0 <= _val);
return
(
_val
==
1.0
);
...
...
src/weight/FloatWeight.hpp
View file @
f48d1108
...
...
@@ -45,13 +45,13 @@ public:
inline
static
Weight
make_zero
()
{
return
Weight
(
new
FloatWeight
(
0.0
));
}
inline
virtual
Weight
get_
zero
()
const
inline
virtual
Weight
zero
()
const
{
return
FloatWeight
::
make_zero
();
}
inline
static
Weight
make_one
()
{
return
Weight
(
new
FloatWeight
(
1.0
));
}
inline
virtual
Weight
get_
one
()
const
inline
virtual
Weight
one
()
const
{
return
FloatWeight
::
make_one
();
}
inline
virtual
double
norm
()
const
...
...
@@ -63,9 +63,9 @@ public:
/// @warning this weight must not be zero.
virtual
void
invert
();
virtual
bool
zero
()
const
;
virtual
bool
is_
zero
()
const
;
virtual
bool
one
()
const
;
virtual
bool
is_
one
()
const
;
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
o
,
const
FloatWeight
&
rhs
);
...
...
src/weight/TropicalWeight.cpp
View file @
f48d1108
...
...
@@ -65,7 +65,7 @@ void TropicalWeight::scalar(double d)
//assert (_val >= 0);
assert
(
d
>=
0
);
if
(
!
zero
())
if
(
!
is_
zero
())
{
_val
*=
d
;
}
...
...
@@ -81,7 +81,7 @@ void TropicalWeight::invert()
}
bool
TropicalWeight
::
zero
()
const
bool
TropicalWeight
::
is_
zero
()
const
{
assert
((
_val
==
-
1
)
||
(
_val
>=
0
));
...
...
@@ -89,7 +89,7 @@ bool TropicalWeight::zero() const
}
bool
TropicalWeight
::
one
()
const
bool
TropicalWeight
::
is_
one
()
const
{
assert
((
_val
==
-
1
)
||
(
_val
>=
0
));
...
...
@@ -102,7 +102,7 @@ bool TropicalWeight::equal(const LetterWeight* rhs) const
{
assert
(
rhs
);
assert
(
rhs
->
hasType
(
"TropicalWeight"
));
return
((
zero
()
&&
rhs
->
zero
())
||
return
((
is_
zero
()
&&
rhs
->
is_
zero
())
||
DBL_APPROX_EQUAL
(
_val
,
rhs
->
norm
(),
CST_PRECISION
,
DBL_EPSILON
));
}
...
...
@@ -111,8 +111,8 @@ bool TropicalWeight::smaller(const LetterWeight* rhs) const
{
assert
(
rhs
);
assert
(
rhs
->
hasType
(
"TropicalWeight"
));
return
((
!
this
->
zero
())
&&
(
rhs
->
zero
()
||
(
_val
>
rhs
->
norm
())));
return
((
!
this
->
is_
zero
())
&&
(
rhs
->
is_
zero
()
||
(
_val
>
rhs
->
norm
())));
}
...
...
@@ -121,9 +121,9 @@ void TropicalWeight::add(const LetterWeight* rhs)
{
assert
(
rhs
);
assert
(
rhs
->
hasType
(
"TropicalWeight"
));
if
(
rhs
->
zero
())
if
(
rhs
->
is_
zero
())
{}
// do nothing
else
if
(
this
->
zero
())
else
if
(
this
->
is_
zero
())
{
_val
=
rhs
->
norm
();
}
...
...
@@ -143,7 +143,7 @@ void TropicalWeight::mult(const LetterWeight* rhs)
{
assert
(
rhs
);
assert
(
rhs
->
hasType
(
"TropicalWeight"
));
if
(
rhs
->
zero
()
||
zero
())
if
(
rhs
->
is_
zero
()
||
is_
zero
())
{
_val
=
-
1
;
// zero
}
...
...
@@ -158,7 +158,7 @@ void TropicalWeight::mult(const LetterWeight* rhs)
void
TropicalWeight
::
print
(
std
::
ostream
&
o
)
const
{
if
(
this
->
zero
())
if
(
this
->
is_
zero
())
{
o
<<
"+∞"
;
}
...
...
src/weight/TropicalWeight.hpp
View file @
f48d1108
...
...
@@ -54,13 +54,13 @@ public:
inline
static
Weight
make_zero
()
{
return
Weight
(
new
TropicalWeight
(
-
1.0
));
}
inline
virtual
Weight
get_
zero
()
const
inline
virtual
Weight
zero
()
const
{
return
TropicalWeight
::
make_zero
();
}
inline
static
Weight
make_one
()
{
return
Weight
(
new
TropicalWeight
(
0.0
));
}
inline
virtual
Weight
get_
one
()
const
inline
virtual
Weight
one
()
const
{
return
TropicalWeight
::
make_one
();
}
/// @warning must not be zero (infinity)
...
...
@@ -72,9 +72,9 @@ public:
/// @warning this weight must not be zero.
virtual
void
invert
();
virtual
bool
zero
()
const
;
virtual
bool
is_
zero
()
const
;
virtual
bool
one
()
const
;
virtual
bool
is_
one
()
const
;
...
...
@@ -104,7 +104,7 @@ public:
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
o
,
const
TropicalWeight
&
rhs
)
{
if
(
rhs
.
zero
())
if
(
rhs
.
is_
zero
())
{
o
<<
"+∞"
;
}
...
...
src/weight/ViterbiWeight.cpp
View file @
f48d1108
...
...
@@ -77,7 +77,7 @@ void ViterbiWeight::invert()
}
bool
ViterbiWeight
::
zero
()
const
bool
ViterbiWeight
::
is_
zero
()
const
{
assert
(
0.0
<=
_val
);
assert
(
_val
<=
1.0
);
...
...
@@ -87,7 +87,7 @@ bool ViterbiWeight::zero() const
}
bool
ViterbiWeight
::
one
()
const
bool
ViterbiWeight
::
is_
one
()
const
{
assert
(
0.0
<=
_val
);
assert
(
_val
<=
1.0
);
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment