403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.37
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/scipy/optimize/_lsq/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/scipy/optimize/_lsq/__pycache__/common.cpython-311.pyc
�

d�c~P��6�dZddlmZddlZddlmZddlmZm	Z	m
Z
ddlmZddl
mZmZeje��jZd�Z		d&d�Zd�Zd
�Zd'd�Zd(d�Zd)d�Zd�Zd�Zd*d�Zd*d�Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$d�Z%d)d�Z&d�Z'd�Z(d �Z)d+d"�Z*d+d#�Z+d$�Z,d%�Z-dS),z+Functions used by least-squares algorithms.�)�copysignN)�norm)�
cho_factor�	cho_solve�LinAlgError)�issparse)�LinearOperator�aslinearoperatorc�r�tj||��}|dkrtd���tj||��}tj||��|dzz
}|dkrtd���tj||z||zz
��}|t	||��z}||z}||z}	||	kr||	fS|	|fS)aqFind the intersection of a line with the boundary of a trust region.

    This function solves the quadratic equation with respect to t
    ||(x + s*t)||**2 = Delta**2.

    Returns
    -------
    t_neg, t_pos : tuple of float
        Negative and positive roots.

    Raises
    ------
    ValueError
        If `s` is zero or `x` is not within the trust region.
    rz`s` is zero.�z#`x` is not within the trust region.)�np�dot�
ValueError�sqrtr)
�x�s�Delta�a�b�c�d�q�t1�t2s
          �</usr/lib/python3/dist-packages/scipy/optimize/_lsq/common.py�intersect_trust_regionrs��� 	��q�!���A��A�v�v���(�(�(�
��q�!���A�
��q�!���u�a�x��A��1�u�u��>�?�?�?�
���!��a��c�	���A��h�q�!�n�n�
��A�	
�Q��B�	
�Q��B�	�B�w�w��2�v�
��2�v�
��{�G�z�?�
c	��d�}	||z}
||kr t|z|dz}|d|k}nd}|r1|�||z��}
t|
��|kr|
ddfSt|
��|z}|r|	d|
||��\}}||z}nd}|�|s |dkrtd|z||zdz��}n|}t	|��D]�}||ks||krtd|z||zdz��}|	||
||��\}}|dkr|}||z}t|||z
��}|||z|z|zz}tj|��||zkrn��|�|
|d	z|zz��}
|
|t|
��zz}
|
||d
zfS)a�Solve a trust-region problem arising in least-squares minimization.

    This function implements a method described by J. J. More [1]_ and used
    in MINPACK, but it relies on a single SVD of Jacobian instead of series
    of Cholesky decompositions. Before running this function, compute:
    ``U, s, VT = svd(J, full_matrices=False)``.

    Parameters
    ----------
    n : int
        Number of variables.
    m : int
        Number of residuals.
    uf : ndarray
        Computed as U.T.dot(f).
    s : ndarray
        Singular values of J.
    V : ndarray
        Transpose of VT.
    Delta : float
        Radius of a trust region.
    initial_alpha : float, optional
        Initial guess for alpha, which might be available from a previous
        iteration. If None, determined automatically.
    rtol : float, optional
        Stopping tolerance for the root-finding procedure. Namely, the
        solution ``p`` will satisfy ``abs(norm(p) - Delta) < rtol * Delta``.
    max_iter : int, optional
        Maximum allowed number of iterations for the root-finding procedure.

    Returns
    -------
    p : ndarray, shape (n,)
        Found solution of a trust-region problem.
    alpha : float
        Positive value such that (J.T*J + alpha*I)*p = -J.T*f.
        Sometimes called Levenberg-Marquardt parameter.
    n_iter : int
        Number of iterations made by root-finding procedure. Zero means
        that Gauss-Newton step was selected as the solution.

    References
    ----------
    .. [1] More, J. J., "The Levenberg-Marquardt Algorithm: Implementation
           and Theory," Numerical Analysis, ed. G. A. Watson, Lecture Notes
           in Mathematics 630, Springer Verlag, pp. 105-116, 1977.
    c��|dz|z}t||z��}||z
}tj|dz|dzz��|z}||fS)z�Function of which to find zero.

        It is defined as "norm of regularized (by alpha) least-squares
        solution minus `Delta`". Refer to [1]_.
        r�)rr
