
    (ph                         S r / rSSKJrJrJrJr  SSKJrJ	r	J
r
  0 SS_SS_SS	_S
S_SS_SS_SS_SS_SS	_SS_SS	_SS_SS_SS_SS_SS_rS rS rS rg)zrestructuredtext en    )
asanyarrayasarrayarrayzeros)aslinearoperatorLinearOperatorIdentityOperator)fr
   r
   )r
   dr   )r
   Fr   )r
   Dr   )r   r
   )r   r   )r   r   )r   r   )r   r
   )r   r   )r   r   )r   r   )r   r
   )r   r   )r   r   )r   r   c                 6    U S;  a  Sn US;  a  Sn[         X4   $ )NfdFDr   )_coerce_rules)xys     T/var/www/html/venv/lib/python3.13/site-packages/scipy/sparse/linalg/_isolve/utils.pycoercer      s'        c                     U $ N r   s    r   idr      s    Hr   c                    U n[        U 5      n U R                  S   U R                  S   :w  a  [        SU R                  4 35      eU R                  S   n[        U5      nUR                  US4:X  d7  UR                  U4:X  d&  [        SU R                   SUR                   S35      eUR                  R
                  S;  a  UR                  S5      nS	 n[        U S
5      (       a  U R                  R
                  nO%U R                  U5      R                  R
                  n[        XsR                  R
                  5      n[        X7S9nUR                  5       nUc  [        US5      (       a  UR                  nO[        n[        US5      (       a  UR                  n	O[        n	U[        L a(  U	[        L a  [        U R                  U R                  S9nOP[!        U R                  XU R                  S9nO0[        U5      nU R                  UR                  :w  a  [        S5      eUc
  [#        XWS9n
O[%        U[&        5      (       a(  US:X  a!  UR)                  5       nUR                  U5      n
Ob[+        X'S9n
U
R                  US4:X  d7  U
R                  U4:X  d&  [        SU R                   SU
R                   S35      eU
R                  5       n
XW
X64$ )aZ  Make a linear system Ax=b

Parameters
----------
A : LinearOperator
    sparse or dense matrix (or any valid input to aslinearoperator)
M : {LinearOperator, Nones}
    preconditioner
    sparse or dense matrix (or any valid input to aslinearoperator)
x0 : {array_like, str, None}
    initial guess to iterative method.
    ``x0 = 'Mb'`` means using the nonzero initial guess ``M @ b``.
    Default is `None`, which means using the zero initial guess.
b : array_like
    right hand side

Returns
-------
(A, M, x, b, postprocess)
    A : LinearOperator
        matrix of the linear system
    M : LinearOperator
        preconditioner
    x : rank 1 ndarray
        initial guess
    b : rank 1 ndarray
        right hand side
    postprocess : function
        converts the solution vector to the appropriate
        type and dimensions (e.g. (N,1) matrix)

r      z&expected square matrix, but got shape=zshapes of A z and b z are incompatibler   r   c                     U $ r   r   r   s    r   postprocess make_system.<locals>.postprocessQ   s    r   dtype)r    psolverpsolve)shaper    )matvecrmatvecr    z/matrix and preconditioner have different shapesMbz and x0 )r   r#   
ValueErrorr   r    charastypehasattrr$   r   r   ravelr!   r   r"   r	   r   r   
isinstancestrcopyr   )AMx0bA_Nr   xtyper!   r"   r   bCopys               r   make_systemr7      sk   B 
BAwwqzQWWQZA177*NOO	
A1AGG!uA4<yy A( ( ) 	) 	ww||6!HHSM q!!&&5'',,'EA		A 	y2hYYFF2i  jjGGR<GrM qwwagg>Aqwwv%&WW.A Q77aggNOO 
z!!	B		:FFHEA""Aq6!QWW_|AGG9 5##$77)+<> ? ?GGIA""r   N)__docformat____all__numpyr   r   r   r   scipy.sparse.linalg._interfacer   r   r	   r   r   r   r7   r   r   r   <module>r<      s   %
 4 3  3  	#  y  3  )# /8 3  )# /8  3  !*#  09  3	  !*#	  09	 
 3 `#r   