nnls ¤
NNLS solver utilities for passivity enforcement.
Provides the Lawson-Hanson augmented NNLS formulation used in RP_QRNNLS_Y.m. scipy.optimize.nnls is used as the underlying solver (LAPACK-based, no extra deps).
Functions:
| Name | Description |
|---|---|
solve_passivity_nnls | Solve the augmented NNLS problem for minimum-norm residue perturbation. |
solve_passivity_nnls ¤
Solve the augmented NNLS problem for minimum-norm residue perturbation.
Implements the Lawson-Hanson formulation from RP_QRNNLS_Y.m::
Augmented problem:
A = [E_mat | −c]ᵀ # (n+1, n_pairs)
f = [0, …, 0, 1] # (n+1,)
u = argmin_{u≥0} ‖A u − f‖
Recovery:
residual = f − A u
xbar = −residual[:n] / residual[n]
The formulation finds the smallest perturbation (in the pre-conditioned / R-factored space) that satisfies all passivity constraints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
E_mat | ndarray |
| required |
c | ndarray |
| required |
Returns:
| Name | Type | Description |
|---|---|---|
xbar | ndarray |
|