From 3fcb788d223eec24c0241680070c4a9a5ec71ef3 Mon Sep 17 00:00:00 2001 From: Nai-Yuan Chiang Date: Thu, 29 Apr 2021 20:40:05 -0400 Subject: [PATCH] fix scaling (#223) for when the Jacobian has empty rows --- src/Optimization/hiopNlpTransforms.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Optimization/hiopNlpTransforms.cpp b/src/Optimization/hiopNlpTransforms.cpp index df3ddf75a..cdc1aa9aa 100644 --- a/src/Optimization/hiopNlpTransforms.cpp +++ b/src/Optimization/hiopNlpTransforms.cpp @@ -392,16 +392,16 @@ hiopNLPObjGradScaling::hiopNLPObjGradScaling(const double max_grad, scale_factor_c = c.new_copy(); scale_factor_d = d.new_copy(); scale_factor_cd = LinearAlgebraFactory::createVector(n_eq + n_ineq); - + Jac_c.row_max_abs_value(*scale_factor_c); + scale_factor_c->scale(1./max_grad); + scale_factor_c->component_max(1.0); scale_factor_c->invert(); - scale_factor_c->scale(max_grad); - scale_factor_c->component_min(1.0); Jac_d.row_max_abs_value(*scale_factor_d); + scale_factor_d->scale(1./max_grad); + scale_factor_d->component_max(1.0); scale_factor_d->invert(); - scale_factor_d->scale(max_grad); - scale_factor_d->component_min(1.0); const double* eq_arr = scale_factor_c->local_data_const(); const double* ineq_arr = scale_factor_d->local_data_const();