summaryrefslogtreecommitdiff
path: root/debian/patches
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/0003-Prevent-bound-violation.patch27
-rw-r--r--debian/patches/0004-Fix-NaN-propagation.patch26
-rw-r--r--debian/patches/0005-Disable-printing-of-time.patch23
-rw-r--r--debian/patches/0006-Stop-generating-iteration-log-files.patch113
-rw-r--r--debian/patches/replace-linpack-with-lapack.patch24
-rw-r--r--debian/patches/series4
-rw-r--r--debian/patches/silence.patch14
7 files changed, 222 insertions, 9 deletions
diff --git a/debian/patches/0003-Prevent-bound-violation.patch b/debian/patches/0003-Prevent-bound-violation.patch
new file mode 100644
index 0000000..04a4acc
--- /dev/null
+++ b/debian/patches/0003-Prevent-bound-violation.patch
@@ -0,0 +1,27 @@
+From: Gard Spreemann <gspr@nonempty.org>
+Date: Thu, 30 Jul 2020 10:15:21 +0200
+Subject: Prevent bound violation.
+
+This is based on SciPy's commits
+ cb9ed45d1a25d77204c737a8e1489dfb9606241f
+ e5ffa787555a60caf2ed9d0046a9ab782457fea4
+---
+ lbfgsb.f | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/lbfgsb.f b/lbfgsb.f
+index 008370d..7c6b7fc 100644
+--- a/lbfgsb.f
++++ b/lbfgsb.f
+@@ -2569,8 +2569,11 @@ c Line search is impossible.
+ if (stp .eq. one) then
+ call dcopy(n,z,1,x,1)
+ else
++c take step and prevent rounding error beyond bound
+ do 41 i = 1, n
+ x(i) = stp*d(i) + t(i)
++ if (nbd(i).eq.1.or.nbd(i).eq.2) x(i) = max(x(i), l(i))
++ if (nbd(i).eq.2.or.nbd(i).eq.3) x(i) = min(x(i), u(i))
+ 41 continue
+ endif
+ else
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/0005-Disable-printing-of-time.patch b/debian/patches/0005-Disable-printing-of-time.patch
new file mode 100644
index 0000000..9f84bf4
--- /dev/null
+++ b/debian/patches/0005-Disable-printing-of-time.patch
@@ -0,0 +1,23 @@
+From: Gard Spreemann <gspr@nonempty.org>
+Date: Thu, 30 Jul 2020 10:30:09 +0200
+Subject: Disable printing of time.
+
+Per SciPy commit
+ 04cd360b25c4bb1b831895f51b653ac282afc78c
+---
+ lbfgsb.f | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/lbfgsb.f b/lbfgsb.f
+index 501879b..59f0a97 100644
+--- a/lbfgsb.f
++++ b/lbfgsb.f
+@@ -2873,8 +2873,6 @@ c ************
+ if (info .eq. -8) write (6,9018)
+ if (info .eq. -9) write (6,9019)
+ endif
+- if (iprint .ge. 1) write (6,3007) cachyt,sbtime,lnscht
+- write (6,3008) time
+ if (iprint .ge. 1) then
+ if (info .eq. -4 .or. info .eq. -9) then
+ write (itfile,3002)
diff --git a/debian/patches/0006-Stop-generating-iteration-log-files.patch b/debian/patches/0006-Stop-generating-iteration-log-files.patch
new file mode 100644
index 0000000..efff3f1
--- /dev/null
+++ b/debian/patches/0006-Stop-generating-iteration-log-files.patch
@@ -0,0 +1,113 @@
+From: Gard Spreemann <gspr@nonempty.org>
+Date: Mon, 13 Dec 2021 14:56:07 +0100
+Subject: Stop generating iteration log files
+
+Based on SciPy commit c3c54c15eafe7fa7a2b7a499cb64f38f1a7ee057
+---
+ lbfgsb.f | 37 ++-----------------------------------
+ 1 file changed, 2 insertions(+), 35 deletions(-)
+
+diff --git a/lbfgsb.f b/lbfgsb.f
+index 59f0a97..18d4715 100644
+--- a/lbfgsb.f
++++ b/lbfgsb.f
+@@ -140,8 +140,6 @@ c 0<iprint<99 print also f and |proj g| every iprint iterations;
+ c iprint=99 print details of every iteration except n-vectors;
+ c iprint=100 print also the changes of active set and final x;
+ c iprint>100 print details of every iteration including x and g;
+-c When iprint > 0, the file iterate.dat will be created to
+-c summarize the iteration.
+ c
+ c csave is a working string of characters of length 60.
+ c
+@@ -426,8 +424,6 @@ c 0<iprint<99 print also f and |proj g| every iprint iterations;
+ c iprint=99 print details of every iteration except n-vectors;
+ c iprint=100 print also the changes of active set and final x;
+ c iprint>100 print details of every iteration including x and g;
+-c When iprint > 0, the file iterate.dat will be created to
+-c summarize the iteration.
+ c
+ c csave is a working string of characters of length 60.
+ c
+@@ -547,10 +543,8 @@ c 'info' records the termination information.
+ info = 0
+
+ itfile = 8
+- if (iprint .ge. 1) then
+-c open a summary file 'iterate.dat'
+- open (8, file = 'iterate.dat', status = 'unknown')
+- endif
++c Originally a file named iterate.dat was created. We disable
++c this behavior in Debian.
+
+ c Check the input arguments for errors.
+
+@@ -646,7 +640,6 @@ c Compute the infinity norm of the (-) projected gradient.
+
+ if (iprint .ge. 1) then
+ write (6,1002) iter,f,sbgnrm
+- write (itfile,1003) iter,nfgv,sbgnrm,f
+ endif
+ if (sbgnrm .le. pgtol) then
+ c terminate the algorithm.
+@@ -1361,8 +1354,6 @@ c 0<iprint<99 print also f and |proj g| every iprint iterations;
+ c iprint=99 print details of every iteration except n-vectors;
+ c iprint=100 print also the changes of active set and final x;
+ c iprint>100 print details of every iteration including x and g;
+-c When iprint > 0, the file iterate.dat will be created to
+-c summarize the iteration.
+ c
+ c sbgnrm is a double precision variable.
+ c On entry sbgnrm is the norm of the projected gradient at x.
+@@ -2705,9 +2696,6 @@ c ************
+ write (6,7001) epsmch
+ write (6,*) 'N = ',n,' M = ',m
+ if (iprint .ge. 1) then
+- write (itfile,2001) epsmch
+- write (itfile,*)'N = ',n,' M = ',m
+- write (itfile,9001)
+ if (iprint .gt. 100) then
+ write (6,1004) 'L =',(l(i),i = 1,n)
+ write (6,1004) 'X0 =',(x(i),i = 1,n)
+@@ -2798,8 +2786,6 @@ c the truncated Newton step has been used.
+ imod = mod(iter,iprint)
+ if (imod .eq. 0) write (6,2001) iter,f,sbgnrm
+ endif
+- if (iprint .ge. 1) write (itfile,3001)
+- + iter,nfgv,nseg,nact,word,iback,stp,xstep,sbgnrm,f
+
+ 1004 format (/,a4, 1p, 6(1x,d11.4),/,(4x,1p,6(1x,d11.4)))
+ 2001 format
+@@ -2873,23 +2859,6 @@ c ************
+ if (info .eq. -8) write (6,9018)
+ if (info .eq. -9) write (6,9019)
+ endif
+- if (iprint .ge. 1) then
+- if (info .eq. -4 .or. info .eq. -9) then
+- write (itfile,3002)
+- + iter,nfgv,nseg,nact,word,iback,stp,xstep
+- endif
+- write (itfile,3009) task
+- if (info .ne. 0) then
+- if (info .eq. -1) write (itfile,9011)
+- if (info .eq. -2) write (itfile,9012)
+- if (info .eq. -3) write (itfile,9013)
+- if (info .eq. -4) write (itfile,9014)
+- if (info .eq. -5) write (itfile,9015)
+- if (info .eq. -8) write (itfile,9018)
+- if (info .eq. -9) write (itfile,9019)
+- endif
+- write (itfile,3008) time
+- endif
+ endif
+
+ 1004 format (/,a4, 1p, 6(1x,d11.4),/,(4x,1p,6(1x,d11.4)))
+@@ -3152,8 +3121,6 @@ c 0<iprint<99 print also f and |proj g| every iprint iterations;
+ c iprint=99 print details of every iteration except n-vectors;
+ c iprint=100 print also the changes of active set and final x;
+ c iprint>100 print details of every iteration including x and g;
+-c When iprint > 0, the file iterate.dat will be created to
+-c summarize the iteration.
+ c
+ c info is an integer variable.
+ c On entry info is unspecified.
diff --git a/debian/patches/replace-linpack-with-lapack.patch b/debian/patches/replace-linpack-with-lapack.patch
index 83e3261..a875ea2 100644
--- a/debian/patches/replace-linpack-with-lapack.patch
+++ b/debian/patches/replace-linpack-with-lapack.patch
@@ -1,11 +1,21 @@
+From: Gard Spreemann <gspr@nonempty.org>
+Date: Thu, 30 Jul 2020 09:57:45 +0200
+Subject: replace-linpack-with-lapack
+
The library code originally uses LINPACK (from an embedded
copy). Since LINPACK has largely been superseded by LAPACK, this patch
replaces calls to the former with equivalent calls to the
latter. Specifically, dpofa is replaced by dpotrf, and dtrsl is
replaced by dtrtrs.
+---
+ lbfgsb.f | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/lbfgsb.f b/lbfgsb.f
+index 9c9e7d9..54fd1f9 100644
--- a/lbfgsb.f
+++ b/lbfgsb.f
-@@ -1185,7 +1185,7 @@
+@@ -1185,7 +1185,7 @@ c solve Jp2=v2+LD^(-1)v1.
p(i2) = v(i2) + sum
20 continue
c Solve the triangular system
@@ -14,7 +24,7 @@ replaced by dtrtrs.
if (info .ne. 0) return
c solve D^(1/2)p1=v1.
-@@ -1197,7 +1197,7 @@
+@@ -1197,7 +1197,7 @@ c PART II: solve [ -D^(1/2) D^(-1/2)*L' ] [ p1 ] = [ p1 ]
c [ 0 J' ] [ p2 ] [ p2 ].
c solve J^Tp2=p2.
@@ -23,7 +33,7 @@ replaced by dtrtrs.
if (info .ne. 0) return
c compute p1=-D^(-1/2)(p1-D^(-1/2)L'p2)
-@@ -2135,7 +2135,7 @@
+@@ -2135,7 +2135,7 @@ c [(-L_a +R_z)L'^-1 S'AA'S*theta ]
c first Cholesky factor (1,1) block of wn to get LL'
c with L' stored in the upper triangle of wn.
@@ -32,7 +42,7 @@ replaced by dtrtrs.
if (info .ne. 0) then
info = -1
return
-@@ -2143,7 +2143,7 @@
+@@ -2143,7 +2143,7 @@ c with L' stored in the upper triangle of wn.
c then form L^-1(-L_a'+R_z') in the (1,2) block.
col2 = 2*col
do 71 js = col+1 ,col2
@@ -41,7 +51,7 @@ replaced by dtrtrs.
71 continue
c Form S'AA'S*theta + (L^-1(-L_a'+R_z'))'L^-1(-L_a'+R_z') in the
-@@ -2158,7 +2158,7 @@
+@@ -2158,7 +2158,7 @@ c upper triangle of (2,2) block of wn.
c Cholesky factorization of (2,2) block of wn.
@@ -50,7 +60,7 @@ replaced by dtrtrs.
if (info .ne. 0) then
info = -2
return
-@@ -2227,7 +2227,7 @@
+@@ -2227,7 +2227,7 @@ c store T in the upper triangle of the array wt.
c Cholesky factorize T to J*J' with
c J' stored in the upper triangle of wt.
@@ -59,7 +69,7 @@ replaced by dtrtrs.
if (info .ne. 0) then
info = -3
endif
-@@ -3208,12 +3208,12 @@
+@@ -3208,12 +3208,12 @@ c Compute wv:=K^(-1)wv.
m2 = 2*m
col2 = 2*col
diff --git a/debian/patches/series b/debian/patches/series
index 6d5db6c..cd4d11e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,6 @@
replace-linpack-with-lapack.patch
silence.patch
+0003-Prevent-bound-violation.patch
+0004-Fix-NaN-propagation.patch
+0005-Disable-printing-of-time.patch
+0006-Stop-generating-iteration-log-files.patch
diff --git a/debian/patches/silence.patch b/debian/patches/silence.patch
index 828b96c..7d34a63 100644
--- a/debian/patches/silence.patch
+++ b/debian/patches/silence.patch
@@ -1,3 +1,7 @@
+From: Gard Spreemann <gspr@nonempty.org>
+Date: Thu, 30 Jul 2020 09:57:45 +0200
+Subject: silence
+
The library's documentation indicates that it will only write out
messages when the iprint flag is greater than zero. There are two
places where writing still happens unconditionally, which this patch
@@ -5,9 +9,15 @@ fixes.
A similar patch was also applied by the SciPy project (see their issue
3238).
+---
+ lbfgsb.f | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/lbfgsb.f b/lbfgsb.f
+index 54fd1f9..008370d 100644
--- a/lbfgsb.f
+++ b/lbfgsb.f
-@@ -2550,7 +2550,9 @@
+@@ -2550,7 +2550,9 @@ c Determine the maximum step length.
if (gd .ge. zero) then
c the directional derivative >=0.
c Line search is impossible.
@@ -18,7 +28,7 @@ A similar patch was also applied by the SciPy project (see their issue
info = -4
return
endif
-@@ -3279,8 +3281,10 @@
+@@ -3279,8 +3281,10 @@ c
55 continue
if ( dd_p .gt.zero ) then
call dcopy( n, xp, 1, x, 1 )