Skip to main content

compute_full_implicit_gradient

Function compute_full_implicit_gradient 

Source
pub fn compute_full_implicit_gradient(
    q: &[Vec<f64>],
    g: &[Vec<f64>],
    h: &[f64],
    a: &[Vec<f64>],
    x: &[f64],
    lam: &[f64],
    nu: &[f64],
    dl_dx: &[f64],
) -> OptimizeResult<ImplicitGradient>
Expand description

Compute the full implicit gradient dz*/dθ for a QP.

Given dl/dx (the upstream gradient from the loss), compute dl/dθ for θ = (Q, c, G, h, A, b) by solving:

(∂F/∂z)’ dz = -[dl/dx, 0, 0]’

and then computing dl/dθ = (∂F/∂θ)’ dz.

§Arguments

  • q – n×n cost matrix.
  • g – m×n inequality constraint matrix.
  • h – m inequality rhs.
  • a – p×n equality constraint matrix.
  • x – optimal primal solution.
  • lam – optimal inequality duals.
  • nu – optimal equality duals.
  • dl_dx – upstream gradient dl/dx (length n).

§Returns

The implicit gradients for all parameters.