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/integrate/_ivp/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/scipy/integrate/_ivp/__pycache__/bdf.cpython-311.pyc
�

d�c	C����ddlZddlmZmZddlmZmZmZddl	m
Z
ddlmZddl
mZmZmZmZmZmZmZmZddlmZmZd	Zd
ZdZdZd
�Zd�Zd�ZGd�de��Z Gd�de��Z!dS)�N)�	lu_factor�lu_solve)�issparse�
csc_matrix�eye)�splu)�
group_columns�)�validate_max_step�validate_tol�select_initial_step�norm�EPS�num_jac�validate_first_step�warn_extraneous)�	OdeSolver�DenseOutput��g�������?�
c��tjd|dz��dd�df}tjd|dz��}tj|dz|dzf��}|dz
||zz
|z|dd�dd�f<d|d<tj|d���S)z6Compute the matrix for changing the differences array.r
Nr��axis)�np�arange�zeros�cumprod)�order�factor�I�J�Ms     �:/usr/lib/python3/dist-packages/scipy/integrate/_ivp/bdf.py�	compute_Rr%s���
�	�!�U�Q�Y������4��(�A�
�	�!�U�Q�Y���A�
��%�!�)�U�Q�Y�'�(�(�A��Q���!��#�q�(�A�a�b�b�!�"�"�f�I��A�a�D�
�:�a�a� � � � �c���t||��}t|d��}|�|��}tj|j|d|dz���|d|dz�<dS)z<Change differences array in-place when step size is changed.r
N)r%�dotr�T)�Drr �R�U�RUs      r$�change_Dr.s^���%�� � �A��%����A�	
���q���B��F�2�4��:�E�A�I�:��/�/�A�j�u�q�y�j�M�M�Mr&c	���d}	|���}
d}d}tt��D]�}
|||
��}tjtj|����sn}||||z|z
|	z
��}t
||z��}|�d}n||z}|�"|dks|t|
z
zd|z
z|z|krn(|
|z
}
|	|z
}	|dks|�|d|z
z|z|krd}n|}��||
dz|
|	fS)z5Solve the algebraic system resulting from BDF method.rNFr
T)�copy�range�NEWTON_MAXITERr�all�isfiniter)�fun�t_new�	y_predict�c�psi�LU�solve_lu�scale�tol�d�y�dy_norm_old�	converged�k�f�dy�dy_norm�rates                  r$�solve_bdf_systemrG$s=��	�A������A��K��I�
�>�
"�
"�����C��q�M�M���v�b�k�!�n�n�%�%�	��E�
�X�b�!�a�%�#�+��/�
*�
*���r�E�z�"�"�����D�D��[�(�D���$�!�)�)���!�+�,��D��9�G�C�c�I�I��E�	�R���	�R����q�L�L�� �T�Q��X�%6��%@�3�%F�%F��I��E�����a�!�e�Q��!�!r&c�N��eZdZdZejddddddf�fd�	Zd�Zd�Zd	�Z	�xZ
S)
�BDFa�Implicit method based on backward-differentiation formulas.

    This is a variable order method with the order varying automatically from
    1 to 5. The general framework of the BDF algorithm is described in [1]_.
    This class implements a quasi-constant step size as explained in [2]_.
    The error estimation strategy for the constant-step BDF is derived in [3]_.
    An accuracy enhancement using modified formulas (NDF) [2]_ is also implemented.

    Can be applied in the complex domain.

    Parameters
    ----------
    fun : callable
        Right-hand side of the system. The calling signature is ``fun(t, y)``.
        Here ``t`` is a scalar, and there are two options for the ndarray ``y``:
        It can either have shape (n,); then ``fun`` must return array_like with
        shape (n,). Alternatively it can have shape (n, k); then ``fun``
        must return an array_like with shape (n, k), i.e. each column
        corresponds to a single column in ``y``. The choice between the two
        options is determined by `vectorized` argument (see below). The
        vectorized implementation allows a faster approximation of the Jacobian
        by finite differences (required for this solver).
    t0 : float
        Initial time.
    y0 : array_like, shape (n,)
        Initial state.
    t_bound : float
        Boundary time - the integration won't continue beyond it. It also
        determines the direction of the integration.
    first_step : float or None, optional
        Initial step size. Default is ``None`` which means that the algorithm
        should choose.
    max_step : float, optional
        Maximum allowed step size. Default is np.inf, i.e., the step size is not
        bounded and determined solely by the solver.
    rtol, atol : float and array_like, optional
        Relative and absolute tolerances. The solver keeps the local error
        estimates less than ``atol + rtol * abs(y)``. Here `rtol` controls a
        relative accuracy (number of correct digits), while `atol` controls
        absolute accuracy (number of correct decimal places). To achieve the
        desired `rtol`, set `atol` to be smaller than the smallest value that
        can be expected from ``rtol * abs(y)`` so that `rtol` dominates the
        allowable error. If `atol` is larger than ``rtol * abs(y)`` the
        number of correct digits is not guaranteed. Conversely, to achieve the
        desired `atol` set `rtol` such that ``rtol * abs(y)`` is always smaller
        than `atol`. If components of y have different scales, it might be
        beneficial to set different `atol` values for different components by
        passing array_like with shape (n,) for `atol`. Default values are
        1e-3 for `rtol` and 1e-6 for `atol`.
    jac : {None, array_like, sparse_matrix, callable}, optional
        Jacobian matrix of the right-hand side of the system with respect to y,
        required by this method. The Jacobian matrix has shape (n, n) and its
        element (i, j) is equal to ``d f_i / d y_j``.
        There are three ways to define the Jacobian:

            * If array_like or sparse_matrix, the Jacobian is assumed to
              be constant.
            * If callable, the Jacobian is assumed to depend on both
              t and y; it will be called as ``jac(t, y)`` as necessary.
              For the 'Radau' and 'BDF' methods, the return value might be a
              sparse matrix.
            * If None (default), the Jacobian will be approximated by
              finite differences.

        It is generally recommended to provide the Jacobian rather than
        relying on a finite-difference approximation.
    jac_sparsity : {None, array_like, sparse matrix}, optional
        Defines a sparsity structure of the Jacobian matrix for a
        finite-difference approximation. Its shape must be (n, n). This argument
        is ignored if `jac` is not `None`. If the Jacobian has only few non-zero
        elements in *each* row, providing the sparsity structure will greatly
        speed up the computations [4]_. A zero entry means that a corresponding
        element in the Jacobian is always zero. If None (default), the Jacobian
        is assumed to be dense.
    vectorized : bool, optional
        Whether `fun` is implemented in a vectorized fashion. Default is False.

    Attributes
    ----------
    n : int
        Number of equations.
    status : string
        Current status of the solver: 'running', 'finished' or 'failed'.
    t_bound : float
        Boundary time.
    direction : float
        Integration direction: +1 or -1.
    t : float
        Current time.
    y : ndarray
        Current state.
    t_old : float
        Previous time. None if no steps were made yet.
    step_size : float
        Size of the last successful step. None if no steps were made yet.
    nfev : int
        Number of evaluations of the right-hand side.
    njev : int
        Number of evaluations of the Jacobian.
    nlu : int
        Number of LU decompositions.

    References
    ----------
    .. [1] G. D. Byrne, A. C. Hindmarsh, "A Polyalgorithm for the Numerical
           Solution of Ordinary Differential Equations", ACM Transactions on
           Mathematical Software, Vol. 1, No. 1, pp. 71-96, March 1975.
    .. [2] L. F. Shampine, M. W. Reichelt, "THE MATLAB ODE SUITE", SIAM J. SCI.
           COMPUTE., Vol. 18, No. 1, pp. 1-22, January 1997.
    .. [3] E. Hairer, G. Wanner, "Solving Ordinary Differential Equations I:
           Nonstiff Problems", Sec. III.2.
    .. [4] A. Curtis, M. J. D. Powell, and J. Reid, "On the estimation of
           sparse Jacobian matrices", Journal of the Institute of Mathematics
           and its Applications, 13, pp. 117-120, 1974.
    g����MbP?g���ư>NFc����t|��t���|||||
