+
    nDj/
  ã                   ó.   € ^ RI t^RIHt R.tRR/R ltR# )é    N)Únnlsr   Úmaxiterc               ó–  € \         P                  ! V \         P                  RR7      p \         P                  ! V\         P                  R7      p\        V P                  4      ^8w  d   \        RV P                   24      hVP                  ^8”  g*   VP                  ^8X  d1   VP                  ^,          ^8w  d   \        RVP                   24      hVP                  ^8X  d)   VP                  ^,          ^8X  d   VP                  4       pV P                  w  r4W1P                  ^ ,          8w  d+   \        RRV RVP                  ^ ,          3 2,           4      hV^ 8X  d6   \         P                  ! ^ 4      \         P                  P                  V4      3# V'       g
   ^V,          p\        WV4      w  rVpV^8X  d   \        R	4      hWV3# )
aJ  
Solve ``argmin_x || Ax - b ||_2^2`` for ``x>=0``.

This problem, often called as NonNegative Least Squares, is a convex
optimization problem with convex constraints. It typically arises when
the ``x`` models quantities for which only nonnegative values are
attainable; weight of ingredients, component costs and so on.

Parameters
----------
A : (m, n) ndarray
    Coefficient array
b : (m,) ndarray, float
    Right-hand side vector.
maxiter : int, optional
    Maximum number of iterations, optional. Default value is ``3 * n``.

Returns
-------
x : ndarray
    Solution vector.
rnorm : float
    The 2-norm of the residual, ``|| Ax-b ||_2``.

See Also
--------
lsq_linear : Linear least squares with bounds on the variables

Notes
-----
The code is based on the classical algorithm of [1]_. It utilizes an active
set method and solves the KKT (Karush-Kuhn-Tucker) conditions for the
non-negative least squares problem.

References
----------
.. [1] : Lawson C., Hanson R.J., "Solving Least Squares Problems", SIAM,
   1995, :doi:`10.1137/1.9781611971217`

 Examples
--------
>>> import numpy as np
>>> from scipy.optimize import nnls
...
>>> A = np.array([[1, 0], [1, 0], [0, 1]])
>>> b = np.array([2, 1, 1])
>>> nnls(A, b)
(array([1.5, 1. ]), 0.7071067811865475)

>>> b = np.array([-1, -1, -1])
>>> nnls(A, b)
(array([0., 0.]), 1.7320508075688772)

ÚC)ÚdtypeÚorder)r   z+Expected a 2D array, but the shape of A is zDExpected a 1D array,(or 2D with one column), but the, shape of b is z0Incompatible dimensions. The first dimension of zA is z, while the shape of b is z%Maximum number of iterations reached.)ÚnpÚasarray_chkfiniteÚfloat64ÚlenÚshapeÚ
ValueErrorÚndimÚravelÚemptyÚlinalgÚnormÚ_nnlsÚRuntimeError)ÚAÚbr   ÚmÚnÚxÚrnormÚinfos   &&$     ÚN/data/cameron/venvs/s3viz/lib/python3.14/site-packages/scipy/optimize/_nnls.pyr   r      sl  € ôp 	×Ò˜Q¤b§j¡j¸Ô<€AÜ
×Ò˜Q¤b§j¡jÔ1€Aä
ˆ17‰7ƒ|qÔÜÐFÀqÇwÁwÀiÐPÓQÐQà	‰Œ
˜Ÿ™ 1œ¨1¯7©7°1­:¸¬?Üð +Ø+,¯7©7¨)ð5ó 6ð 	6à
&‰&AŒ+˜AŸG™G AJ¨!œOØG‰G‹Iˆà7‰7D€AàG‰GAJ„ÜØBØ˜sÐ4°a·g±g¸aµj°^Ð4DÐEõFóGð 	Gð 	ˆA„vÜ—’˜“œRŸY™YŸ^™^¨AÓ.Ð/Ð/çØA•#ˆÜ˜1 Ó)N€AˆdØˆq„yÜÐBÓCÐCàˆ8€Oó    )Únumpyr	   Ú	_slsqplibr   r   Ú__all__© r   r   Ú<module>r#      s"   ðÛ Ý $ð ˆ(€ðT˜$ö Tr   