�sum)�alpha�sufrr�denom�p_norm�phi�	phi_primes        r�phi_and_derivativez2solve_lsq_trust_region.<locals>.phi_and_derivativejsY���1��u����c�E�k�"�"���u�n���V�C�1�H�u�a�x�/�0�0�0�6�9�	��I�~�rr���FgNg����MbP?��?r�)�EPSrr�max�ranger
�abs)�n�m�ufr�Vr�
initial_alpha�rtol�max_iterr*r%�	threshold�	full_rank�p�alpha_upperr(r)�alpha_lowerr$�it�ratios                     r�solve_lsq_trust_regionr@9s��b
�
�
��b�&�C�	�A�v�v��!�G�a��d�N�	��b�E�I�%�	�	��	���
�U�U�2��6�]�]�N����7�7�e����c�1�9���s�)�)�e�#�K���+�+�C��a��?�?���Y��d�Y�&�������I��-�1�2D�2D��E�K�'�+��*C�c�)I�J�J������H�o�o�����;���%�+�"5�"5����+�k�K�.G�#�-M�N�N�E�+�+�E�3��5�A�A���Y���7�7��K��i����+�u�u�}�5�5��
�#��+��&��.�.��
�6�#�;�;����%�%��E�&�
���s�a��d�U�l�#�	$�	$�$�A�
���a�����A��e�R�!�V��rc�X�	t|��\}}t||f|��}tj||��|dzkr|dfSn#t$rYnwxYw|d|dzz}|d|dzz}|d|dzz}|d|z}	|d|z}
tj||	zd||z
|
zzd|zd||z|
zz||	z
g��}tj|��}tj|tj|����}|tj	d|zd|dzzzd|dzz
d|dzzzf��z}d	tj
||�|��zd�
��ztj||��z}
tj|
��}|dd�|f}|dfS)
azSolve a general trust-region problem in 2 dimensions.

    The problem is reformulated as a 4th order algebraic equation,
    the solution of which is found by numpy.roots.

    Parameters
    ----------
    B : ndarray, shape (2, 2)
        Symmetric matrix, defines a quadratic term of the function.
    g : ndarray, shape (2,)
        Defines a linear term of the function.
    Delta : float
        Radius of a trust region.

    Returns
    -------
    p : ndarray, shape (2,)
        Found solution.
    newton_step : bool
        Whether the returned solution is the Newton step which lies within
        the trust region.
    rT)rr)rr-)r-r-rr-�r,��axisNF)rrr
rr�array�roots�real�isreal�vstackr#�argmin)�B�gr�R�lowerr;rrrr�f�coeffs�t�value�is               r�solve_trust_region_2drT�s���.
��a�=�=���5�
��5�z�1�
%�
%�%��
�6�!�Q�<�<�5�!�8�#�#��d�7�N�$���
�
�
���
����	
�$��%��(��A�	�$��%��(��A�	�$��%��(��A�	�!��u��A�	�!��u��A�
�X�
��a���a�!�e�a�i��!�a�%��q�b�1�f�q�j�)9�A�2��6�B�D�D�F�
�����A�
���"�)�A�,�,�� � �A�
��	�1�q�5�A��1��H�-��A�q�D��Q��A��X�/F�G�H�H�H�A��"�&��Q�U�U�1�X�X��A�.�.�.�.����1���=�E�
�	�%���A�	�!�!�!�Q�$��A��e�8�Os�AA�
A�Ac�~�|dkr||z}n||cxkrdkrnnd}nd}|dkrd|z}n
|dkr|r|dz}||fS)z�Update the radius of a trust region based on the cost reduction.

    Returns
    -------
    Delta : float
        New radius.
    ratio : float
        Ratio between actual and predicted reductions.
    rr-��?g�?g@�)r�actual_reduction�predicted_reduction�	step_norm�	bound_hitr?s      r�update_tr_radiusr\�s����Q��� �#6�6���	� 0�	5�	5�	5�	5�A�	5�	5�	5�	5�	5�������t�|�|��y� ���	����)��
