Skip to content

Commit

Permalink
fix scaling (#223)
Browse files Browse the repository at this point in the history
for when the Jacobian has empty rows
  • Loading branch information
nychiang authored Apr 30, 2021
1 parent 83c87f6 commit 3fcb788
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Optimization/hiopNlpTransforms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 3fcb788

Please sign in to comment.