Skip to content

Commit

Permalink
Fix sign compare warning
Browse files Browse the repository at this point in the history
  • Loading branch information
tttapa committed Aug 9, 2022
1 parent ff14e9f commit b2838d0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/include/alpaqa/inner/src/structured-panoc.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <iomanip>
#include <iostream>
#include <stdexcept>
#include <type_traits>

#include <alpaqa/config/config.hpp>
#include <alpaqa/util/alloc-check.hpp>
Expand Down Expand Up @@ -54,6 +55,7 @@ void StructuredPANOCLBFGSSolver<Conf>::compute_quasi_newton_step(
rvec work_m) {

auto n = problem.n, m = problem.m;
auto un = static_cast<std::make_unsigned_t<decltype(n)>>(n);
J.clear();
// Find inactive indices J
for (index_t i = 0; i < n; ++i) {
Expand All @@ -68,8 +70,8 @@ void StructuredPANOCLBFGSSolver<Conf>::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) {
Expand Down Expand Up @@ -115,7 +117,7 @@ void StructuredPANOCLBFGSSolver<Conf>::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)
Expand Down

0 comments on commit b2838d0

Please sign in to comment.