
    _Mh                         d Z g ZddlmZmZmZmZ ddlmZm	Z	m
Z
 i dddddd	d
ddddddddddd	dddd	ddddddddddZd Zd Zd ZdS )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                 8    | dvrd} |dvrd}t           | |f         S )NfdFDr   )_coerce_rules)xys     a/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/scipy/sparse/linalg/_isolve/utils.pycoercer      s-    1    c                     | S N r   s    r   idr      s    Hr   c                 h   | }t          |           } | j        d         | j        d         k    rt          d| j        f           | j        d         }t          |          }|j        |dfk    s,|j        |fk    s t          d| j         d|j         d          |j        j        dvr|                    d          }d	 }t          | d
          r| j        j        }n|                     |          j        j        }t          ||j        j                  }t          ||          }|                                }|t          |d          r|j        }nt          }t          |d          r|j        }	nt          }	|t          u r%|	t          u rt          | j        | j                  }nLt!          | j        ||	| j                  }n.t          |          }| j        |j        k    rt          d          |t#          ||          }
nt%          |t&                    r0|dk    r)|                                }|                    |          }
n^t+          ||          }
|
j        |dfk    s,|
j        |fk    s t          d| j         d|
j         d          |
                                }
| ||
||fS )a  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                     | S r   r   r   s    r   postprocessz make_system.<locals>.postprocessQ   s    r   dtype)r   N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_systemr6      s   B 
BAwqzQWQZN17*NNOOO	
A1AG!uA4 ( ( ( ( ( ( ) ) 	) 	w|6!!HHSMM   q '!&5!',''EA			A 	y2h 	YFFF2i   	jGGGR<<GrMM qwag>>>AAqwvw%&W. . .AA Q7agNOOO 
z!5!!!	B		 	::FFHHEA"E"""Aq6!!QW__ >AG > >#$7> > > ? ? ?GGIIaA{""r   N)__docformat____all__numpyr   r   r   r   scipy.sparse.linalg._interfacer   r   r	   r   r   r   r6   r   r   r   <module>r;      sU  %
 4 3 3 3 3 3 3 3 3 3 3 3          3  	#  y  3  )# /8 3  )# /8  3  !*#  09  3	  !*#	  09	 
 3     `# `# `# `# `#r   