File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,11 @@ global_primal_residual_infeasibility(VectorViewMut<T> ATdy,
227227 // u^T [dz]_+ - l^T[-dz]_+ <= -eps_p_inf ||unscaled(dz)||
228228 //
229229 // the variables in entry are changed in place
230+
231+ bool res = infty_norm (dy.to_eigen ()) != 0 && infty_norm (dz.to_eigen ()) != 0 ;
232+ if (!res) {
233+ return res;
234+ }
230235 ruiz.unscale_dual_residual_in_place (ATdy);
231236 ruiz.unscale_dual_residual_in_place (CTdz);
232237 T eq_inf = dy.to_eigen ().dot (qpwork.b_scaled );
@@ -238,9 +243,8 @@ global_primal_residual_infeasibility(VectorViewMut<T> ATdy,
238243 T bound_y = qpsettings.eps_primal_inf * infty_norm (dy.to_eigen ());
239244 T bound_z = qpsettings.eps_primal_inf * infty_norm (dz.to_eigen ());
240245
241- bool res = infty_norm (ATdy.to_eigen ()) <= bound_y && eq_inf <= -bound_y &&
242- infty_norm (CTdz.to_eigen ()) <= bound_z && in_inf <= -bound_z &&
243- infty_norm (dy.to_eigen ()) != 0 && infty_norm (dz.to_eigen ()) != 0 ;
246+ res = infty_norm (ATdy.to_eigen ()) <= bound_y && eq_inf <= -bound_y &&
247+ infty_norm (CTdz.to_eigen ()) <= bound_z && in_inf <= -bound_z;
244248 return res;
245249}
246250
Original file line number Diff line number Diff line change @@ -487,6 +487,11 @@ global_primal_residual_infeasibility(VectorViewMut<T> ATdy,
487487 // u^T [dz]_+ - l^T[-dz]_+ <= -eps_p_inf ||unscaled(dz)||
488488 //
489489 // the variables in entry are changed in place
490+
491+ bool res = infty_norm (dy.to_eigen ()) != 0 && infty_norm (dz.to_eigen ()) != 0 ;
492+ if (!res) {
493+ return res;
494+ }
490495 ruiz.unscale_dual_residual_in_place (ATdy);
491496 ruiz.unscale_dual_residual_in_place (CTdz);
492497 T eq_inf = dy.to_eigen ().dot (qp_scaled.b .to_eigen ());
@@ -498,9 +503,8 @@ global_primal_residual_infeasibility(VectorViewMut<T> ATdy,
498503 T bound_y = qpsettings.eps_primal_inf * infty_norm (dy.to_eigen ());
499504 T bound_z = qpsettings.eps_primal_inf * infty_norm (dz.to_eigen ());
500505
501- bool res = infty_norm (ATdy.to_eigen ()) <= bound_y && eq_inf <= -bound_y &&
502- infty_norm (CTdz.to_eigen ()) <= bound_z && in_inf <= -bound_z &&
503- infty_norm (dy.to_eigen ()) != 0 && infty_norm (dz.to_eigen ()) != 0 ;
506+ res = infty_norm (ATdy.to_eigen ()) <= bound_y && eq_inf <= -bound_y &&
507+ infty_norm (CTdz.to_eigen ()) <= bound_z && in_inf <= -bound_z;
504508 return res;
505509}
506510/* !
You can’t perform that action at this time.
0 commit comments