constrainedWeightedSolution
Solve weighted least squares with optional linear constraints.
Developer documentation: this item describes internal implementation details.
Declaration
[xi,systemMatrix] = constrainedWeightedSolution(normalMatrix,rhs,Aeq,beq,Aineq,bineq)
Parameters
normalMatrixweighted normal-equation matrixrhsweighted right-hand sideAeqequality-constraint matrixbeqequality-constraint right-hand sideAineqinequality-constraint matrixbineqinequality-constraint right-hand side
Returns
xifitted coefficient vectorsystemMatrixsolved system matrix or quadratic Hessian proxy
Discussion
If only equality constraints are present, this forms and solves the KKT system
\[\begin{bmatrix} N & A_{\mathrm{eq}}^T \\ A_{\mathrm{eq}} & 0 \end{bmatrix} \begin{bmatrix} \xi \\ \lambda \end{bmatrix} = \begin{bmatrix} r \\ b_{\mathrm{eq}} \end{bmatrix}.\]If inequality constraints are also present, the method switches to quadprog and solves the equivalent convex quadratic program with Hessian N.