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 :  /lib/python3/dist-packages/scipy/linalg/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/scipy/linalg/__pycache__/_decomp_qr.cpython-311.pyc
�

d�c�5��X�dZddlZddlmZddlmZgd�Zd�Z		dd�Z		dd
�Z	dd�Z
dS)zQR decomposition functions.�N�)�get_lapack_funcs)�_datacopied)�qr�qr_multiply�rqc�(�|�dd��}|dvr@d|d<||i|��}|ddj�tj��|d<||i|��}|ddkrtd|d|fz���|dd�S)z[Call a LAPACK routine, determining lwork automatically and handling
    error return values�lworkN)N���r���rz-illegal value in %dth argument of internal %s)�get�real�astype�numpy�int_�
ValueError)�f�name�args�kwargsr
�rets      �9/usr/lib/python3/dist-packages/scipy/linalg/_decomp_qr.py�safecallrs���
�J�J�w��%�%�E��
�����w���a�� �� � ���b�'�!�*�/�0�0���<�<��w��
�!�T�
�V�
�
�C�
�2�w��{�{��H� ��W�H�d�+�,�-�-�	-��s��s�8�O�F�fullTc���|dvrtd���|rtj|��}ntj|��}t	|j��dkrtd���|j\}}|pt
||��}|r0td|f��\}	t|	d||���\}
}}|dz}n*td	|f��\}
t|
d
|||���\}
}|dvs||krtj	|
��}n tj	|
d
|�d
d
�f��}|r||f}n|f}|dkr|S|dkr|
|ff|zStd|
f��\}||kr$t|d|
d
d
�d
|�f||d���\}nd|dkrt|d|
||d���\}nF|
j
j}tj||f|���}|
|d
d
�d
|�f<t|d|||d���\}|f|zS)a�
    Compute QR decomposition of a matrix.

    Calculate the decomposition ``A = Q R`` where Q is unitary/orthogonal
    and R upper triangular.

    Parameters
    ----------
    a : (M, N) array_like
        Matrix to be decomposed
    overwrite_a : bool, optional
        Whether data in `a` is overwritten (may improve performance if
        `overwrite_a` is set to True by reusing the existing input data
        structure rather than creating a new one.)
    lwork : int, optional
        Work array size, lwork >= a.shape[1]. If None or -1, an optimal size
        is computed.
    mode : {'full', 'r', 'economic', 'raw'}, optional
        Determines what information is to be returned: either both Q and R
        ('full', default), only R ('r') or both Q and R but computed in
        economy-size ('economic', see Notes). The final option 'raw'
        (added in SciPy 0.11) makes the function return two matrices
        (Q, TAU) in the internal format used by LAPACK.
    pivoting : bool, optional
        Whether or not factorization should include pivoting for rank-revealing
        qr decomposition. If pivoting, compute the decomposition
        ``A P = Q R`` as above, but where P is chosen such that the diagonal
        of R is non-increasing.
    check_finite : bool, optional
        Whether to check that the input matrix contains only finite numbers.
        Disabling may give a performance gain, but may result in problems
        (crashes, non-termination) if the inputs do contain infinities or NaNs.

    Returns
    -------
    Q : float or complex ndarray
        Of shape (M, M), or (M, K) for ``mode='economic'``. Not returned
        if ``mode='r'``.
    R : float or complex ndarray
        Of shape (M, N), or (K, N) for ``mode='economic'``. ``K = min(M, N)``.
    P : int ndarray
        Of shape (N,) for ``pivoting=True``. Not returned if
        ``pivoting=False``.

    Raises
    ------
    LinAlgError
        Raised if decomposition fails

    Notes
    -----
    This is an interface to the LAPACK routines dgeqrf, zgeqrf,
    dorgqr, zungqr, dgeqp3, and zgeqp3.

    If ``mode=economic``, the shapes of Q and R are (M, K) and (K, N) instead
    of (M,M) and (M,N), with ``K=min(M,N)``.

    Examples
    --------
    >>> import numpy as np
    >>> from scipy import linalg
    >>> rng = np.random.default_rng()
    >>> a = rng.standard_normal((9, 6))

    >>> q, r = linalg.qr(a)
    >>> np.allclose(a, np.dot(q, r))
    True
    >>> q.shape, r.shape
    ((9, 9), (9, 6))

    >>> r2 = linalg.qr(a, mode='r')
    >>> np.allclose(r, r2)
    True

    >>> q3, r3 = linalg.qr(a, mode='economic')
    >>> q3.shape, r3.shape
    ((9, 6), (6, 6))

    >>> q4, r4, p4 = linalg.qr(a, pivoting=True)
    >>> d = np.abs(np.diag(r4))
    >>> np.all(d[1:] <= d[:-1])
    True
    >>> np.allclose(a[:, p4], np.dot(q4, r4))
    True
    >>> q4.shape, r4.shape, p4.shape
    ((9, 9), (9, 6), (6,))

    >>> q5, r5, p5 = linalg.qr(a, mode='economic', pivoting=True)
    >>> q5.shape, r5.shape, p5.shape
    ((9, 6), (6, 6), (6,))

    )rr�r�economic�rawz>Mode argument should be one of ['full', 'r','economic', 'raw']�zexpected a 2-D array)�geqp3r!)�overwrite_ar)�geqrfr#�r
