| 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 : |
�
d�c% � �R � d Z ddlZddlZddlmZmZ g Zd d�Z G d� de� � Z
dS )
z"Dog-leg trust-region optimization.� N� )�_minimize_trust_region�BaseQuadraticSubproblem� c � � |�t d� � �t |� � st d� � �t | |f|||t d�|��S )a
Minimization of scalar function of one or more variables using
the dog-leg trust-region algorithm.
Options
-------
initial_trust_radius : float
Initial trust-region radius.
max_trust_radius : float
Maximum value of the trust-region radius. No steps that are longer
than this value will be proposed.
eta : float
Trust region related acceptance stringency for proposed steps.
gtol : float
Gradient norm must be less than `gtol` before successful
termination.
Nz,Jacobian is required for dogleg minimizationz+Hessian is required for dogleg minimization)�args�jac�hess�
subproblem)�
ValueError�callabler �DoglegSubproblem)�fun�x0r r r
�trust_region_optionss �D/usr/lib/python3/dist-packages/scipy/optimize/_trustregion_dogleg.py�_minimize_doglegr sg � �( �{��G�H�H�H��D�>�>� H��F�G�G�G�!�#�r� :��#�D�-=�:� :�$8�:� :� :� c �$ � e Zd ZdZd� Zd� Zd� ZdS )r z0Quadratic subproblem solved by the dogleg methodc � � | j �P| j }| � |� � }t j ||� � t j ||� � z |z | _ | j S )zV
The Cauchy point is minimal along the direction of steepest descent.
)�
_cauchy_pointr �hessp�np�dot)�self�g�Bgs r �cauchy_pointzDoglegSubproblem.cauchy_point) sU � � ��%���A����A���B�#%�6�!�Q�<�<�"�&��B�-�-�#?�!@�1�!D�D���!�!r c �� � | j �S| j }| j }t j � |� � }t j � ||� � | _ | j S )zS
The Newton point is a global minimum of the approximate function.
)�
_newton_pointr r
�scipy�linalg�
cho_factor� cho_solve)r r �B�cho_infos r �newton_pointzDoglegSubproblem.newton_point3 sV � � ��%���A�� �A��|�.�.�q�1�1�H�"'�,�"8�"8��1�"E�"E�!E�D���!�!r c �f � | � � � }t j � |� � |k rd}||fS | � � � }t j � |� � }||k r|||z z }d}||fS | � |||z
|� � \ }}||||z
z z }d}||fS )a�
Minimize a function using the dog-leg trust-region algorithm.
This algorithm requires function values and first and second derivatives.
It also performs a costly Hessian decomposition for most iterations,
and the Hessian is required to be positive definite.
Parameters
----------
trust_radius : float
We are allowed to wander only this far away from the origin.
Returns
-------
p : ndarray
The proposed step.
hits_boundary : bool
True if the proposed step is on the boundary of the trust region.
Notes
-----
The Hessian is required to be positive definite.
References
----------
.. [1] Jorge Nocedal and Stephen Wright,
Numerical Optimization, second edition,
Springer-Verlag, 2006, page 73.
FT)r'