�����%�<�rc��|�|��}tj||��}|�|tj||z|��z
}|dz}tj||��}|��|�|��}|tj||��z
}dtj||��ztj||��z}	|�9|tj||z|��z
}|	dtj||z|��zz
}	|||	fS||fS)a�Parameterize a multivariate quadratic function along a line.

    The resulting univariate quadratic function is given as follows::

        f(t) = 0.5 * (s0 + s*t).T * (J.T*J + diag) * (s0 + s*t) +
               g.T * (s0 + s*t)

    Parameters
    ----------
    J : ndarray, sparse matrix or LinearOperator shape (m, n)
        Jacobian matrix, affects the quadratic term.
    g : ndarray, shape (n,)
        Gradient, defines the linear term.
    s : ndarray, shape (n,)
        Direction vector of a line.
    diag : None or ndarray with shape (n,), optional
        Addition diagonal part, affects the quadratic term.
        If None, assumed to be 0.
    s0 : None or ndarray with shape (n,), optional
        Initial point. If None, assumed to be 0.

    Returns
    -------
    a : float
        Coefficient for t**2.
    b : float
        Coefficient for t.
    c : float
        Free term. Returned only if `s0` is provided.
    Nr,)rr
)
�JrLr�diag�s0�vrr�urs
          r�build_quadratic_1drc�s���>	
���a���A�
��q�!���A���	�R�V�A��H�a�
 �
 � ����H�A�
��q�!���A�	�~�
�E�E�"�I�I��	�R�V�A�q�\�\����"�&��A�,�,�����2���.����
����T�	�1�%�%�%�A�
��r�v�b�4�i��,�,�,�,�A��!�Q�w���!�t�rc��||g}|dkr-d|z|z}||cxkr|krnn|�|��tj|��}|||z|zz|z}tj|��}||||fS)z�Minimize a 1-D quadratic function subject to bounds.

    The free term `c` is 0 by default. Bounds must be finite.

    Returns
    -------
    t : float
        Minimum point.
    y : float
        Minimum value.
    rg�)�appendr
�asarrayrJ)	rr�lb�ubrrQ�extremum�y�	min_indexs	         r�minimize_quadratic_1drl.s���
�R��A��A�v�v��!�8�a�<��
������2������
�H�H�X����
�
�1�
�
�A�	�Q��U�Q�Y��!��A��	�!���I��Y�<��9��%�%rc��|jdkrH|�|��}tj||��}|�|tj||z|��z
}nT|�|j��}tj|dzd���}|�|tj||dzzd���z
}tj||��}d|z|zS)a�Compute values of a quadratic function arising in least squares.

    The function is 0.5 * s.T * (J.T * J + diag) * s + g.T * s.

    Parameters
    ----------
    J : ndarray, sparse matrix or LinearOperator, shape (m, n)
        Jacobian matrix, affects the quadratic term.
    g : ndarray, shape (n,)
        Gradient, defines the linear term.
    s : ndarray, shape (k, n) or (n,)
        Array containing steps as rows.
    diag : ndarray, shape (n,), optional
        Addition diagonal part, affects the quadratic term.
        If None, assumed to be 0.

    Returns
    -------
    values : ndarray with shape (k,) or float
        Values of the function. If `s` was 2-D, then ndarray is
        returned, otherwise, float is returned.
    r-NrrrCr,)�ndimrr
�Tr#)r^rLrr_�Jsr�ls       r�evaluate_quadraticrrEs���.	�v��{�{�
�U�U�1�X�X���F�2�r�N�N����
����D��!�$�$�$�A��
�U�U�1�3�Z�Z���F�2�q�5�q�!�!�!����
����q�!�t��!�,�,�,�,�A�
��q�!���A���7�Q�;�rc�@�tj||k||kz��S)z$Check if a point lies within bounds.)r
�all)rrgrhs   r�	in_boundsruos��
�6�1��7�q�B�w�'�(�(�(rc�
�tj|��}||}tj|��}|�tj��tjd���5tj||z
||z||z
||z��||<ddd��n#1swxYwYtj|��}|tj||��tj	|���
t��zfS)a�Compute a min_step size required to reach a bound.

    The function computes a positive scalar t, such that x + s * t is on
    the bound.

    Returns
    -------
    step : float
        Computed step. Non-negative value.
    hits : ndarray of int with shape of x
        Each element indicates whether a corresponding variable reaches the
        bound:

             *  0 - the bound was not hit.
             * -1 - the lower bound was hit.
             *  1 - the upper bound was hit.
    �ignore)�overN)r
