Code Review
/
csit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Update VPP_STABLE_VER files
[csit.git]
/
resources
/
libraries
/
python
/
MLRsearch
/
WidthArithmetics.py
diff --git
a/resources/libraries/python/MLRsearch/WidthArithmetics.py
b/resources/libraries/python/MLRsearch/WidthArithmetics.py
index
81decfd
..
21316c5
100644
(file)
--- a/
resources/libraries/python/MLRsearch/WidthArithmetics.py
+++ b/
resources/libraries/python/MLRsearch/WidthArithmetics.py
@@
-54,10
+54,12
@@
def halve_relative_width(relative_width, goal_width):
fallback_width = 1.0 - math.sqrt(1.0 - relative_width)
# Wig means Width In Goals.
wig = math.log(1.0 - relative_width) / math.log(1.0 - goal_width)
fallback_width = 1.0 - math.sqrt(1.0 - relative_width)
# Wig means Width In Goals.
wig = math.log(1.0 - relative_width) / math.log(1.0 - goal_width)
- cwig = math.ceil(wig)
- if wig <= 2.0 or cwig != math.ceil(wig * ROUNDING_CONSTANT):
+ cwig = 2.0 * math.ceil(wig / 2.0)
+ fwig = 2.0 * math.ceil(wig * ROUNDING_CONSTANT / 2.0)
+ if wig <= 2.0 or cwig != fwig:
+ # Avoid too uneven splits.
return fallback_width
return fallback_width
- coefficient = cwig /
/
2
+ coefficient = cwig / 2
new_width = multiply_relative_width(goal_width, coefficient)
return new_width
new_width = multiply_relative_width(goal_width, coefficient)
return new_width