File: fix-32-bit-ftbfs.patch

package info (click to toggle)
cppnumericalsolvers 1.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 372 kB
  • sloc: cpp: 2,694; python: 236; sh: 20; makefile: 10
file content (22 lines) | stat: -rw-r--r-- 770 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
From 1435ef74f7750230973390520368dd0af65888a0 Mon Sep 17 00:00:00 2001
From: Nilesh Patra <nilesh@riseup.net>
Date: Sun, 27 Apr 2025 12:52:34 +0530
Subject: [PATCH] Prevent alpha from underflowing

---
 include/cppoptlib/linesearch/armijo.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/include/cppoptlib/linesearch/armijo.h
+++ b/include/cppoptlib/linesearch/armijo.h
@@ -29,8 +29,9 @@
         TVector grad(x.rows());
         objFunc.gradient(x, grad);
         const Scalar Cache = c * grad.dot(searchDir);
+        const Scalar alpha_min = 1e-8;
 
-        while(f > f_in + alpha * Cache) {
+        while(f > f_in + alpha * Cache && alpha > alpha_min) {
             alpha *= rho;
             f = objFunc.value(x + alpha * searchDir);
         }