�nonzero�
empty_like�fill�inf�errstate�maximum�min�equal�sign�astype�int)rrrgrh�non_zero�
s_non_zero�steps�min_steps        r�step_size_to_boundr�ts/��$�z�!�}�}�H��8��J��M�!���E�	�J�J�r�v����	��(�	#�	#�	#�F�F��*�b�1�f�h�%7�*�%D�&(�1�f�h�%7�*�%D�F�F��h��F�F�F�F�F�F�F�F�F�F�F����F�F�F�F��v�e�}�}�H��R�X�e�X�.�.������1B�1B�3�1G�1G�G�G�Gs�%1B"�"B&�)B&绽���|�=c��tj|t���}|dkrd|||k<d|||k<|S||z
}||z
}|tjdtj|����z}|tjdtj|����z}tj|��|tj||��kz}	d||	<tj|��|tj||��kz}
d||
<|S)a�Determine which constraints are active in a given point.

    The threshold is computed using `rtol` and the absolute value of the
    closest bound.

    Returns
    -------
    active : ndarray of int with shape of x
        Each component shows whether the corresponding constraint is active:

             *  0 - a constraint is not active.
             * -1 - a lower bound is active.
             *  1 - a upper bound is active.
    ��dtyperr+r-)r
�
zeros_liker�r~r1�isfinite�minimum)rrgrhr7�active�
lower_dist�
upper_dist�lower_threshold�upper_threshold�lower_active�upper_actives           r�find_active_constraintsr��s����]�1�C�
(�
(�
(�F��q�y�y���q�B�w����q�B�w���
��R��J��a��J��R�Z��2�6�"�:�:�6�6�6�O��R�Z��2�6�"�:�:�6�6�6�O��K��O�O��2�:�j�/�#J�#J�J�L�L��F�<���K��O�O��2�:�j�/�#J�#J�J�L�L��F�<���Mrc	�|�|���}t||||��}tj|d��}tj|d��}|dkrItj||||��||<tj||||��||<nx|||tjdtj||����zz||<|||tjdtj||����zz
||<||k||kz}d||||zz||<|S)z�Shift a point to the interior of a feasible region.

    Each element of the returned vector is at least at a relative distance
    `rstep` from the closest bound. If ``rstep=0`` then `np.nextafter` is used.
    r+r-rr,)�copyr�r
r��	nextafterr~r1)	rrgrh�rstep�x_newr��
lower_mask�
upper_mask�tight_boundss	         r�make_strictly_feasibler��s1��
�F�F�H�H�E�
$�Q��B��
6�
6�F���&�"�%�%�J���&�!�$�$�J���z�z��L��J���J��H�H��j���L��J���J��H�H��j����
�^�"�R�Z��2�6�"�Z�.�3I�3I�%J�%J�J�K��j���
�^�"�R�Z��2�6�"�Z�.�3I�3I�%J�%J�J�K��j���B�J�5�2�:�.�L���L�!1�B�|�4D�!D�E�E�,���Lrc�*�tj|��}tj|��}|dktj|��z}||||z
||<d||<|dktj|��z}||||z
||<d||<||fS)a4Compute Coleman-Li scaling vector and its derivatives.

    Components of a vector v are defined as follows::

               | ub[i] - x[i], if g[i] < 0 and ub[i] < np.inf
        v[i] = | x[i] - lb[i], if g[i] > 0 and lb[i] > -np.inf
               | 1,           otherwise

    According to this definition v[i] >= 0 for all i. It differs from the
    definition in paper [1]_ (eq. (2.2)), where the absolute value of v is
    used. Both definitions are equivalent down the line.
    Derivatives of v with respect to x take value 1, -1 or 0 depending on a
    case.

    Returns
    -------
    v : ndarray with shape of x
        Scaling vector.
    dv : ndarray with shape of x
        Derivatives of v[i] with respect to x[i], diagonal elements of v's
        Jacobian.

    References
    ----------
    .. [1] M.A. Branch, T.F. Coleman, and Y. Li, "A Subspace, Interior,
           and Conjugate Gradient Method for Large-Scale Bound-Constrained
           Minimization Problems," SIAM Journal on Scientific Computing,
           Vol. 21, Number 1, pp 1-23, 1999.
    rr+r-)r