d���t|���_t||�j��\�_�_��	�j
�j��}
|�:t�j	�j
�j|
�j
d�j�j���_nt|||���_d�_d�_t%dt&z|zt)d|dz�����_d�_��||	��\�_�_t5�j��r*�fd�}d�}t7�jd	�jj�
��}n-�fd�}d�}t;j�j�jj�
��}|�_|�_ |�_!t;j"gd���}t;j#dt;j$dt;j%dtLdz��z��f���_'d|z
�j'z�_(|�j'zdt;j%dtLdz��zz�_)t;j*tLdz�jf�jj�
��}�j|d<|
�jz�j
z|d<|�_+d�_,d�_-d�_.dS)NT)�support_complexr
rg���Q��?��?c�B���xjdz
c_t|��S�Nr
)�nlur��A�selfs �r$�luzBDF.__init__.<locals>.lu�s������A�
����A�w�w�r&c�,�|�|��S)N)�solve�r:�bs  r$r;zBDF.__init__.<locals>.solve_lu�s���x�x��{�{�"r&�csc)�format�dtypec�F���xjdz
c_t|d���S)Nr
T)�overwrite_a)rOrrPs �r$rSzBDF.__init__.<locals>.lu�s%������A�
��� ���5�5�5�5r&c�&�t||d���S)NT)�overwrite_b)rrVs  r$r;zBDF.__init__.<locals>.solve_lu�s����A�4�8�8�8�8r&�rZ)rg�G�z�ǿg�q�q��g��u���gsh��|?��rr��)/r�super�__init__r�max_stepr�n�rtol�atolr5�tr?r
�	direction�h_absr�	h_abs_old�error_norm_old�maxr�min�
newton_tol�
jac_factor�
_validate_jac�jacr"rrrZr�identityrSr;r!�array�hstack�cumsumr�	MAX_ORDER�gamma�alpha�error_const�emptyr*r�
n_equal_stepsr:)rRr5�t0�y0�t_boundrdrfrgrr�jac_sparsity�
vectorized�
first_step�
extraneousrCrSr;r!�kappar*�	__class__s`                  �r$rczBDF.__init__�s�����	�
�#�#�#�
������b�"�g�z�)-�	�	/�	/�	/�)�(�3�3��
�+�D�$���?�?���	�4�9��H�H�T�V�T�V�$�$����,�T�X�t�v�t�v�q�-1�^�Q�-1�Y��	�C�C�D�J�J�-�Z��W�E�E�D�J����"����b�3�h��o�s�4����/E�/E�F�F�������-�-�c�<�@�@����$�&��D�F���	8�
�
�
�
�
�
#�
#�
#��D�F�5����=�=�=�A�A�
6�
6�
6�
6�
6�
9�
9�
9���D�F�$�&�,�7�7�7�A���� ��
������@�@�@�A�A���Y��2�9�Q���1�i�!�m�1L�1L�-L�#M�#M�N�O�O��
��%�i�4�:�-��
� �4�:�-��B�I�a��Q��4O�4O�0O�O����H�i�!�m�T�V�,�D�F�L�A�A�A���v��!���4�:�~���.��!�������
��������r&c�h������j}�j���G��1t���rt����t	���}�|f���fd�}||���}�nTt���r��|���}�xjdz
c_t|��rt|�j���}���fd�}n"tj	|�j���}���fd�}|j
�j�jfkr4td�
�j�jf|j
�����n�t���rt��j���}ntj	��j���}|j
�j�jfkr4td�
�j�jf|j
�����d}||fS)Nc	����xjdz
c_��||��}t�j|||�j�j���\}�_|SrN)�njev�
fun_singler�fun_vectorizedrgrp)rhr?rCr"rR�sparsitys    ��r$�jac_wrappedz&BDF._validate_jac.<locals>.jac_wrappedsY����	�	�Q��	�	��O�O�A�q�)�)��%,�T�-@�!�Q��-1�Y���-5�&7�&7�"��4�?��r&r
r_c�d���xjdz
c_t�||���j���S�Nr
r_)r�rrZ�rhr?rrrRr~s  ���r$r�z&BDF._validate_jac.<locals>.jac_wrappeds1����I�I��N�I�I�%�c�c�!�Q�i�i�r�x�@�@�@�@r&c�n���xjdz
c_tj�||���j���Sr�)r�r�asarrayrZr�s  ���r$r�z&BDF._validate_jac.<locals>.jac_wrappeds3����I�I��N�I�I��:�c�c�!�Q�i�i�r�x�@�@�@�@r&z8`jac` is expected to have shape {}, but actually has {}.)rhr?rrr	�callabler�rZrr��shapere�
ValueErrorrY)rRrrr�r}�groupsr�r"r~s```    @r$rqzBDF._validate_jac�s/������
�V��
�V���;��#��H�%�%�4�)�(�3�3�H�&�x�0�0��$�f�-��
�
�
�
�
�
���B��#�#�A�A�
�c�]�]�	���B����A��I�I��N�I�I���{�{�
A��q���1�1�1��A�A�A�A�A�A�A�A��J�q���1�1�1��A�A�A�A�A�A�A��w�4�6�4�6�*�*�*� �"4�"(�&�$�&�$�&�)9�1�7�"C�"C�E�E�E�+�
��}�}�
4��s�"�(�3�3�3����J�s�"�(�3�3�3���w�4�6�4�6�*�*�*� �"4�"(�&�$�&�$�&�)9�1�7�"C�"C�E�E�E��K��A�~�r&c�n
�|j}|j}|j}dtjtj||jtjz��|z
��z}|j|kr(|}t||j
||jz��d|_n:|j|kr(|}t||j
||jz��d|_n|j}|j}|j
}|j
}|j}	|j}
|j}|j}|j}
|jdu}d}|�s;||kr	d|jfS||jz}||z}|j||jz
zdkr9|j}t||tj||z
��|z��d|_d}
||z
}tj|��}tj|d|dz�d���}||tj|��zz}tj|d|dz�j|
d|dz���|	|z}d}||	|z}|sn|
� |�|j||zz
��}
t7|j|||||
|j||j�	�	\}}}}|s|rn|�||��}d}
d}|�n|s#d}||z}t|||��d|_d}
���dd	t>zdzzd	t>z|zz}||tj|��zz}|||z}tA||z��}|dkr?tCtD||d
|dzzzz��}||z}t|||��d|_nd}|��;|xjdz
c_||_||_#||_||_|
|_|||dzz
||d	z<|||dz<tItK|dz����D]}||xx||dzz
cc<�|j|dzkrdS|dkr'||dz
||z}tA||z��} ntj} |tLkr*||dz||d	zz}!tA|!|z��}"ntj}"tj'| ||"g��}#tj(d�
��5|#d
tj)||dz��zz}$ddd��n#1swxYwYtj*|$��dz
}%||%z
}||_
tWtX|tj!|$��z��}|xj|zc_t|||��d|_d|_dS)NrrFr
rTrLg�������?r`���)TN�ignore)�dividera)-rhr*rdr�abs�	nextafterri�infrjr.rr|rgrfryrxrzr"r:rr�TOO_SMALL_STEPr�sumr(r)rSr!rGr5r;ror2rrm�
MIN_FACTORr?�reversedr1rwrt�errstater�argmaxrn�
MAX_FACTOR)&rRrhr*rd�min_steprjrgrfrryrxrzr"r:�current_jac�
step_accepted�hr6r7r<r9rAr8�n_iter�y_newr>r �safety�error�
error_norm�i�error_m�error_m_norm�error_p�error_p_norm�error_norms�factors�delta_orders&                                      r$�
_step_implzBDF._step_impl,s!���F���F���=�����r�|�A�t�~���/F�G�G�!�K�L�L�L���:�� � ��E��Q��
�H�t�z�$9�:�:�:�!"�D���
�Z�(�
"�
"��E��Q��
�H�t�z�$9�:�:�:�!"�D����J�E��y���y���
���
���
���&���F��
�W���h�$�&���
��>	%��x����d�1�1�1����&�A���E�E��~����!5�6��:�:������E�2�6�%�!�)�#4�#4�u�#<�=�=�=�%&��"�����	�A��F�1�I�I�E���q��%�!�)��}�1�5�5�5�I��4�"�&��"3�"3�3�3�E��&��1�e�a�i�<��*�E�!�U�Q�Y�,�,?�@�@�5��<�O�C��I��E�%�L� �A��

'��:������!�a�%��0�0�B�.>��H�e�Y��3��D�M��4�?�/,�/,�+�	�6�5�!�!�'�"�������	�2�2�A��B�"&�K� �

'��
���������E�6�*�*�*�%&��"�����A��.��2�3�q�>�7I�9?�8@�A�F��4�"�&��-�-�/�/�E���&��*�E��e�e�m�,�,�J��A�~�~��Z�#�j�R�5�1�9�5E�&F�F�H�H��������E�6�*�*�*�%&��"�"�!%�
�} �>	%�@	
���a������������
��������1�U�Q�Y�<�'��%�!�)����%�!�)���%���	�*�*�+�+�	�	�A�
�a�D�D�D�A�a�!�e�H��D�D�D�D�����	�)�)��:��1�9�9�!�%�!�)�,�q��x�7�G���%��0�0�L�L��6�L��9���!�%�!�)�,�q����|�;�G���%��0�0�L�L��6�L��h��j�,�G�H�H��
�[��
)�
)�
)�	H�	H�!�b�2�9�U�E�A�I�+F�+F�&F�G�G�	H�	H�	H�	H�	H�	H�	H�	H�	H�	H�	H����	H�	H�	H�	H��i��(�(�1�,��
������
��Z��"�&��/�/�!9�:�:���
�
�f��
�
���E�6�"�"�"��������zs�R.�.R2�5R2c
��t|j|j|j|jz|j|jd|jdz������SrN)�BdfDenseOutput�t_oldrhrjrirr*r0)rRs r$�_dense_output_implzBDF._dense_output_impl�sN���d�j�$�&�$�*�t�~�2M�"�j�$�&��$�*�q�.��*A�*F�*F�*H�*H�J�J�	Jr&)�__name__�
__module__�__qualname__�__doc__rr�rcrqr�r��
__classcell__�r�s@r$rIrIHs��������r�r�f79�f���4�d�!�d�9�9�9�9�9�9�v3�3�3�jM�M�M�^J�J�J�J�J�J�Jr&rIc�$��eZdZ�fd�Zd�Z�xZS)r�c���t���||��||_|j|t	j|j��zz
|_|dt	j|j��zz|_||_dSrN)	rbrcrrhrr�t_shift�denomr*)rRr�rhr�rr*r�s      �r$rczBdfDenseOutput.__init__�sk���
�������"�"�"���
��v��B�I�d�j�$9�$9� 9�9����!�b�i��
�3�3�3�4��
�����r&c��|jdkr'||jz
|jz}tj|��}n<||jdd�dfz
|jdd�dfz}tj|d���}tj|jdd�j|��}|jdkr||jdz
}n||jddd�dfz
}|S)Nrrr
)�ndimr�r�rrr(r*r))rRrh�x�pr?s     r$�
_call_implzBdfDenseOutput._call_impl�s����6�Q�;�;��T�\�!�T�Z�/�A��
�1�
�
�A�A��T�\�!�!�!�T�'�*�*�d�j����D��.A�A�A��
�1�1�%�%�%�A��F�4�6�!�"�"�:�<��#�#���6�Q�;�;�
�����N�A�A�
����1�1�1�d�
�#�#�A��r&)r�r�r�rcr�r�r�s@r$r�r��sG������������������r&r�)"�numpyr�scipy.linalgrr�scipy.sparserrr�scipy.sparse.linalgr�scipy.optimize._numdiffr	�commonrrr
rrrrr�baserrrwr2r�r�r%r.rGrIr��r&r$�<module>r�s�������,�,�,�,�,�,�,�,�2�2�2�2�2�2�2�2�2�2�$�$�$�$�$�$�1�1�1�1�1�1�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�)�(�(�(�(�(�(�(�
�	���
�
�
�
�!�!�!�0�0�0�!"�!"�!"�HuJ�uJ�uJ�uJ�uJ�)�uJ�uJ�uJ�p�����[�����r&

Youez - 2016 - github.com/yon3zu
LinuXploit