| 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/sparse/linalg/_isolve/__pycache__/ |
Upload File : |
�
d�c�R � �v � d Z dgZddlZddlmZ ddlmZ ej ej � � j
Z
d� Z dd�ZdS )
as Sparse Equations and Least Squares.
The original Fortran code was written by C. C. Paige and M. A. Saunders as
described in
C. C. Paige and M. A. Saunders, LSQR: An algorithm for sparse linear
equations and sparse least squares, TOMS 8(1), 43--71 (1982).
C. C. Paige and M. A. Saunders, Algorithm 583; LSQR: Sparse linear
equations and least-squares problems, TOMS 8(2), 195--209 (1982).
It is licensed under the following BSD license:
Copyright (c) 2006, Systems Optimization Laboratory
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Stanford University nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The Fortran code was translated to Python for use in CVXOPT by Jeffery
Kline with contributions by Mridul Aanjaneya and Bob Myhill.
Adapted for SciPy by Stefan van der Walt.
�lsqr� N)�sqrt)�aslinearoperatorc �� � |dk r$t j | � � dt | � � fS | dk r$dt j |� � t |� � fS t |� � t | � � k r:| |z }t j |� � t d||z z � � z }||z }||z }n9|| z }t j | � � t d||z z � � z }||z }| |z }|||fS )aP
Stable implementation of Givens rotation.
Notes
-----
The routine 'SymOrtho' was added for numerical stability. This is
recommended by S.-C. Choi in [1]_. It removes the unpleasant potential of
``1/eps`` in some important places (see, for example text following
"Compute the next plane rotation Qk" in minres.py).
References
----------
.. [1] S.-C. Choi, "Iterative Methods for Singular Linear Equations
and Least-Squares Problems", Dissertation,
http://www.stanford.edu/group/SOL/dissertations/sou-cheng-choi-thesis.pdf
r � )�np�sign�absr )�a�b�tau�s�c�rs �B/usr/lib/python3/dist-packages/scipy/sparse/linalg/_isolve/lsqr.py�
_sym_orthor = s� � �$ �A�v�v��w�q�z�z�1�c�!�f�f�$�$�
�a����"�'�!�*�*�c�!�f�f�$�$� �Q���#�a�&�&����!�e���G�A�J�J��a�#��)�m�,�,�,��
��G��
��E����!�e���G�A�J�J��a��C��i���(��
��G��
��E���a��7�N� � ���ư>� �חAFc
�R
� t | � � } t j |� � }|j dk r|� � � }| j \ }
}|�d|z }t j |� � }d}
|rxt d� � t d� � d|
� d|� d �}d
||fz }d||fz }d||fz }t |� � t |� � t |� � t |� � d
}d
}d
}|d
k rd|z }d
}d
}|dz }d
}d
}d
}d
}d
}d}d
}|}t j � |� � } | �)t j |� � }!| �
� � }"nKt j | � � }!|| � |!� � z
}t j � |� � }"|"d
k r=d|"z |z }| �
|� � }#t j � |#� � }$n|!�
� � }#d
}$|$d
k rd|$z |#z }#|#�
� � }%|$}&|"}'|"}(|(})|(}*|$|"z }+|+d
k r#|rt |
d
� � |!|||)|*|||+||f
S d},d}-|rRt d� � t |,|-� � d}.|$|"z }/d||!d
fz }d|)|*fz }d|.|/fz }t |||� � ||k �rO|dz }| � |#� � |$|z z
}t j � |� � }"|"d
k rqd|"z |z }t |dz |$dz z |"dz z |z � � }| �
|� � |"|#z z
}#t j � |#� � }$|$d
k rd|$z |#z }#|d
k r*t |&dz |z � � }0|&|0z }1||0z }2|2|'z }3|1|'z }'n|&}0d}3t |0|"� � \ }4}5}6|5|$z }7|4 |$z }&|4|'z }8|5|'z }'|5|8z }9|8|6z }:|7 |6z };d|6z |%z }<|!|:|%z z }!|#|;|%z z }%|t j � |<� � dz z }|r||<dz z }||6z }=| |6z }>|8|=|z z
}?|?|>z }@t ||@dz z � � }t |>dz |7dz z � � }A|>|Az }|7|Az }|?|Az }||dz z }|t |� � z }|'dz }B||3dz z }t |B|z � � }(|$t! |9� � z }+|d
k r1|(dz ||z z
}Ct t! |C� � � � })|Cd
k r|) })n|(})|(}*|(| z }.|+||(z t"