�	ones_liker�r�)rrLrgrhra�dv�masks       r�CL_scaling_vectorr��s���<	��Q���A�	��q�	�	�B�
��E�R�[��_�_�$�D���h��4�� �A�d�G��B�t�H�
��E�R�[��_�_�$�D���g��4�� �A�d�G��B�t�H��b�5�Lrc�J�t|||��r|tj|��fStj|��}tj|��}|���}tj|t���}||z}tj||d||z||z
��||<||||k||<||z}tj||d||z||z
��||<||||k||<||z}||z
}tj	||||z
d||z��}	||tj|	d||z|	z
��z||<|	||k||<tj|��}
d|
|<||
fS)z3Compute reflective transformation and its gradient.r�rr+)
rur
r�r�r�r��boolr~r��	remainder)rjrgrh�	lb_finite�	ub_finiter�
g_negativer�rrQrLs           r�reflective_transformationr��s�����B����"��"�,�q�/�/�!�!���B���I���B���I�	�����A���q��-�-�-�J��	�z�!�D��j��4��!�b��h�,��4��"8�9�9�A�d�G���w��D��)�J�t���:�	�!�D��j��4��!�b��h�,��4��"8�9�9�A�d�G���w��D��)�J�t���y� �D�
�R��A�
��Q�t�W�r�$�x�'��Q�t�W��5�5�A���h���A�q�1�T�7�{�Q��7�7�7�A�d�G��1�T�7�{�J�t��
��Q���A��A�j�M��a�4�Krc
�T�td�dddddd����dS)Nz*{0:^15}{1:^15}{2:^15}{3:^15}{4:^15}{5:^15}�	Iterationz
Total nfev�Cost�Cost reduction�	Step norm�
Optimality��print�formatrWrr�print_header_nonlinearr�!s>��	�
6��6�+�|�V�5E��|�-�-�.�.�.�.�.rc
��|�d}nd�|��}|�d}nd�|��}td�||||||����dS)N�               �
{0:^15.2e}z({0:^15}{1:^15}{2:^15.4e}{3}{4}{5:^15.2e}�r�r�)�	iteration�nfev�cost�cost_reductionrZ�
optimalitys      r�print_iteration_nonlinearr�'s}����!���%�,�,�^�<�<�����	�	� �'�'�	�2�2�	�	�
4��6�)�T�4���Z�)�)�*�*�*�*�*rc	�R�td�ddddd����dS)Nz#{0:^15}{1:^15}{2:^15}{3:^15}{4:^15}r�r�r�r�r�r�rWrr�print_header_linearr�8s<��	�
/��6�+�v�'7��� � �!�!�!�!�!rc	��|�d}nd�|��}|�d}nd�|��}td�|||||����dS)Nr�r�z!{0:^15}{1:^15.4e}{2}{3}{4:^15.2e}r�)r�r�r�rZr�s     r�print_iteration_linearr�>s�����!���%�,�,�^�<�<�����	�	� �'�'�	�2�2�	�	�
-�
4�
4��4���J�@�@�A�A�A�A�Arc��t|t��r|�|��S|j�|��S)z4Compute gradient of the least-squares cost function.)�
isinstancer	�rmatvecror)r^rOs  r�compute_gradr�Qs6���!�^�$�$���y�y��|�|���s�w�w�q�z�z�rc�J�t|��rQtj|�d���d��������dz}ntj|dzd���dz}|�
d||dk<ntj||��}d|z|fS)z5Compute variables scale based on the Jacobian matrix.rrrCr,Nr-)rr
rf�powerr#�ravelr~)r^�
scale_inv_old�	scale_invs   r�compute_jac_scaler�Ys�����{�{�.��J�q�w�w�q�z�z�~�~�1�~�5�5�6�6�<�<�>�>��C�	�	��F�1�a�4�a�(�(�(�#�-�	���$%�	�)�q�.�!�!��J�y�-�8�8�	��y�=�)�#�#rc�x���t������fd�}��fd�}��fd�}t�j|||���S)z#Return diag(d) J as LinearOperator.c�4�����|��zS�N)�matvec�rr^rs ��rr�z(left_multiplied_operator.<locals>.matvecls����1�8�8�A�;�;��rc�\���dd�tjf��|��zSr�)r
�newaxis�matmat��Xr^rs ��rr�z(left_multiplied_operator.<locals>.matmatos'�������B�J���!�(�(�1�+�+�-�-rc�X����|����z��Sr�)r�r�r�s ��rr�z)left_multiplied_operator.<locals>.rmatvecrs!����y�y������Q��'�'�'r�r�r�r��r
r	�shape�r^rr�r�r�s``   r�left_multiplied_operatorr�hs���������A�������.�.�.�.�.�.�(�(�(�(�(�(��!�'�&��")�+�+�+�+rc�x���t������fd�}��fd�}��fd�}t�j|||���S)z#Return J diag(d) as LinearOperator.c�X����tj|���z��Sr�)r�r
r�r�s ��rr�z)right_multiplied_operator.<locals>.matvec}s!����x�x������a��(�(�(rc�\����|�dd�tjfz��Sr�)r�r
r�r�s ��rr�z)right_multiplied_operator.<locals>.matmat�s)����x�x��A�a�a�a���m�,�,�-�-�-rc�4�����|��zSr��r�r�s ��rr�z*right_multiplied_operator.<locals>.rmatvec�s����1�9�9�Q�<�<��rr�r�r�s``   r�right_multiplied_operatorr�ys���������A�)�)�)�)�)�)�.�.�.�.�.�.� � � � � � ��!�'�&��")�+�+�+�+rc�����t�����j\�}��fd�}���fd�}t�|z|f||���S)z�Return a matrix arising in regularized least squares as LinearOperator.

    The matrix is
        [ J ]
        [ D ]
    where D is diagonal matrix with elements from `diag`.
    c�\��tj��|���|zf��Sr�)r
�hstackr�)rr^r_s ��rr�z(regularized_lsq_operator.<locals>.matvec�s&����y�!�(�(�1�+�+�t�a�x�0�1�1�1rc�b��|d��}|�d�}��|���|zzSr�r�)r�x1�x2r^r_r3s   ���rr�z)regularized_lsq_operator.<locals>.rmatvec�s6���
�r��r�U��
�q�r�r�U���y�y��}�}�t�b�y�(�(r)r�r�)r
r�r	)r^r_r2r�r�r3s``   @r�regularized_lsq_operatorr��s�����	����A��7�D�A�q�2�2�2�2�2�2�)�)�)�)�)�)�)�
�1�q�5�!�*�V�W�E�E�E�ErTc�&�|r)t|t��s|���}t|��r+|xj|�|jd���zc_n+t|t��rt||��}n||z}|S)zhCompute J diag(d).

    If `copy` is False, `J` is modified in place (unless being LinearOperator).
    �clip)�mode)r�r	r�r�data�take�indicesr��r^rr�s   r�right_multiplyr��s���
