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__/_differentiable_functions.cpython-311.pyc
�

d�c�X���ddlZddlmZddlmZmZddlm	Z	ddl
mZdZGd�d��Z
Gd	�d
��ZGd�d��ZGd
�de��ZdS)�N�)�approx_derivative�
group_columns)�HessianUpdateStrategy)�LinearOperator)z2-pointz3-point�csc�F�eZdZdZ	dd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�ZdS)�ScalarFunctiona�Scalar function and its derivatives.

    This class defines a scalar function F: R^n->R and methods for
    computing or approximating its first and second derivatives.

    Parameters
    ----------
    fun : callable
        evaluates the scalar function. Must be of the form ``fun(x, *args)``,
        where ``x`` is the argument in the form of a 1-D array and ``args`` is
        a tuple of any additional fixed parameters needed to completely specify
        the function. Should return a scalar.
    x0 : array-like
        Provides an initial set of variables for evaluating fun. Array of real
        elements of size (n,), where 'n' is the number of independent
        variables.
    args : tuple, optional
        Any additional fixed parameters needed to completely specify the scalar
        function.
    grad : {callable, '2-point', '3-point', 'cs'}
        Method for computing the gradient vector.
        If it is a callable, it should be a function that returns the gradient
        vector:

            ``grad(x, *args) -> array_like, shape (n,)``

        where ``x`` is an array with shape (n,) and ``args`` is a tuple with
        the fixed parameters.
        Alternatively, the keywords  {'2-point', '3-point', 'cs'} can be used
        to select a finite difference scheme for numerical estimation of the
        gradient with a relative step size. These finite difference schemes
        obey any specified `bounds`.
    hess : {callable, '2-point', '3-point', 'cs', HessianUpdateStrategy}
        Method for computing the Hessian matrix. If it is callable, it should
        return the  Hessian matrix:

            ``hess(x, *args) -> {LinearOperator, spmatrix, array}, (n, n)``

        where x is a (n,) ndarray and `args` is a tuple with the fixed
        parameters. Alternatively, the keywords {'2-point', '3-point', 'cs'}
        select a finite difference scheme for numerical estimation. Or, objects
        implementing `HessianUpdateStrategy` interface can be used to
        approximate the Hessian.
        Whenever the gradient is estimated via finite-differences, the Hessian
        cannot be estimated with options {'2-point', '3-point', 'cs'} and needs
        to be estimated using one of the quasi-Newton strategies.
    finite_diff_rel_step : None or array_like
        Relative step size to use. The absolute step size is computed as
        ``h = finite_diff_rel_step * sign(x0) * max(1, abs(x0))``, possibly
        adjusted to fit into the bounds. For ``method='3-point'`` the sign
        of `h` is ignored. If None then finite_diff_rel_step is selected
        automatically,
    finite_diff_bounds : tuple of array_like
        Lower and upper bounds on independent variables. Defaults to no bounds,
        (-np.inf, np.inf). Each bound must match the size of `x0` or be a
        scalar, in the latter case the bound will be the same for all
        variables. Use it to limit the range of function evaluation.
    epsilon : None or array_like, optional
        Absolute step size to use, possibly adjusted to fit into the bounds.
        For ``method='3-point'`` the sign of `epsilon` is ignored. By default
        relative steps are used, only if ``epsilon is not None`` are absolute
        steps used.

    Notes
    -----
    This class implements a memoization logic. There are methods `fun`,
    `grad`, hess` and corresponding attributes `f`, `g` and `H`. The following
    things should be considered:

        1. Use only public methods `fun`, `grad` and `hess`.
        2. After one of the methods is called, the corresponding attribute
           will be set. However, a subsequent call with a different argument
           of *any* of the methods may overwrite the attribute.
    Nc	�������
����t���s!�tvrtdt�d����t���s6�tvs-t�t��stdt�d�����tvr�tvrtd���tj|���t���_	�j	j
�_d�_d�_
d�_d�_d�_d�_d�_t
j�_i�
�tvr��
d<|�
d<|�
d	<|�
d
<�tvr��
d<|�
d<|�
d	<d�
d<���fd
����fd�}	|	�_����t���r���fd����fd�}
n�tvr�
��fd�}
|
�_����t���r��tj|��g��R��_d�_�xjdz
c_t7j�j��r&���fd��t7j�j���_nYt�jt<��r���fd��n7���fd��tjtj �j�����_��fd�}nx�tvr�
��fd�}|��d�_nVt�t��rA��_�j�!�jd��d�_d�_"d�_#�fd�}|�_$t�t��r�fd�}n�fd�}|�_%dS)Nz)`grad` must be either callable or one of �.z@`hess` must be either callable, HessianUpdateStrategy or one of z�Whenever the gradient is estimated via finite-differences, we require the Hessian to be estimated using one of the quasi-Newton strategies.rF�method�rel_step�abs_step�boundsT�as_linear_operatorc�Z���xjdz
c_�tj|��g��R�}tj|��sQ	tj|�����}n)#ttf$r}td��|�d}~wwxYw|�jkr|�_	|�_|S)Nrz@The user-provided objective function must return a scalar value.)
�nfev�np�copy�isscalar�asarray�item�	TypeError�
ValueError�	_lowest_f�	_lowest_x)�x�fx�e�args�fun�selfs   ����J/usr/lib/python3/dist-packages/scipy/optimize/_differentiable_functions.py�fun_wrappedz,ScalarFunction.__init__.<locals>.fun_wrapped�s�����I�I��N�I�I���R�W�Q�Z�Z�'�$�'�'�'�B��;�r�?�?�
����B���,�,�.�.�B�B��!�:�.����$�6��������������D�N�"�"�!"���!#����Is�&A)�)B�:B
�
Bc�2����j���_dS�N�r�f�r$r"s��r#�
update_funz+ScalarFunction.__init__.<locals>.update_fun����� �[���(�(�D�F�F�F�c�~���xjdz
c_tj�tj|��g��R���S�Nr)�ngevr�
atleast_1dr)rr �gradr"s ���r#�grad_wrappedz-ScalarFunction.__init__.<locals>.grad_wrapped�s<����	�	�Q��	�	��}�T�T�"�'�!�*�*�%<�t�%<�%<�%<�=�=�=r,c�2����j���_dSr&)r�g)r2r"s��r#�update_gradz,ScalarFunction.__init__.<locals>.update_grad�����%��d�f�-�-����r,c��������xjdz
c_t��jfd�ji����_dS)Nr�f0)�_update_funr/rrr(r4��finite_diff_optionsr$r"s���r#r5z,ScalarFunction.__init__.<locals>.update_grad�sZ���� � �"�"�"��	�	�Q��	�	�*�;���B�B�4�6�B�-@�B�B����r,rc�~���xjdz
c_tj�tj|��g��R���Sr.)�nhev�sps�
csr_matrixrr�rr �hessr"s ���r#�hess_wrappedz-ScalarFunction.__init__.<locals>.hess_wrapped�s<����I�I��N�I�I��>�$�$�r�w�q�z�z�*A�D�*A�*A�*A�B�B�Br,c�Z���xjdz
c_�tj|��g��R�Sr.)r=rrr@s ���r#rBz-ScalarFunction.__init__.<locals>.hess_wrapped�s2����I�I��N�I�I��4����
�
�2�T�2�2�2�2r,c	����xjdz
c_tjtj�tj|��g��R�����Sr.)r=r�
atleast_2drrr@s ���r#rBz-ScalarFunction.__init__.<locals>.hess_wrapped�sF����I�I��N�I�I��=���D�D������4K�d�4K�4K�4K�)L�)L�M�M�Mr,c�2����j���_dSr&)r�H�rBr"s��r#�update_hessz,ScalarFunction.__init__.<locals>.update_hess�r6r,c�x������t��jfd�ji����_�jS�Nr8)�_update_gradrrr4rG)r;r2r"s���r#rIz,ScalarFunction.__init__.<locals>.update_hess�sN����!�!�#�#�#�*�<���B�B�D�F�B�-@�B�B����v�
r,rAc��������j��j�jz
�j�jz
��dSr&)rLrG�updater�x_prevr4�g_prev�r"s�r#rIz,ScalarFunction.__init__.<locals>.update_hess�sC����!�!�#�#�#���
�
�d�f�t�{�2�D�F�T�[�4H�I�I�I�I�Ir,c��������j�_�j�_tj|���t���_d�_	d�_
d�_����dS�NF)
rLrrOr4rPrr0�astype�float�	f_updated�	g_updated�	H_updated�_update_hess�rr"s �r#�update_xz)ScalarFunction.__init__.<locals>.update_x�su����!�!�#�#�#�"�f���"�f�����q�)�)�0�0��7�7���!&���!&���!&����!�!�#�#�#�#�#r,c���tj|���t���_d�_d�_d�_dSrS)rr0rTrUrrVrWrXrZs �r#r[z)ScalarFunction.__init__.<locals>.update_x�s=�����q�)�)�0�0��7�7���!&���!&���!&����r,)&�callable�
FD_METHODSr�
isinstancerrr0rTrUr�size�nrr/r=rVrWrXr�infr�_update_fun_implr9�_update_grad_implrLrrGr>�issparser?rrEr�
initializerOrP�_update_hess_impl�_update_x_impl)r"r!�x0r r1rA�finite_diff_rel_step�finite_diff_bounds�epsilonr*r5rIr[r;r$r2rBs`` ```       @@@@r#�__init__zScalarFunction.__init__Vs�������������~�~�	�$�j�"8�"8��I�J�I�I�I���
�����	�$�*�"4�"4��d�$9�:�:�#5��,�(�,�,�,���
�
�:���$�*�"4�"4��8�9�9�
9���r�"�"�)�)�%�0�0����������	���	���	����������������� ���:���,0���)�.B��
�+�.5��
�+�,>���)��:���,0���)�.B��
�+�.5��
�+�8<�� 4�5�	�	�	�	�	�	�	�,	)�	)�	)�	)�	)�	)�!+����������D�>�>�
	B�
