summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGard Spreemann <gspr@nonempty.org>2020-07-30 10:26:31 +0200
committerGard Spreemann <gspr@nonempty.org>2020-07-30 10:26:31 +0200
commit81541d6210acd4521a9200d6ebee6fbc3de0f274 (patch)
tree08d1035f4da6890e4ddd28821ab1993bfa84a387
parent5806cb271b9d7a71abda698de695b18459f471a6 (diff)
Add patch from SciPy's upstream to fix NaN propagation.
-rw-r--r--debian/patches/0004-Fix-NaN-propagation.patch26
-rw-r--r--debian/patches/series1
2 files changed, 27 insertions, 0 deletions
diff --git a/debian/patches/0004-Fix-NaN-propagation.patch b/debian/patches/0004-Fix-NaN-propagation.patch
new file mode 100644
index 0000000..dae12ec
--- /dev/null
+++ b/debian/patches/0004-Fix-NaN-propagation.patch
@@ -0,0 +1,26 @@
+From: Gard Spreemann <gspr@nonempty.org>
+Date: Thu, 30 Jul 2020 10:25:38 +0200
+Subject: Fix NaN propagation.
+
+This is based on SciPy commit
+ 4eb242fabeef7d1871d21936bee275be4fda1844
+---
+ lbfgsb.f | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/lbfgsb.f b/lbfgsb.f
+index 7c6b7fc..501879b 100644
+--- a/lbfgsb.f
++++ b/lbfgsb.f
+@@ -2977,6 +2977,11 @@ c ************
+ sbgnrm = zero
+ do 15 i = 1, n
+ gi = g(i)
++ if (gi.ne.gi) then
++c NaN value in gradient: propagate it
++ sbgnrm = gi
++ return
++ endif
+ if (nbd(i) .ne. 0) then
+ if (gi .lt. zero) then
+ if (nbd(i) .ge. 2) gi = max((x(i)-u(i)),gi)
diff --git a/debian/patches/series b/debian/patches/series
index b3574bc..ed25a9a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
replace-linpack-with-lapack.patch
silence.patch
0003-Prevent-bound-violation.patch
+0004-Fix-NaN-propagation.patch