r")rrNrr)�orgqrz
gorgqr/gungqrr��dtype)
rr�asarray_chkfinite�asarray�len�shaperrr�triur'�char�empty)�ar"r
�mode�pivoting�check_finite�a1�M�Nr!r�jpvt�taur#�R�Rj�
gor_un_gqr�Q�t�qqrs                    rrrs|��B�9�9�9��.�/�/�	/���
�
$�Q�
'�
'���
�]�1�
�
��
�2�8�}�}�����/�0�0�0�
�8�D�A�q��5�+�b�!�"4�"4�K��4�!�*�r�e�4�4��� �����M�M�M�
��D�#���	���!�*�r�e�4�4����5�'�2�U�'2�4�4�4���C��&�&�&�!�a�%�%��J�r�N�N����J�r�"�1�"�a�a�a�%�y�!�!����
��W���
�R���s�{�{��	�	
�����S�	�|�b� � �"�:��u�5�5�K�J��1�u�u�
�j�/�2�a�a�a��!��e�9�c�!�q�2�2�2����	
��	�	�
�j�/�2�s�%�"#�%�%�%����
�H�M���k�1�a�&��*�*�*����A�A�A�r��r�E�
�
�j�/�3��5�"#�%�%�%���
�4�"�9�r�rightc
�|�|dvr"td�|�����tj|��}|jdkr$d}tj|��}|dkr|j}nd}tjtj|����}|j\}}	|dkrV|jdt||	|||	z
zz��kr-td�|j|j�����n>||jd	kr-td
�|j|j�����t||dd|��}
|
d\}}td
|f��\}
|
jdvrd}nd}|dd�dt||	���f}||	kr�|dkr~|s||r:tj
|jd	|f|jd���}|j|dd�d|	�f<n6tj
||jd	f|jd���}||d|	�dd�f<d}|rd}nd}d}n7|jdr|dks|r|j}|dkrd}nd}nd}|}|dkrd}nd}t!|
d||||||���\}|dkr|j}|dkr|dd�dt||	���f}|r|���}|f|
d	d�zS)a�	
    Calculate the QR decomposition and multiply Q with a matrix.

    Calculate the decomposition ``A = Q R`` where Q is unitary/orthogonal
    and R upper triangular. Multiply Q with a vector or a matrix c.

    Parameters
    ----------
    a : (M, N), array_like
        Input array
    c : array_like
        Input array to be multiplied by ``q``.
    mode : {'left', 'right'}, optional
        ``Q @ c`` is returned if mode is 'left', ``c @ Q`` is returned if
        mode is 'right'.
        The shape of c must be appropriate for the matrix multiplications,
        if mode is 'left', ``min(a.shape) == c.shape[0]``,
        if mode is 'right', ``a.shape[0] == c.shape[1]``.
    pivoting : bool, optional
        Whether or not factorization should include pivoting for rank-revealing
        qr decomposition, see the documentation of qr.
    conjugate : bool, optional
        Whether Q should be complex-conjugated. This might be faster
        than explicit conjugation.
    overwrite_a : bool, optional
        Whether data in a is overwritten (may improve performance)
    overwrite_c : bool, optional
        Whether data in c is overwritten (may improve performance).
        If this is used, c must be big enough to keep the result,
        i.e. ``c.shape[0]`` = ``a.shape[0]`` if mode is 'left'.

    Returns
    -------
    CQ : ndarray
        The product of ``Q`` and ``c``.
    R : (K, N), ndarray
        R array of the resulting QR factorization where ``K = min(M, N)``.
    P : (N,) ndarray
        Integer pivot array. Only returned when ``pivoting=True``.

    Raises
    ------
    LinAlgError
        Raised if QR decomposition fails.

    Notes
    -----
    This is an interface to the LAPACK routines ``?GEQRF``, ``?ORMQR``,
    ``?UNMQR``, and ``?GEQP3``.

    .. versionadded:: 0.11.0

    Examples
    --------
    >>> import numpy as np
    >>> from scipy.linalg import qr_multiply, qr
    >>> A = np.array([[1, 3, 3], [2, 3, 2], [2, 3, 3], [1, 3, 2]])
    >>> qc, r1, piv1 = qr_multiply(A, 2*np.eye(4), pivoting=1)
    >>> qc
    array([[-1.,  1., -1.],
           [-1., -1.,  1.],
           [-1., -1., -1.],
           [-1.,  1.,  1.]])
    >>> r1
    array([[-6., -3., -5.            ],
           [ 0., -1., -1.11022302e-16],
           [ 0.,  0., -1.            ]])
    >>> piv1
    array([1, 0, 2], dtype=int32)
    >>> q2, r2, piv2 = qr(A, mode='economic', pivoting=1)
    >>> np.allclose(2*q2 - qc, np.zeros((4, 3)))
    True

    )�leftr>z8Mode argument can only be 'left' or 'right' but not '{}'r Tr@Frz=Array shapes are not compatible for Q @ c operation: {} vs {}rz=Array shapes are not compatible for c @ Q operation: {} vs {}Nr)�ormqr)�s�d�T�C�F)r'�orderr5r8�L�C_CONTIGUOUSz