��J�q�.�1�1��
�F�F�H�H����{�{��	���!�&�&����&�0�0�0����	�A�~�	&�	&��%�a��+�+���	�Q����Hrc�n�|r)t|t��s|���}t|��r;|xjtj|tj|j����zc_n?t|t��rt||��}n||dd�t
j
fz}|S)zhCompute diag(d) J.

    If `copy` is False, `J` is modified in place (unless being LinearOperator).
    N)r�r	r�rr�r
�repeat�diff�indptrr�r�r�s   r�
left_multiplyr��s���
��J�q�.�1�1��
�F�F�H�H����{�{��	���"�)�A�r�w�q�x�0�0�1�1�1����	�A�~�	&�	&��$�Q��*�*���	�Q�q�q�q�"�*�}�
����Hrc�X�|||zko|dk}||||zzk}|r|rdS|rdS|rdSdS)z8Check termination condition for nonlinear least squares.rV�rr"NrW)	�dF�F�dx_norm�x_normr?�ftol�xtol�ftol_satisfied�xtol_satisfieds	         r�check_terminationr�s^���$��(�]�3�u�t�|�N��t�t�f�}�5�5�N���.���q�	���q�	���q��trc��|dd|dz|dzzz}t||tk<|dz}||d|zz}t||d���|fS)z`Scale Jacobian and residuals for a robust loss function.

    Arrays are modified in place.
    r-rr,F)r�)r.r�)r^rO�rho�J_scales    r�scale_for_robust_loss_functionr�sg��
�!�f�q�3�q�6�z�A�q�D�(�(�G� �G�G�c�M����O�G���Q��'�	��A���G�%�0�0�0�!�3�3r)Nrr)NN)rr�)r�)T).�__doc__�mathr�numpyr
�numpy.linalgr�scipy.linalgrrr�scipy.sparser�scipy.sparse.linalgr	r
�finfo�float�epsr.rr@rTr\rcrlrrrur�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrWrr�<module>rss��1�1�����������������;�;�;�;�;�;�;�;�;�;�!�!�!�!�!�!�@�@�@�@�@�@�@�@��b�h�u�o�o���$�$�$�NAE�/1�o�o�o�o�d0�0�0�f���:0�0�0�0�f&�&�&�&�.$�$�$�$�T)�)�)�
H�H�H�:$�$�$�$�N����6)�)�)�X���D.�.�.�*�*�*�"!�!�!�
A�
A�
A�&���$�$�$�$�+�+�+�"+�+�+�"F�F�F�,
�
�
�
�$
�
�
�
�$���4�4�4�4�4r

Youez - 2016 - github.com/yon3zu
LinuXploit