1function keep = qrf_independent_rows(A, tol)
2% QRF_INDEPENDENT_ROWS Indices of a maximal independent subset of A
's rows.
4% KEEP = QRF_INDEPENDENT_ROWS(A) selects by column-pivoted QR of A', so
the
5% retained rows are
the numerically best-conditioned independent set rather
6% than simply
the first ones encountered.
8% The QRF equality block
is heavily redundant, carrying about twice as many
9% rows as its rank, and both quadprog (MATLAB) and SLSQP (Python) degrade on
10%
the rank-deficient system. Dropping dependent rows changes no feasible
11% point: they are exact linear combinations of
the retained ones. This
is the
12% MATLAB counterpart of qrf_noblo_common.independent_rows.
18[~, R,
P] = qr(full(A)
', 0);
24if nargin < 2 || isempty(tol)
25 tol = max(size(A)) * eps * d(1);
27keep = sort(P(1:sum(d > tol)));