403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
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 :  /usr/lib/python3/dist-packages/scipy/optimize/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

d�c�)���dZddlZddlZddlZddlZddlmZm	Z	m
Z
mZddlm
Z
ddlmZgZd�ZGd�d	��Z					dd�ZdS)zTrust-region optimization.�N�)�_check_unknown_options�_status_message�OptimizeResult�_prepare_scalar_function)�HessianUpdateStrategy)�
FD_METHODSc�0����dg����dfS���fd�}�|fS)Nrc�`���dxxdz
cc<�tj|��g|�z�R�S)Nrr)�np�copy)�x�wrapper_args�args�function�ncallss  ����=/usr/lib/python3/dist-packages/scipy/optimize/_trustregion.py�function_wrapperz(_wrap_function.<locals>.function_wrappers=����q�	�	�	�Q��	�	�	��x����
�
�;�l�T�&9�;�;�;�;��)rrrrs`` @r�_wrap_functionrsO������S�F����t�|��<�<�<�<�<�<�<�
�#�#�#rc��eZdZdZdd�Zd�Zed���Zed���Zed���Z	d�Z
ed	���Zd
�Zd�Z
dS)
�BaseQuadraticSubproblemaQ
    Base/abstract class defining the quadratic model for trust-region
    minimization. Child classes must implement the ``solve`` method.

    Values of the objective function, Jacobian and Hessian (if provided) at
    the current iterate ``x`` are evaluated on demand and then stored as
    attributes ``fun``, ``jac``, ``hess``.
    Nc��||_d|_d|_d|_d|_d|_d|_||_||_||_	||_
dS�N)�_x�_f�_g�_h�_g_mag�
_cauchy_point�
_newton_point�_fun�_jac�_hess�_hessp)�selfr�fun�jac�hess�hessps      r�__init__z BaseQuadraticSubproblem.__init__'sU�����������������!���!�����	���	���
�����rc��|jtj|j|��zdtj||�|����zzS)Ng�?)r(r�dotr)r+�r'�ps  r�__call__z BaseQuadraticSubproblem.__call__4s=���x�"�&���1�-�-�-��b�f�Q��
�
�1�
�
�6N�6N�0N�N�Nrc�\�|j�|�|j��|_|jS)z1Value of objective function at current iteration.)rr#r�r's rr(zBaseQuadraticSubproblem.fun7�'���7�?��i�i���(�(�D�G��w�rc�\�|j�|�|j��|_|jS)z=Value of Jacobian of objective function at current iteration.)rr$rr3s rr)zBaseQuadraticSubproblem.jac>r4rc�\�|j�|�|j��|_|jS)z<Value of Hessian of objective function at current iteration.)rr%rr3s rr*zBaseQuadraticSubproblem.hessEs'���7�?��j�j���)�)�D�G��w�rc�z�|j�|�|j|��Stj|j|��Sr)r&rrr.r*r/s  rr+zBaseQuadraticSubproblem.hesspLs4���;�"��;�;�t�w��*�*�*��6�$�)�Q�'�'�'rc�p�|j�)tj�|j��|_|jS)zAMagnitude of jacobian of objective function at current iteration.)r �scipy�linalg�normr)r3s r�jac_magzBaseQuadraticSubproblem.jac_magRs-���;���,�+�+�D�H�5�5�D�K��{�rc�F�tj||��}dtj||��z}tj||��|dzz
}tj||zd|z|zz
��}|tj||��z}|d|zz}	d|z|z}
t|	|
g��S)z�
        Solve the scalar quadratic equation ||z + t d|| == trust_radius.
        This is like a line-sphere intersection.
        Return the two values of t, sorted from low to high.
        �����)rr.�math�sqrt�copysign�sorted)r'�z�d�trust_radius�a�b�c�sqrt_discriminant�aux�ta�tbs           r�get_boundaries_intersectionsz4BaseQuadraticSubproblem.get_boundaries_intersectionsYs���
�F�1�a�L�L��
���q�!������F�1�a�L�L�<��?�*�� �I�a��c�A�a�C��E�k�2�2���$�-� 1�1�5�5�5���T�Q�q�S�\��
��T�C�Z���r�2�h���rc� �td���)Nz9The solve method should be implemented by the child class)�NotImplementedError)r'rGs  r�solvezBaseQuadraticSubproblem.solveps��!�#4�5�5�	5r)NN)�__name__�
__module__�__qualname__�__doc__r,r1�propertyr(r)r*r+r<rOrRrrrrrs�������������O�O�O�����X������X������X��(�(�(�����X�� � � �.5�5�5�5�5rrr��?�@�@�333333�?�-C��6?FTc
��"�t|��|�td���|�|�td���|�td���d|	cxkrdksntd���|dkrtd���|dkrtd	���||krtd
���tj|�����}t
|||||����"�"j}�"j}t|��r�"j
}nEt|��rn5|tvst|t��rd}�"fd�}ntd���t||��\}}|�t|��d
z}d}|}|}|
r|g}||||||��}d}|j|
k�r	|�|��\}}n#tjj$rd}Yn�wxYw||��}||z}||||||��}|j|jz
}|j|z
}|dkrd}n�||z}|dkr|dz}n|dkr|rt)d|z|��}||	kr|}|}|
r'|�tj|����|�|tj|����|dz
}|j|
krd}n||krd}n|j|
k��t.dt.dddf} |r�|dkrt1| |��n!t3j| |t6d��t1d|jz��t1d|z��t1d�"jz��t1d�"jz��t1d�"j|dzz��t?||dk||j|j �"j�"j�"j|dz|| |��
�
}!|�
|j
|!d<|
r||!d<|!S)a�
    Minimization of scalar function of one or more variables using a
    trust-region algorithm.

    Options for the trust-region algorithm are:
        initial_trust_radius : float
            Initial trust radius.
        max_trust_radius : float
            Never propose steps that are longer than this value.
        eta : float
            Trust region related acceptance stringency for proposed steps.
        gtol : float
            Gradient norm must be less than `gtol`
            before successful termination.
        maxiter : int
            Maximum number of iterations to perform.
        disp : bool
            If True, print convergence message.
        inexact : bool
            Accuracy to solve subproblems. If True requires less nonlinear
            iterations, but more vector products. Only effective for method
            trust-krylov.

    This function is called by the `minimize` function.
    It is not supposed to be called directly.
    Nz7Jacobian is currently required for trust-region methodsz_Either the Hessian or the Hessian-vector product is currently required for trust-region methodszBA subproblem solving strategy is required for trust-region methodsrg�?zinvalid acceptance stringencyz%the max trust radius must be positivez)the initial trust radius must be positivez?the initial trust radius must be less than the max trust radius)r)r*rc�T����|���|��Sr)r*r.)rr0r�sfs   �rr+z%_minimize_trust_region.<locals>.hessp�s����7�7�1�:�:�>�>�!�$�$�$r���r>g�?r�success�maxiterz:A bad approximation caused failure to predict improvement.z3A linalg error occurred, such as a non-psd Hessian.z#         Current function value: %fz         Iterations: %dz!         Function evaluations: %dz!         Gradient evaluations: %dz          Hessian evaluations: %d)
rra�statusr(r)�nfev�njev�nhev�nit�messager*�allvecs)!r�
ValueError�	Exceptionr�asarray�flattenrr(�grad�callabler*r	�
isinstancerr�lenr<rRr:�LinAlgError�min�appendr
r�print�warnings�warn�RuntimeWarningrd�ngevrfrr))#r(�x0rr)r*r+�
subproblem�initial_trust_radius�max_trust_radius�eta�gtolrb�disp�
return_all�callback�inexact�unknown_options�nhessp�warnflagrGrri�m�kr0�
hits_boundary�predicted_value�
x_proposed�
m_proposed�actual_reduction�predicted_reduction�rho�status_messages�resultr^s#                                  @r�_minimize_trust_regionr�us���>�?�+�+�+�
�{��#�$�$�	$��|��
��J�K�K�	K����0�1�1�	1�
��O�O�O�O�t�O�O�O�O��7�8�8�8��1����?�@�@�@��q� � ��D�E�E�E��/�/�/��,�-�-�	-�
��B���	�	�	!�	!�B�
"�#�r�s��D�	I�	I�	I�B�
�&�C�
�'�C���~�~�K��w���	�%���K�	
�
�*�
�
�
�4�1F� G� G�
���	%�	%�	%�	%�	%�	%��J�K�K�	K�#�5�$�/�/�M�F�E����b�'�'�#�+���H�(�L�
�A����#���
�1�c�3��e�,�,�A�	�A��)�t�
�
�	� �w�w�|�4�4��A�}�}���y�$�	�	�	��H��E�	����
�!�A�$�$����U�
��Z�
�C��d�E�B�B�
��5�:�>�1���e�o�5���!�#�#��H���!4�4����:�:��D� �L�L�
�4�Z�Z�M�Z��q��~�/?�@�@�L���9�9��A��A��	'��N�N�2�7�1�:�:�&�&�&����H�R�W�Q�Z�Z� � � �	�Q���
�9�t����H��
��<�<��H��k�)�t�
�
�r
�I�&��I�&�H�A�	�O��	J��q�=�=��/�(�+�,�,�,�,��M�/�(�3�^�Q�G�G�G�
�3�a�e�;�<�<�<�
�'�!�+�,�,�,�
�1�B�G�;�<�<�<�
�1�B�G�;�<�<�<�
�0�B�G�f�Q�i�4G�H�I�I�I�
�a�(�a�-�� !��1�5�r�w�R�W�!#��6�!�9�!4�!�$3�H�$=�?�?�?�F�
�����v���$�#��y���Ms�F0�0G	�G	)rNNNNrXrYrZr[NFFNT)rVrArv�numpyr�scipy.linalgr9�	_optimizerrrr�'scipy.optimize._hessian_update_strategyr�(scipy.optimize._differentiable_functionsr	�__all__rrr�rrr�<module>r�s�� � �����������������A�A�A�A�A�A�A�A�A�A�A�A�I�I�I�I�I�I�?�?�?�?�?�?�
��$�$�$�U5�U5�U5�U5�U5�U5�U5�U5�pIM�AD�CG�@E�26�	x�x�x�x�x�xr

Youez - 2016 - github.com/yon3zu
LinuXploit