From b2838d0e725bb9f863eca8f47bdd0ee948257966 Mon Sep 17 00:00:00 2001 From: Pieter Pas Date: Tue, 9 Aug 2022 12:23:41 +0200 Subject: [PATCH] Fix sign compare warning --- src/include/alpaqa/inner/src/structured-panoc.tpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/include/alpaqa/inner/src/structured-panoc.tpp b/src/include/alpaqa/inner/src/structured-panoc.tpp index 59f9f3061b..30e0990798 100644 --- a/src/include/alpaqa/inner/src/structured-panoc.tpp +++ b/src/include/alpaqa/inner/src/structured-panoc.tpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -54,6 +55,7 @@ void StructuredPANOCLBFGSSolver::compute_quasi_newton_step( rvec work_m) { auto n = problem.n, m = problem.m; + auto un = static_cast>(n); J.clear(); // Find inactive indices J for (index_t i = 0; i < n; ++i) { @@ -68,8 +70,8 @@ void StructuredPANOCLBFGSSolver::compute_quasi_newton_step( } } - if (not J.empty()) { // There are inactive indices J - if (J.size() == n) { // There are no active indices K + if (not J.empty()) { // There are inactive indices J + if (J.size() == un) { // There are no active indices K qₖ = -grad_ψₖ; } else if (params.hessian_vec) { // There are active indices K if (params.hessian_vec_finite_differences) { @@ -115,7 +117,7 @@ void StructuredPANOCLBFGSSolver::compute_quasi_newton_step( // This seems to be better than just falling back to a projected // gradient step. if (not success) { - if (J.size() == n) + if (J.size() == un) qₖ *= γₖ; else for (auto j : J)