§
    fŠtjc  ã                   óf   — d dl ZddlmZ d dlmZmZ dgZ eddh¬¦  «        ded	œd
„¦   «         ZdS )é    Né   )Únnls)Ú_deprecate_positional_argsÚ_NoValuer   z1.18.0Úatol)ÚversionÚdeprecated_args)Úmaxiterr   c                ó¦  — t          j        | t           j        d¬¦  «        } t          j        |t           j        ¬¦  «        }t          | j        ¦  «        dk    rt          d| j        › �¦  «        ‚|j        dk    s|j        dk    r(|j        d         dk    rt          d|j        › �¦  «        ‚|j        dk    r%|j        d         dk    r|                     ¦   «         }| j        \  }}||j        d         k    r$t          d	d
|› d|j        d         f› �z   ¦  «        ‚|sd|z  }t          | ||¦  «        \  }}}|dk    rt          d¦  «        ‚||fS )a³  
    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``.
    atol : float, optional
        .. deprecated:: 1.18.0
            This parameter is deprecated and will be removed in SciPy 1.18.0.
            It is not used in the implementation.

    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 r   zDExpected a 1D array,(or 2D with one column), but the, shape of b is r   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Ú_nnlsÚRuntimeError)	ÚAÚbr
   r   ÚmÚnÚxÚrnormÚinfos	            úR/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/scipy/optimize/_nnls.pyr   r   	   sn  € õ| 	Ô˜Q¥b¤j¸Ð<Ñ<Ô<€AÝ
Ô˜Q¥b¤jÐ1Ñ1Ô1€Aå
ˆ1Œ7�|„|�qÒÐÝÐPÀqÄwÐPÐPÑQÔQÐQà	Œ�Š
ˆ
˜œ 1š˜¨1¬7°1¬:¸ª?¨?Ýð 5Ø+,¬7ð5ð 5ñ 6ô 6ð 	6à
Œ&�AŠ+ˆ+˜AœG AœJ¨!šO˜OØ�GŠG‰IŒIˆàŒ7�D€A€qàˆAŒG�AŒJ‚€ÝØBØE˜ÐEÐE°a´g¸a´j°^ÐEÐEñFñGô Gð 	Gð ð Ø�A‘#ˆÝ˜1˜a Ñ)Ô)�N€A€uˆdØˆq‚y€yÝÐBÑCÔCÐCàˆeˆ8€Oó    )	Únumpyr   Ú	_slsqplibr   r   Úscipy._lib.deprecationr   r   Ú__all__© r#   r"   ú<module>r)      s›   ðØ Ð Ð Ð Ø $Ð $Ð $Ð $Ð $Ð $Ø GÐ GÐ GÐ GÐ GÐ GÐ GÐ Gð ˆ(€ð Ð HØ-3¨Hð6ñ 6ô 6à Xð Uð Uð Uð Uñ6ô 6ðUð Uð Ur#   