623 T& primal_feasibility_eq_rhs_0,
624 T& primal_feasibility_in_rhs_0,
625 T& dual_feasibility_rhs_0,
626 T& dual_feasibility_rhs_1,
627 T& dual_feasibility_rhs_3,
638 isize n = x_e.rows();
641 dual_residual_scaled = qp_scaled.g.to_eigen();
645 dual_residual_scaled += tmp;
647 precond.unscale_dual_residual_in_place(
648 { proxqp::from_eigen, tmp });
649 dual_feasibility_rhs_0 = infty_norm(tmp);
650 precond.unscale_primal_in_place({ proxqp::from_eigen, x_e });
651 results.info.duality_gap = x_e.dot(data.g);
652 rhs_duality_gap = std::fabs(results.info.duality_gap);
654 const T xHx = (tmp).dot(x_e);
655 results.info.duality_gap += xHx;
656 rhs_duality_gap = std::max(rhs_duality_gap, std::abs(xHx));
658 precond.scale_primal_in_place({ proxqp::from_eigen, x_e });
660 precond.unscale_dual_in_place_eq({ proxsuite::proxqp::from_eigen, y_e });
661 const T by = (data.b).dot(y_e);
662 results.info.duality_gap += by;
663 rhs_duality_gap = std::max(rhs_duality_gap, std::abs(by));
664 precond.scale_dual_in_place_eq({ proxsuite::proxqp::from_eigen, y_e });
666 precond.unscale_dual_in_place_in({ proxsuite::proxqp::from_eigen, z_e });
671 results.info.duality_gap += zl;
672 rhs_duality_gap = std::max(rhs_duality_gap, std::abs(zl));
677 results.info.duality_gap += zu;
678 rhs_duality_gap = std::max(rhs_duality_gap, std::abs(zu));
680 precond.scale_dual_in_place_in({ proxsuite::proxqp::from_eigen, z_e });
686 primal_residual_eq_scaled.setZero();
689 primal_residual_eq_scaled, ATy, qp_scaled.AT.to_eigen(), x_e, y_e);
691 dual_residual_scaled += ATy;
693 precond.unscale_dual_residual_in_place({ proxqp::from_eigen, ATy });
694 dual_feasibility_rhs_1 = infty_norm(ATy);
700 primal_residual_in_scaled_up.setZero();
703 primal_residual_in_scaled_up, CTz, qp_scaled.CT.to_eigen(), x_e, z_e);
705 dual_residual_scaled += CTz;
707 precond.unscale_dual_residual_in_place({ proxqp::from_eigen, CTz });
708 dual_feasibility_rhs_3 = infty_norm(CTz);
710 precond.unscale_primal_residual_in_place_eq(
711 { proxqp::from_eigen, primal_residual_eq_scaled });
712 primal_feasibility_eq_rhs_0 = infty_norm(primal_residual_eq_scaled);
714 precond.unscale_primal_residual_in_place_in(
715 { proxqp::from_eigen, primal_residual_in_scaled_up });
716 primal_feasibility_in_rhs_0 = infty_norm(primal_residual_in_scaled_up);
721 primal_residual_in_scaled_lo =
725 primal_residual_eq_scaled -= b;
726 T primal_feasibility_eq_lhs = infty_norm(primal_residual_eq_scaled);
727 T primal_feasibility_in_lhs = infty_norm(primal_residual_in_scaled_lo);
728 T primal_feasibility_lhs =
729 std::max(primal_feasibility_eq_lhs, primal_feasibility_in_lhs);
731 if ((settings.primal_infeasibility_solving &&
735 results.se = primal_residual_eq_scaled;
736 results.si = primal_residual_in_scaled_lo;
737 precond.unscale_primal_residual_in_place_eq(
738 { proxqp::from_eigen,
739 primal_residual_eq_scaled });
740 tmp.noalias() = qp_scaled.AT.to_eigen() * primal_residual_eq_scaled;
744 precond.unscale_primal_residual_in_place_in(
745 { proxqp::from_eigen,
746 primal_residual_in_scaled_lo });
747 tmp.noalias() += qp_scaled.CT.to_eigen() * primal_residual_in_scaled_lo;
749 precond.unscale_dual_residual_in_place({ proxqp::from_eigen, tmp });
751 primal_feasibility_lhs = infty_norm(tmp);
752 precond.scale_primal_residual_in_place_eq(
753 { proxqp::from_eigen, primal_residual_eq_scaled });
757 precond.scale_primal_residual_in_place_eq(
758 { proxqp::from_eigen, primal_residual_eq_scaled });
760 precond.scale_primal_residual_in_place_in(
761 { proxqp::from_eigen, primal_residual_in_scaled_up });
763 precond.unscale_dual_residual_in_place(
764 { proxqp::from_eigen, dual_residual_scaled });
765 T dual_feasibility_lhs = infty_norm(dual_residual_scaled);
766 precond.scale_dual_residual_in_place(
767 { proxqp::from_eigen, dual_residual_scaled });
769 return proxsuite::linalg::veg::tuplify(primal_feasibility_lhs,
770 dual_feasibility_lhs);