gormqr/gunmqr)�overwrite_cr>)r�formatrr(�ndim�
atleast_2drDr)r+�minrr�typecode�zerosr'�flagsr�ravel)r/�cr0r1�	conjugater"rJ�onedimr4r5rr;r7�
gor_un_mqr�trans�cc�lr�cQs                  rrr�s=��X�$�$�$��$�$*�F�4�L�L�2�2�	2�
���"�"�A��v��z�z�����Q�����6�>�>���A����
����q�)�)�*�*�A��7�D�A�q��v�~�~��7�1�:��Q��K��1��$5� 5�6�6�6�6��4�4:�F�1�7�A�G�4L�4L�N�N�
N�7�
����
�?�?��4�4:�F�1�7�A�G�4L�4L�N�N�
N�
�Q��T�5�(�
3�
3�C�
��V�F�A�s�"�:��t�4�4�K�J���j�(�(������	�!�!�!�Z�c�!�Q�i�i�Z�-��A��1�u�u��������	���a�g�a�j�!�_�A�G�3�G�G�G�B���B�q�q�q�"�1�"�u�I�I���a�����_�A�G�3�G�G�G�B��B�r��r�1�1�1�u�I��E��	��B�B��B����	
���	 ��U�c�\�\�Y�\�
�S���6�>�>��B�B��B�B���
���6�>�>��B�B��B�
�:���E�1�c�2�*�,�,�,�C�B���|�|�
�T���w���
����:�C��1�I�I�:�
�
��
��
�X�X�Z�Z���5�3�q�r�r�7�?�rc�&�|dvrtd���|rtj|��}ntj|��}t	|j��dkrtd���|j\}}|pt
||��}td|f��\}t|d|||���\}	}
|dkr||krtj	|	||z
��}n"tj	|	|d	�|d	�f��}|d
kr|Std|	f��\}||kr!t|d|	|d	�|
|d
���\}
nZ|dkrt|d|	|
|d
���\}
n<tj
||f|	j���}|	||d	�<t|d||
|d
���\}
||
fS)a�
    Compute RQ decomposition of a matrix.

    Calculate the decomposition ``A = R Q`` where Q is unitary/orthogonal
    and R upper triangular.

    Parameters
    ----------
    a : (M, N) array_like
        Matrix to be decomposed
    overwrite_a : bool, optional
        Whether data in a is overwritten (may improve performance)
    lwork : int, optional
        Work array size, lwork >= a.shape[1]. If None or -1, an optimal size
        is computed.
    mode : {'full', 'r', 'economic'}, optional
        Determines what information is to be returned: either both Q and R
        ('full', default), only R ('r') or both Q and R but computed in
        economy-size ('economic', see Notes).
    check_finite : bool, optional
        Whether to check that the input matrix contains only finite numbers.
        Disabling may give a performance gain, but may result in problems
        (crashes, non-termination) if the inputs do contain infinities or NaNs.

    Returns
    -------
    R : float or complex ndarray
        Of shape (M, N) or (M, K) for ``mode='economic'``. ``K = min(M, N)``.
    Q : float or complex ndarray
        Of shape (N, N) or (K, N) for ``mode='economic'``. Not returned
        if ``mode='r'``.

    Raises
    ------
    LinAlgError
        If decomposition fails.

    Notes
    -----
    This is an interface to the LAPACK routines sgerqf, dgerqf, cgerqf, zgerqf,
    sorgrq, dorgrq, cungrq and zungrq.

    If ``mode=economic``, the shapes of Q and R are (K, N) and (M, K) instead
    of (N,N) and (M,N), with ``K=min(M,N)``.

    Examples
    --------
    >>> import numpy as np
    >>> from scipy import linalg
    >>> rng = np.random.default_rng()
    >>> a = rng.standard_normal((6, 9))
    >>> r, q = linalg.rq(a)
    >>> np.allclose(a, r @ q)
    True
    >>> r.shape, q.shape
    ((6, 9), (9, 9))
    >>> r2 = linalg.rq(a, mode='r')
    >>> np.allclose(r, r2)
    True
    >>> r3, q3 = linalg.rq(a, mode='economic')
    >>> r3.shape, q3.shape
    ((6, 6), (6, 9))

    )rrrz8Mode argument should be one of ['full', 'r', 'economic']r zexpected matrix)�gerqfr\r$rNr)�orgrqz