>�
>�
>�
>�
>�
>�
>�
.�
.�
.�
.�
.�
.�
.��Z�
�
�
B�
B�
B�
B�
B�
B�
B�"-����������D�>�>�+	J��T�"�'�"�+�+�-��-�-�-�D�F�!�D�N��I�I��N�I�I��|�D�F�#�#�
;�C�C�C�C�C�C�C�����/�/�����D�F�N�3�3�	
;�3�3�3�3�3�3�3�3�
N�N�N�N�N�N�N���r�z�$�&�'9�'9�:�:���
.�
.�
.�
.�
.�
.�
.��Z�
�
�
�
�
�
�
�
�
�
�K�M�M�M�!�D�N�N�
��3�
4�
4�		J��D�F��F���d�f�f�-�-�-�!�D�N��D�K��D�K�
J�
J�
J�
J�
J�"-����d�1�2�2�	'�

$�

$�

$�

$�

$�

$�
'�
'�
'�
'�
'�'����r,c�N�|js|���d|_dSdS�NT�rVrcrQs r#r9zScalarFunction._update_fun��3���~�	"��!�!�#�#�#�!�D�N�N�N�	"�	"r,c�N�|js|���d|_dSdSro)rWrdrQs r#rLzScalarFunction._update_grad��3���~�	"��"�"�$�$�$�!�D�N�N�N�	"�	"r,c�N�|js|���d|_dSdSro�rXrgrQs r#rYzScalarFunction._update_hessrsr,c��tj||j��s|�|��|���|jSr&)r�array_equalrrhr9r(�r"rs  r#r!zScalarFunction.funsE���~�a���(�(�	#�����"�"�"��������v�
r,c��tj||j��s|�|��|���|jSr&)rrwrrhrLr4rxs  r#r1zScalarFunction.grad�E���~�a���(�(�	#�����"�"�"��������v�
r,c��tj||j��s|�|��|���|jSr&)rrwrrhrYrGrxs  r#rAzScalarFunction.hessrzr,c���tj||j��s|�|��|���|���|j|jfSr&)rrwrrhr9rLr(r4rxs  r#�fun_and_gradzScalarFunction.fun_and_grads^���~�a���(�(�	#�����"�"�"��������������v�t�v�~�r,r&)�__name__�
__module__�__qualname__�__doc__rmr9rLrYr!r1rAr}�r,r#r
r
s�������I�I�V.2�a'�a'�a'�a'�F"�"�"�
"�"�"�
"�"�"�
�������������r,r
c�H�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�ZdS)�VectorFunctiona�Vector function and its derivatives.

    This class defines a vector function F: R^n->R^m and methods for
    computing or approximating its first and second derivatives.

    Notes
    -----
    This class implements a memoization logic. There are methods `fun`,
    `jac`, hess` and corresponding attributes `f`, `J` and `H`. The following
    things should be considered:

        1. Use only public methods `fun`, `jac` and `hess`.
        2. After one of the methods is called, the corresponding attribute
           will be set. However, a subsequent call with a different argument
           of *any* of the methods may overwrite the attribute.
    c	�(����������t���s0�tvr'td�t�����t���sE�tvs<t	�t
��s'td�t������tvr�tvrtd���t
j|���t���_
�j
j�_d�_
d�_d�_d�_d�_d�_i��tvrE��d<|�d<|�t'|��}	||	f�d<|�d	<t
j�j
���_�tvr-��d<|�d<d
�d<t
j�j
���_�tvr�tvrtd�����fd����fd
�}
|
�_|
��t
j�j���_�jj�_t���r���j
���_d
�_�xjdz
c_|s|�Et9j�j��r,��fd��t9j�j���_d
�_npt9j�j��r,��fd���j� ���_d�_n+��fd��t
j!�j���_d�_��fd�}n�tvr�tE��j
fd�ji����_d
�_|s|�Ft9j�j��r-���fd�}t9j�j���_d
�_nrt9j�j��r-���fd�}�j� ���_d�_n,���fd�}t
j!�j���_d�_|�_#t���r���j
�j���_$d
�_�xjdz
c_t9j�j$��r%��fd��t9j�j$���_$nWt	�j$tJ��r��fd��n6��fd��t
j!t
j&�j$�����_$��fd�}n}�tvr�fd�����fd�}|��d
�_nVt	�t
��rA��_$�j$�'�jd��d
�_d�_(d�_)�fd�}|�_*t	�t
��r�fd�}
n�fd �}
|
�_+dS)!Nz+`jac` must be either callable or one of {}.zB`hess` must be either callable,HessianUpdateStrategy or one of {}.z�Whenever the Jacobian is estimated via finite-differences, we require the Hessian to be estimated using one of the quasi-Newton strategies.rFr
r�sparsityrTrc�^���xjdz
c_tj�|����Sr.)rrr0)rr!r"s ��r#r$z,VectorFunction.__init__.<locals>.fun_wrappedes*����I�I��N�I�I��=���Q���(�(�(r,c�2����j���_dSr&r'r)s��r#r*z+VectorFunction.__init__.<locals>.update_funir+r,rc�^���xjdz
c_tj�|����Sr.)�njevr>r?�r�jacr"s ��r#�jac_wrappedz,VectorFunction.__init__.<locals>.jac_wrappedzs*����I�I��N�I�I��>�#�#�a�&�&�1�1�1r,c�^���xjdz
c_�|�����Sr.)r��toarrayr�s ��r#r�z,VectorFunction.__init__.<locals>.jac_wrapped�s*����I�I��N�I�I��3�q�6�6�>�>�+�+�+r,c�^���xjdz
c_tj�|����Sr.)r�rrEr�s ��r#r�z,VectorFunction.__init__.<locals>.jac_wrapped�s*����I�I��N�I�I��=���Q���0�0�0r,c�2����j���_dSr&)r�J)r�r"s��r#�
update_jacz+VectorFunction.__init__.<locals>.update_jac�s���$��T�V�,�,����r,r8c�������tjt��jfd�ji������_dSrK)r9r>r?rrr(r�r:s���r#r�z+VectorFunction.__init__.<locals>.update_jac�s\����$�$�&�&�&� �^�)�+�t�v�A�A�$�&�A�,?�A�A�B�B�D�F�F�Fr,c�������t��jfd�ji�������_dSrK)r9rrr(r�r�r:s���r#r�z+VectorFunction.__init__.<locals>.update_jac�sW����$�$�&�&�&�.�{�D�F�F�F�t�v�F�1D�F�F�FM�g�i�i��F�F�Fr,c�������tjt��jfd�ji������_dSrK)r9rrErrr(r�r:s���r#r�z+VectorFunction.__init__.<locals>.update_jac�s\����$�$�&�&�&��]�)�+�t�v�A�A�$�&�A�,?�A�A�B�B�D�F�F�Fr,c�`���xjdz
c_tj�||����Sr.)r=r>r?�r�vrAr"s  ��r#rBz-VectorFunction.__init__.<locals>.hess_wrapped�s,����I�I��N�I�I��>�$�$�q�!�*�*�5�5�5r,c�<���xjdz
c_�||��Sr.)r=r�s  ��r#rBz-VectorFunction.__init__.<locals>.hess_wrapped�s"����I�I��N�I�I��4��1�:�:�%r,c����xjdz
c_tjtj�||������Sr.)r=rrErr�s  ��r#rBz-VectorFunction.__init__.<locals>.hess_wrapped�s6����I�I��N�I�I��=���D�D��A�J�J�)?�)?�@�@�@r,c�>����j�j���_dSr&)rr�rGrHs��r#rIz,VectorFunction.__init__.<locals>.update_hess�s���%��d�f�d�f�5�5����r,c�J���|��j�|��Sr&)�T�dot)rr�r�s  �r#�	jac_dot_vz*VectorFunction.__init__.<locals>.jac_dot_v�s"���"�{�1�~�~�'�+�+�A�.�.�.r,c�������t��jf�jj��j���jfd�����_dS)N)r8r )�_update_jacrrr�r�r�r�rG)r;r�r"s���r#rIz,VectorFunction.__init__.<locals>.update_hess�sf���� � �"�"�"�*�9�d�f�B�.2�f�h�l�l�4�6�.B�.B�15��	�B�B�.A�B�B����r,rAc�:�������j�|�j�w�j�jz
}�jj��j���jj��j��z
}�j�	||��dSdSdSr&)
r�rO�J_prevrr�r�r�r�rGrN)�delta_x�delta_gr"s  �r#rIz,VectorFunction.__init__.<locals>.update_hess�s����� � �"�"�"��;�*�t�{�/F�"�f�t�{�2�G�"�f�h�l�l�4�6�2�2�T�[�]�5F�5F�t�v�5N�5N�N�G��F�M�M�'�7�3�3�3�3�3�+�*�/F�/Fr,c��������j�_�j�_tj|���t���_d�_	d�_
d�_����dSrS)
r�rrOr�r�rr0rTrUrV�	J_updatedrXrYrZs �r#r[z)VectorFunction.__init__.<locals>.update_x�ss���� � �"�"�"�"�f���"�f�����q�)�)�0�0��7�7���!&���!&���!&����!�!�#�#�#�#�#r,c���tj|���t���_d�_d�_d�_dSrS)rr0rTrUrrVr�rXrZs �r#r[z)VectorFunction.__init__.<locals>.update_x�s;�����q�)�)�0�0��7�7���!&���!&���!&����r,),r]r^r�formatr_rrr0rTrUrr`rarr�r=rVr�rXrr�x_diffrc�
zeros_liker(r��mr�r>rer?�sparse_jacobianr�rEr�_update_jac_implrGrrrfrOr�rgrh)r"r!rir�rArj�finite_diff_jac_sparsityrkr��sparsity_groupsr*r�rIr[r;r$rBr�r�s`` ``         @@@@@r#rmzVectorFunction.__init__3sI�������������}�}�	2��J�!6�!6��J�$�f�Z�0�0�2�2�
2�����	2�$�*�"4�"4��d�$9�:�:�#5��C�$�f�Z�0�0�2�2�
2��*�����!3�!3��+�,�,�
,�
��r�"�"�)�)�%�0�0����������	���	���	���������� ���*���,/���)�.B��
�+�'�3�"/�0H�"I�"I��3K�3B�3D�#�J�/�,>���)��'�$�&�/�/�D�K��:���,0���)�.B��
�+�8<�� 4�5��'�$�&�/�/�D�K��*�����!3�!3��+�,�,�
,�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�!+����
������t�v�&�&���������C�=�=�<	-��S���[�[�D�F�!�D�N��I�I��N�I�I��
-�#�+���T�V�0D�0D�+�2�2�2�2�2�2�����/�/���'+��$�$���d�f�%�%�
-�,�,�,�,�,�,�����)�)���',��$�$�1�1�1�1�1�1���t�v�.�.���',��$�
-�
-�
-�
-�
-�
-�
-��J�
�
�&�{�D�F�>�>�t�v�>�)<�>�>�D�F�!�D�N��
-�#�+���T�V�0D�0D�+�B�B�B�B�B�B�B�
����/�/���'+��$�$���d�f�%�%�
-�P�P�P�P�P�P�P�����)�)���',��$�$�B�B�B�B�B�B�B�
��t�v�.�.���',��$� *����D�>�>�2	4��T�$�&�$�&�)�)�D�F�!�D�N��I�I��N�I�I��|�D�F�#�#�
;�6�6�6�6�6�6�����/�/�����D�F�N�3�3�	
;�&�&�&�&�&�&�&�
A�A�A�A�A�A���r�z�$�&�'9�'9�:�:���
6�
6�
6�
6�
6�
6�
6�
�Z�
�
�
/�
/�
/�
/�
/�
B�
B�
B�
B�
B�
B�
B�
�K�M�M�M�!�D�N�N�
��3�
4�
4�	4��D�F��F���d�f�f�-�-�-�!�D�N��D�K��D�K�
4�
4�
4�
4�
4�"-����d�1�2�2�	'�
$�
$�
$�
$�
$�
$�
'�
'�
'�
'�
'�'����r,c�Z�tj||j��s||_d|_dSdSrS)rrwr�rX)r"r�s  r#�	_update_vzVectorFunction._update_v�s4���~�a���(�(�	#��D�F�"�D�N�N�N�	#�	#r,c�h�tj||j��s|�|��dSdSr&)rrwrrhrxs  r#�	_update_xzVectorFunction._update_xs<���~�a���(�(�	#�����"�"�"�"�"�	#�	#r,c�N�|js|���d|_dSdSrorprQs r#r9zVectorFunction._update_funrqr,c�N�|js|���d|_dSdSro)r�r�rQs r#r�zVectorFunction._update_jacrqr,c�N�|js|���d|_dSdSrorurQs r#rYzVectorFunction._update_hessrsr,c�b�|�|��|���|jSr&)r�r9r(rxs  r#r!zVectorFunction.fun�-�����q�����������v�
r,c�b�|�|��|���|jSr&)r�r�r�rxs  r#r�zVectorFunction.jacr�r,c��|�|��|�|��|���|jSr&)r�r�rYrG�r"rr�s   r#rAzVectorFunction.hesss?�����q�������q�����������v�
r,N)
r~rr�r�rmr�r�r9r�rYr!r�rAr�r,r#r�r�"s��������� H'�H'�H'�T#�#�#�
#�#�#�"�"�"�
"�"�"�
"�"�"�
���
���
����r,r�c�0�eZdZdZd�Zd�Zd�Zd�Zd�ZdS)�LinearVectorFunctionz�Linear vector function and its derivatives.

    Defines a linear function F = A x, where x is N-D vector and
    A is m-by-n matrix. The Jacobian is constant and equals to A. The Hessian
    is identically zero and it is returned as a csr matrix.
    c���|s|�5tj|��r!tj|��|_d|_ngtj|��r!|���|_d|_n2t
