12 g_ŷ += (1 / Σ(0)) * y;
14 vtable.eval_proj_diff_g(self, g_ŷ, g_ŷ);
16 real_t dᵀŷ = Σ(0) * g_ŷ.dot(g_ŷ);
21 g_ŷ += Σ.asDiagonal().inverse() * y;
23 vtable.eval_proj_diff_g(self, g_ŷ, g_ŷ);
26 for (
index_t i = 0; i < y.size(); ++i) {
27 dᵀŷ += g_ŷ(i) * Σ(i) * g_ŷ(i);
28 g_ŷ(i) = Σ(i) * g_ŷ(i);
92 if (y.size() == 0 && vtable.
eval_hess_L != default_eval_hess_L)
93 return vtable.
eval_hess_L(self, x, y, scale, inner_idx, outer_ptr, H_values, vtable);
104template <Config Conf>
108 vtable.eval_grad_f(self, x, grad_fx);
109 return vtable.eval_f(self, x);
114template <Config Conf>
118 vtable.eval_g(self, x, g);
119 return vtable.eval_f(self, x);
124template <Config Conf>
135template <Config Conf>
147template <Config Conf>
152 return vtable.
eval_f(self, x);
154 auto f = vtable.
eval_f_g(self, x, ŷ, vtable);
155 auto dᵀŷ = calc_ŷ_dᵀŷ(self, ŷ, y, Σ, vtable);
157 auto ψ = f +
real_t(0.5) * dᵀŷ;
163template <Config Conf>
171 vtable.
eval_g(self, x, work_m);
172 (void)calc_ŷ_dᵀŷ(self, work_m, y, Σ, vtable);
173 vtable.
eval_grad_L(self, x, work_m, grad_ψ, work_n, vtable);
179template <Config Conf>
189 auto f = vtable.
eval_f_g(self, x, ŷ, vtable);
190 auto dᵀŷ = calc_ŷ_dᵀŷ(self, ŷ, y, Σ, vtable);
191 auto ψ = f +
real_t(0.5) * dᵀŷ;
193 vtable.
eval_grad_L(self, x, ŷ, grad_ψ, work_n, vtable);
198template <Config Conf>
203template <Config Conf>
208template <Config Conf>
typename Conf::real_t real_t
typename Conf::rindexvec rindexvec
typename Conf::index_t index_t
typename Conf::length_t length_t
typename Conf::crvec crvec
required_const_function_t< real_t(crvec x)> eval_f
optional_const_function_t< void(crvec x, crvec y, real_t scale, crvec v, rvec Hv)> eval_hess_L_prod
static real_t default_eval_ψ(const void *self, crvec x, crvec y, crvec Σ, rvec ŷ, const ProblemVTable &vtable)
optional_const_function_t< real_t(crvec x, rvec grad_fx)> eval_f_grad_f
static length_t default_get_hess_L_num_nonzeros(const void *, const ProblemVTable &)
static void default_eval_hess_L(const void *, crvec, crvec, real_t, rindexvec, rindexvec, rvec, const ProblemVTable &)
static void default_eval_hess_L_prod(const void *, crvec, crvec, real_t, crvec, rvec, const ProblemVTable &)
optional_const_function_t< void(crvec x, crvec y, rvec grad_L, rvec work_n)> eval_grad_L
static void default_eval_hess_ψ_prod(const void *self, crvec x, crvec y, crvec, real_t scale, crvec v, rvec Hv, const ProblemVTable &vtable)
static void default_eval_jac_g(const void *, crvec, rindexvec, rindexvec, rvec, const ProblemVTable &)
optional_const_function_t< real_t(crvec x, rvec g)> eval_f_g
static void default_eval_grad_gi(const void *, crvec, index_t, rvec, const ProblemVTable &)
static length_t default_get_jac_g_num_nonzeros(const void *, const ProblemVTable &)
static void default_eval_grad_ψ(const void *self, crvec x, crvec y, crvec Σ, rvec grad_ψ, rvec work_n, rvec work_m, const ProblemVTable &vtable)
required_const_function_t< void(crvec x, rvec gx)> eval_g
optional_const_function_t< void(crvec x, crvec y, real_t scale, rindexvec inner_idx, rindexvec outer_ptr, rvec H_values)> eval_hess_L
static const Box & default_get_box_C(const void *, const ProblemVTable &)
static void default_eval_grad_L(const void *self, crvec x, crvec y, rvec grad_L, rvec work_n, const ProblemVTable &vtable)
static const Box & default_get_box_D(const void *, const ProblemVTable &)
optional_const_function_t< void(crvec x, crvec y, rvec grad_f, rvec grad_gxy)> eval_grad_f_grad_g_prod
static real_t default_eval_f_g(const void *self, crvec x, rvec g, const ProblemVTable &vtable)
static void default_eval_hess_ψ(const void *self, crvec x, crvec y, crvec, real_t scale, rindexvec inner_idx, rindexvec outer_ptr, rvec H_values, const ProblemVTable &vtable)
static index_t default_eval_inactive_indices_res_lna(const void *, real_t, crvec, crvec, rindexvec, const ProblemVTable &)
static void default_check(const void *, const ProblemVTable &)
static real_t calc_ŷ_dᵀŷ(const void *self, rvec g_ŷ, crvec y, crvec Σ, const ProblemVTable &vtable)
static void default_eval_grad_f_grad_g_prod(const void *self, crvec x, crvec y, rvec grad_f, rvec grad_gxy, const ProblemVTable &vtable)
required_const_function_t< void(crvec x, crvec y, rvec grad_gxy)> eval_grad_g_prod
static real_t default_eval_f_grad_f(const void *self, crvec x, rvec grad_fx, const ProblemVTable &vtable)
required_const_function_t< void(crvec x, rvec grad_fx)> eval_grad_f
static length_t default_get_hess_ψ_num_nonzeros(const void *, const ProblemVTable &)
static real_t default_eval_ψ_grad_ψ(const void *self, crvec x, crvec y, crvec Σ, rvec grad_ψ, rvec work_n, rvec work_m, const ProblemVTable &vtable)