gorgrq/gungrqrr&)rrr(r)r*r+rrrr,r.r')r/r"r
r0r2r3r4r5r\rr7r8�
gor_un_grqr;�rq1s               rrrFs���B�,�,�,��K�M�M�	M���
�
$�Q�
'�
'���
�]�1�
�
��
�2�8�}�}�����*�+�+�+�
�8�D�A�q��5�+�b�!�"4�"4�K�
�j�2�%�
0�
0�F�E��u�g�r��#.�0�0�0�G�B���:����Q����J�r�1�Q�3������J�r�1�"�#�#��r�s�s�(�|�$�$���s�{�{���"�:��u�5�5�K�J��1�u�u�
�j�/�2�q�b�c�c�7�C�u�"#�%�%�%����	
��	�	�
�j�/�2�s�%�"#�%�%�%�����k�1�a�&���1�1�1����Q�B�C�C��
�j�/�3��5�"#�%�%�%���
�a�4�Kr)FNrFT)r>FFFF)FNrT)�__doc__r�lapackr�_miscr�__all__rrrr�rr�<module>res���!�!�����%�$�$�$�$�$�������
%�
%�
%�����@E��U�U�U�U�p?D�/4�Q�Q�Q�Q�hg�g�g�g�g�gr

Youez - 2016 - github.com/yon3zu
LinuXploit