[med-svn] [Git][med-team/last-align][upstream] New upstream version 1169

Nilesh Patra gitlab at salsa.debian.org
Wed Dec 23 06:54:06 GMT 2020



Nilesh Patra pushed to branch upstream at Debian Med / last-align


Commits:
6797dabf by Nilesh Patra at 2020-12-23T12:12:40+05:30
New upstream version 1169
- - - - -


4 changed files:

- ChangeLog.txt
- scripts/last-train
- src/LastEvaluer.cc
- src/version.hh


Changes:

=====================================
ChangeLog.txt
=====================================
@@ -1,9 +1,15 @@
+2020-12-23  Martin C. Frith  <Martin C. Frith>
+
+	* scripts/last-train, src/LastEvaluer.cc:
+	Try to fix floating-point infinite loops
+	[829c63f50494] [tip]
+
 2020-12-15  Martin C. Frith  <Martin C. Frith>
 
 	* src/Alignment.cc, src/lastal.cc, test/last-test.out, test/last-
 	test.sh:
 	New frameshifts: fix print precision of score
-	[abed5cbf2f29] [tip]
+	[abed5cbf2f29]
 
 2020-12-11  Martin C. Frith  <Martin C. Frith>
 


=====================================
scripts/last-train
=====================================
@@ -29,24 +29,24 @@ def myOpen(fileName):  # faster than fileinput
 
 def rootOfIncreasingFunction(func, lowerBound, upperBound, args):
     # Find x such that func(x, *args) == 0
+    gap = upperBound - lowerBound
     while True:
-        mid = 0.5 * (lowerBound + upperBound)
-        if mid <= lowerBound or mid >= upperBound:
+        gap *= 0.5
+        mid = lowerBound + gap
+        if mid <= lowerBound:
             return mid
         if func(mid, *args) < 0:
             lowerBound = mid
-        else:
-            upperBound = mid
 
 def rootOfDecreasingFunction(func, lowerBound, upperBound, args):
     # Find x such that func(x, *args) == 0
+    gap = upperBound - lowerBound
     while True:
-        mid = 0.5 * (lowerBound + upperBound)
-        if mid <= lowerBound or mid >= upperBound:
+        gap *= 0.5
+        mid = lowerBound + gap
+        if mid <= lowerBound:
             return mid
-        if func(mid, *args) < 0:
-            upperBound = mid
-        else:
+        if func(mid, *args) > 0:
             lowerBound = mid
 
 def homogeneousLetterFreqs(scale, matScores):


=====================================
src/LastEvaluer.cc
=====================================
@@ -476,14 +476,13 @@ double LastEvaluer::minScore(double queryLettersPerRandomAlignment) const {
   const Sls::ALP_set_of_parameters &p = evaluer.parameters();
   double x = queryLettersPerRandomAlignment * databaseSeqNum;
   double beg = 0;
-  double end = log(x * databaseSeqLen * p.K) / p.lambda;
+  double len = log(x * databaseSeqLen * p.K) / p.lambda;
 
   while (1) {
-    double mid = (beg + end) / 2;
-    if (mid <= beg || mid >= end) return mid;
-    if (evaluer.evalue(mid, huge, databaseSeqLen) < huge / x)
-      end = mid;
-    else
+    len /= 2;
+    double mid = beg + len;
+    if (mid <= beg) return mid;
+    if (evaluer.evalue(mid, huge, databaseSeqLen) >= huge / x)
       beg = mid;
   }
 }


=====================================
src/version.hh
=====================================
@@ -1 +1 @@
-"1168"
+"1169"



View it on GitLab: https://salsa.debian.org/med-team/last-align/-/commit/6797dabf86368630166600b16a2e079241626932

-- 
View it on GitLab: https://salsa.debian.org/med-team/last-align/-/commit/6797dabf86368630166600b16a2e079241626932
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20201223/830bae62/attachment-0001.html>


More information about the debian-med-commit mailing list