# [Scipy-svn] r6228 - trunk/scipy/optimize

scipy-svn@scip... scipy-svn@scip...
Wed Feb 10 01:43:44 CST 2010

```Author: stefan
Date: 2010-02-10 01:43:44 -0600 (Wed, 10 Feb 2010)
New Revision: 6228

Modified:
trunk/scipy/optimize/nnls.py
Log:
DOC: Reformat NNLS docstring.

Modified: trunk/scipy/optimize/nnls.py
===================================================================
--- trunk/scipy/optimize/nnls.py	2010-02-10 07:43:04 UTC (rev 6227)
+++ trunk/scipy/optimize/nnls.py	2010-02-10 07:43:44 UTC (rev 6228)
@@ -2,22 +2,27 @@
from numpy import asarray_chkfinite, zeros, double

def nnls(A,b):
-    """
-          Solve  || Ax - b ||_2 -> min  with  x>=0
+    """
+    Solve ``argmin_x || Ax - b ||_2`` for ``x>=0``.

-          Inputs:
-                    A     --   matrix as above
-                    b     --   vector as above
+    Parameters
+    ----------
+    A : ndarray
+        Matrix ``A`` as shown above.
+    b : ndarray
+        Right-hand side vector.

-          Outputs:
-                    x     --   solution vector
-                    rnorm --  residual || Ax-b ||_2
+    Returns
+    -------
+    x : ndarray
+        Solution vector.
+    rnorm : float
+        The residual, ``|| Ax-b ||_2``.

+    Notes
+    -----
+    This is a wrapper for ``NNLS.F``.

-    wrapper around NNLS.F code below nnls/ directory
-
-    Check OpenOpt for more LLSP solvers
-
"""

A,b = map(asarray_chkfinite, (A,b))
@@ -26,7 +31,7 @@
raise ValueError, "expected matrix"
if len(b.shape)!=1:
raise ValueError, "expected vector"
-
+
m,n = A.shape

if m != b.shape[0]:

```