Mercurial > octave
changeset 31266:e5e35410da90 stable
doc: Documented undocumented outputs for lsqnonneg and pqpnonneg
lsqnonneg.m: Edited docstring to describe what the output lambda was,
previously not documented. In the course of testing, an error was
found for an (unlikely) edge case. Marked that with FIXME for now.
pqpnonneg.m: Same as above.
author | Arun Giridhar <arungiridhar@gmail.com> |
---|---|
date | Thu, 06 Oct 2022 19:52:06 -0400 |
parents | 24247d13a44b |
children | 3c504176e546 44a68ac1a22f |
files | scripts/optimization/lsqnonneg.m scripts/optimization/pqpnonneg.m |
diffstat | 2 files changed, 18 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/optimization/lsqnonneg.m Sun Oct 02 09:00:05 2022 -0400 +++ b/scripts/optimization/lsqnonneg.m Thu Oct 06 19:52:06 2022 -0400 @@ -69,8 +69,10 @@ ## @end itemize ## ## @item lambda -## @c FIXME: Something is output from the function, but what is it? -## Undocumented output +## Conjugate gradient at the converged point. Zero elements are usually +## abutting coordinate planes. Negative elements are stable to small +## perturbations. +## ## @end table ## @seealso{pqpnonneg, lscov, optimset} ## @end deftypefn @@ -219,6 +221,11 @@ if (isargout (6)) lambda = zeros (size (x)); lambda(p) = w; + ## FIXME: The above line errors when the solution is NOT constrained + ## by non-negativity! That case happens when the lsqnonneg solution + ## is the same as the fminunc solution. Ideally the user would not + ## be using lsqnonneg if nonnegativity constraints are not active, but we + ## should handle that more gracefully. endif endfunction
--- a/scripts/optimization/pqpnonneg.m Sun Oct 02 09:00:05 2022 -0400 +++ b/scripts/optimization/pqpnonneg.m Thu Oct 06 19:52:06 2022 -0400 @@ -71,8 +71,10 @@ ## @end itemize ## ## @item lambda -## @c FIXME: Something is output from the function, but what is it? -## Undocumented output +## Conjugate gradient at the converged point. Zero elements are usually +## abutting coordinate planes. Negative elements are stable to small +## perturbations. +## ## @end table ## @seealso{lsqnonneg, qp, optimset} ## @end deftypefn @@ -223,6 +225,11 @@ if (isargout (5)) lambda = zeros (size (x)); lambda(p) = w; + ## FIXME: The above line errors when the solution is NOT constrained + ## by non-negativity! That case happens when the lsqnonneg solution + ## is the same as the fminunc solution. Ideally the user would not + ## be using lsqnonneg if nonnegativity constraints are not active, but we + ## should handle that more gracefully. endif endfunction