Skip to main content

solve_cls

Function solve_cls 

Source
pub fn solve_cls<const NU: usize, const NC: usize>(
    a: &MatA<NC, NU>,
    b: &VecN<NC>,
    umin: &VecN<NU>,
    umax: &VecN<NU>,
    us: &mut VecN<NU>,
    ws: &mut [i8; NU],
    imax: usize,
) -> SolverStats
where Const<NC>: DimName + DimMin<Const<NU>, Output = Const<NU>>, Const<NU>: DimName, DefaultAllocator: Allocator<Const<NC>, Const<NU>> + Allocator<Const<NC>, Const<NC>> + Allocator<Const<NU>, Const<NU>> + Allocator<Const<NC>> + Allocator<Const<NU>>,
Expand description

General box-constrained least-squares solver.

Solves min ‖Au − b‖² subject to umin ≤ u ≤ umax using an active-set method with incremental QR updates (Givens rotations).

Unlike solve, this function does not require NC == NU + NV and accepts any NC ≥ NU. Use it with the unregularised setup functions (setup_a_unreg / setup_b_unreg) or with a custom A / b.