jt
j|����|_d|_|jj	\|_
|_t
j|���
t��|_|j�|j��|_d|_t
j|j
t���|_tj|j|jf��|_dS)NTF)�dtype)r>rer?r�r�r�rrEr�shaper�rar0rTrUrr�r(rV�zerosr�rG)r"�Arir�s    r#rmzLinearVectorFunction.__init__.s	���		)�o�5�#�,�q�/�/�5��^�A�&�&�D�F�#'�D� � �
�\�!�_�_�	)��Y�Y�[�[�D�F�#(�D� � ��]�2�:�a�=�=�1�1�D�F�#(�D� �����������r�"�"�)�)�%�0�0�������D�F�#�#��������$�&��.�.�.��������� 0�1�1����r,c��tj||j��s:tj|���t
��|_d|_dSdSrS)rrwrr0rTrUrVrxs  r#r�zLinearVectorFunction._update_xCsL���~�a���(�(�	#��]�1�%�%�,�,�U�3�3�D�F�"�D�N�N�N�	#�	#r,c��|�|��|js&|j�|��|_d|_|jSro)r�rVr�r�r(rxs  r#r!zLinearVectorFunction.funHs?�����q�����~�	"��V�Z�Z��]�]�D�F�!�D�N��v�
r,c�:�|�|��|jSr&)r�r�rxs  r#r�zLinearVectorFunction.jacOs�����q�����v�
r,c�H�|�|��||_|jSr&)r�r�rGr�s   r#rAzLinearVectorFunction.hessSs"�����q��������v�
r,N)	r~rr�r�rmr�r!r�rAr�r,r#r�r�'si��������2�2�2�*#�#�#�
����������r,r�c�"��eZdZdZ�fd�Z�xZS)�IdentityVectorFunctionz�Identity vector function and its derivatives.

    The Jacobian is the identity matrix, returned as a dense array when
    `sparse_jacobian=False` and as a csr matrix otherwise. The Hessian is
    identically zero and it is returned as a csr matrix.
    c����t|��}|s|�tj|d���}d}ntj|��}d}t	���|||��dS)N�csr)r�TF)�lenr>�eyer�superrm)r"rir�rar��	__class__s     �r#rmzIdentityVectorFunction.__init__`sj�����G�G���	$�o�5����%�(�(�(�A�"�O�O���q�	�	�A�#�O�
������B��0�0�0�0�0r,)r~rr�r�rm�
__classcell__)r�s@r#r�r�YsB���������1�1�1�1�1�1�1�1�1r,r�)�numpyr�scipy.sparse�sparser>�_numdiffrr�_hessian_update_strategyr�scipy.sparse.linalgrr^r
r�r�r�r�r,r#�<module>r�s&������������6�6�6�6�6�6�6�6�;�;�;�;�;�;�.�.�.�.�.�.�*�
�T�T�T�T�T�T�T�T�nB�B�B�B�B�B�B�B�J/�/�/�/�/�/�/�/�d1�1�1�1�1�1�1�1�1�1�1r,

Youez - 2016 - github.com/yon3zu
LinuXploit