U
    ZÊ¹jð[  ã                   @   sr  d dl mZ d dlmZ ddlmZ ddlmZ ddlm	Z	m
Z
mZ ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZmZmZm Z  dd	l!m"Z"m#Z#m$Z$m%Z% dd
l&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4 ddl5m6Z6 ddgiZ7G dd„ deƒZ8G dd„ de8ƒZ9G dd„ de9ƒZ:G dd„ de:ƒZ;G dd„ deƒZ<G dd„ deƒZ=dS )é    )ÚBasic)ÚDummyé   )ÚMatrixCommon)ÚNonSquareMatrixError)Ú_iszeroÚ_is_zero_after_expand_mulÚ	_simplify)Ú_find_reasonable_pivotÚ_find_reasonable_pivot_naiveÚ	_adjugateÚ	_charpolyÚ	_cofactorÚ_cofactor_matrixÚ_perÚ_detÚ_det_bareissÚ_det_berkowitzÚ	_det_birdÚ_det_laplaceÚ_det_LUÚ_minorÚ_minor_submatrix)Ú_is_echelonÚ_echelon_formÚ_rankÚ_rref)Ú_columnspaceÚ
_nullspaceÚ	_rowspaceÚ_orthogonalize)Ú
_eigenvalsÚ_eigenvectsÚ_bidiagonalizeÚ_bidiagonal_decompositionÚ_is_diagonalizableÚ_diagonalizeÚ_is_positive_definiteÚ_is_positive_semidefiniteÚ_is_negative_definiteÚ_is_negative_semidefiniteÚ_is_indefiniteÚ_jordan_formÚ_left_eigenvectsÚ_singular_values)Ú
MatrixBase)úMatrixEigen.is_indefiniteú MatrixEigen.is_negative_definiteú$MatrixEigen.is_negative_semidefiniteú MatrixEigen.is_positive_definiteú$MatrixEigen.is_positive_semidefiniteZ
matplotlibc                   @   s  e Zd ZdZefdd„Zdd„ Zedfdd„Zd	d
„ Z	dd„ Z
dd„ Zd"dd„Zdefdd„Zd#dd„Zd$dd„Zd%dd„Zdd„ Zd&dd„Zd d!„ Zeje_eje_eje_eje_eje	_eje
_eje_eje_eje_eje_eje_e je_eje_e!je_e"je_e#je_dS )'ÚMatrixDeterminantzˆProvides basic matrix determinant operations. Should not be instantiated
    directly. See ``determinant.py`` for their implementations.c                 C   s   t | |d�S )N)Ú
iszerofunc©r   )Úselfr6   © r9   úV/var/www/html/bwave/python/venv/lib/python3.8/site-packages/sympy/matrices/matrices.pyÚ_eval_det_bareiss3   s    z#MatrixDeterminant._eval_det_bareissc                 C   s   t | ƒS ©N)r   ©r8   r9   r9   r:   Ú_eval_det_berkowitz6   s    z%MatrixDeterminant._eval_det_berkowitzNc                 C   s   t | ||d�S )N)r6   Úsimpfunc)r   )r8   r6   r?   r9   r9   r:   Ú_eval_det_lu9   s    zMatrixDeterminant._eval_det_luc                 C   s   t | ƒS r<   )r   r=   r9   r9   r:   Ú_eval_det_bird<   s    z MatrixDeterminant._eval_det_birdc                 C   s   t | ƒS r<   )r   r=   r9   r9   r:   Ú_eval_det_laplace?   s    z#MatrixDeterminant._eval_det_laplacec                 C   s   t | ƒS r<   ©r   r=   r9   r9   r:   Ú_eval_determinantB   s    z#MatrixDeterminant._eval_determinantÚ	berkowitzc                 C   s   t | |d�S ©N©Úmethod)r   ©r8   rH   r9   r9   r:   ÚadjugateE   s    zMatrixDeterminant.adjugateÚlambdac                 C   s   t | ||d�S )N)ÚxÚsimplify)r   ©r8   rL   rM   r9   r9   r:   ÚcharpolyH   s    zMatrixDeterminant.charpolyc                 C   s   t | |||d�S rF   )r   ©r8   ÚiÚjrH   r9   r9   r:   ÚcofactorK   s    zMatrixDeterminant.cofactorc                 C   s   t | |d�S rF   )r   rI   r9   r9   r:   Úcofactor_matrixN   s    z!MatrixDeterminant.cofactor_matrixÚbareissc                 C   s   t | ||d�S )N)rH   r6   rC   )r8   rH   r6   r9   r9   r:   ÚdetQ   s    zMatrixDeterminant.detc                 C   s   t | ƒS r<   )r   r=   r9   r9   r:   ÚperT   s    zMatrixDeterminant.perc                 C   s   t | |||d�S rF   )r   rP   r9   r9   r:   ÚminorW   s    zMatrixDeterminant.minorc                 C   s   t | ||ƒS r<   )r   ©r8   rQ   rR   r9   r9   r:   Úminor_submatrixZ   s    z!MatrixDeterminant.minor_submatrix)rE   )rE   )rE   )rU   N)rE   )$Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r;   r>   r   r@   rA   rB   rD   rJ   r	   rO   rS   rT   rV   rW   rX   rZ   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r9   r9   r9   r:   r5   /   s>   




r5   c                   @   sÂ   e Zd ZdZeddfdd„Zedd„ ƒZedfdd„Zd	d
„ Z	edddfdd„Z
eje_eje_eje_eje
_d#dd„Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd$dd „Zd%d!d"„ZdS )&ÚMatrixReductionszŽProvides basic matrix row/column operations. Should not be instantiated
    directly. See ``reductions.py`` for some of their implementations.Fc                 C   s   t | |||d�S )N)r6   rM   Úwith_pivots)r   )r8   r6   rM   r`   r9   r9   r:   Úechelon_forms   s    ÿzMatrixReductions.echelon_formc                 C   s   t | ƒS r<   )r   r=   r9   r9   r:   Ú
is_echelonw   s    zMatrixReductions.is_echelonc                 C   s   t | ||d�S )N)r6   rM   )r   )r8   r6   rM   r9   r9   r:   Úrank{   s    zMatrixReductions.rankc                 C   sL   t |  | |  | j¡|¡ƒ\}}|dd…d| j…f |dd…|j d…f fS )aÅ  Return reduced row-echelon form of matrix, matrix showing
        rhs after reduction steps. ``rhs`` must have the same number
        of rows as ``self``.

        Examples
        ========

        >>> from sympy import Matrix, symbols
        >>> r1, r2 = symbols('r1 r2')
        >>> Matrix([[1, 1], [2, 1]]).rref_rhs(Matrix([r1, r2]))
        (Matrix([
        [1, 0],
        [0, 1]]), Matrix([
        [ -r1 + r2],
        [2*r1 - r2]]))
        N)r   ZhstackÚeyeÚrowsÚcols)r8   ÚrhsÚrÚ_r9   r9   r:   Úrref_rhs~   s    zMatrixReductions.rref_rhsTc                 C   s   t | ||||d�S )N)r6   rM   ÚpivotsÚnormalize_last)r   )r8   r6   rM   rk   rl   r9   r9   r:   Úrref’   s     ÿzMatrixReductions.rrefÚcolc           	      C   s&  |dkrt d ||¡ƒ‚|dkr&| jn| j}|dkrŒ|dk	r@|n|}|dksT|dkrbt d |¡ƒ‚d|  krv|k sˆn t d ||¡ƒ‚�nŒ|d	k�r@||||h dg¡}t|ƒd
krÈ|||h dg¡}t|ƒd
krât d |¡ƒ‚|\}}d|  k�r|k �sn t d ||¡ƒ‚d|  k�r,|k �sn t d ||¡ƒ‚nØ|dk�r|dk�rX|n|}|dk�rj|n|}|dk�sŒ|dk�sŒ|dk�ršt d |¡ƒ‚||k�r²t d |¡ƒ‚d|  k�rÊ|k �sÜn t d ||¡ƒ‚d|  k�rô|k �sn t d ||¡ƒ‚nt dt|ƒ ƒ‚|||||fS )z�Validate the arguments for a row/column operation.  ``error_str``
        can be one of "row" or "col" depending on the arguments being parsed.)ún->knún<->mún->n+kmzOUnknown {} operation '{}'. Valid col operations are 'n->kn', 'n<->m', 'n->n+km'rn   ro   NzEFor a {0} operation 'n->kn' you must provide the kwargs `{0}` and `k`r   z#This matrix does not have a {} '{}'rp   é   zIFor a {0} operation 'n<->m' you must provide the kwargs `{0}1` and `{0}2`rq   zPFor a {0} operation 'n->n+km' you must provide the kwargs `{0}`, `k`, and `{0}2`zAFor a {0} operation 'n->n+km' `{0}` and `{0}2` must be different.zinvalid operation %s)Ú
ValueErrorÚformatrf   re   Ú
differenceÚlenÚrepr)	r8   Úoprn   ÚkÚcol1Úcol2Z	error_strZ	self_colsrf   r9   r9   r:   Ú_normalize_op_argsœ   sX     ÿÿ
ÿ
ÿ
ÿz#MatrixReductions._normalize_op_argsc                    s"   ‡ ‡‡fdd„}ˆ  ˆjˆj|¡S )Nc                    s$   |ˆ krˆˆ| |f  S ˆ| |f S r<   r9   ©rQ   rR   ©rn   ry   r8   r9   r:   ÚentryÔ   s    zBMatrixReductions._eval_col_op_multiply_col_by_const.<locals>.entry©Ú_newre   rf   )r8   rn   ry   r   r9   r~   r:   Ú"_eval_col_op_multiply_col_by_constÓ   s    z3MatrixReductions._eval_col_op_multiply_col_by_constc                    s"   ‡ ‡‡fdd„}ˆ  ˆjˆj|¡S )Nc                    s4   |ˆ krˆ| ˆf S |ˆkr(ˆ| ˆ f S ˆ| |f S r<   r9   r}   ©rz   r{   r8   r9   r:   r   Û   s
    z1MatrixReductions._eval_col_op_swap.<locals>.entryr€   )r8   rz   r{   r   r9   rƒ   r:   Ú_eval_col_op_swapÚ   s    z"MatrixReductions._eval_col_op_swapc                    s$   ‡ ‡‡‡fdd„}ˆ  ˆjˆj|¡S )Nc                    s0   |ˆ kr$ˆ| |f ˆˆ| ˆf   S ˆ| |f S r<   r9   r}   ©rn   r{   ry   r8   r9   r:   r   ä   s    zFMatrixReductions._eval_col_op_add_multiple_to_other_col.<locals>.entryr€   )r8   rn   ry   r{   r   r9   r…   r:   Ú&_eval_col_op_add_multiple_to_other_colã   s    z7MatrixReductions._eval_col_op_add_multiple_to_other_colc                    s"   ‡ ‡‡fdd„}ˆ  ˆjˆj|¡S )Nc                    s4   | ˆ krˆˆ|f S | ˆkr(ˆˆ |f S ˆ| |f S r<   r9   r}   ©Úrow1Úrow2r8   r9   r:   r   ë   s
    z1MatrixReductions._eval_row_op_swap.<locals>.entryr€   )r8   rˆ   r‰   r   r9   r‡   r:   Ú_eval_row_op_swapê   s    z"MatrixReductions._eval_row_op_swapc                    s"   ‡ ‡‡fdd„}ˆ  ˆjˆj|¡S )Nc                    s$   | ˆkrˆ ˆ| |f  S ˆ| |f S r<   r9   r}   ©ry   Úrowr8   r9   r:   r   ô   s    zBMatrixReductions._eval_row_op_multiply_row_by_const.<locals>.entryr€   )r8   rŒ   ry   r   r9   r‹   r:   Ú"_eval_row_op_multiply_row_by_constó   s    z3MatrixReductions._eval_row_op_multiply_row_by_constc                    s$   ‡ ‡‡‡fdd„}ˆ  ˆjˆj|¡S )Nc                    s0   | ˆkr$ˆ| |f ˆ ˆˆ|f   S ˆ| |f S r<   r9   r}   ©ry   rŒ   r‰   r8   r9   r:   r   û   s    zFMatrixReductions._eval_row_op_add_multiple_to_other_row.<locals>.entryr€   )r8   rŒ   ry   r‰   r   r9   rŽ   r:   Ú&_eval_row_op_add_multiple_to_other_rowú   s    z7MatrixReductions._eval_row_op_add_multiple_to_other_rowro   Nc                 C   s`   |   |||||d¡\}}}}}|dkr2|  ||¡S |dkrF|  ||¡S |dkr\|  |||¡S dS )ad  Performs the elementary column operation `op`.

        `op` may be one of

            * ``"n->kn"`` (column n goes to k*n)
            * ``"n<->m"`` (swap column n and column m)
            * ``"n->n+km"`` (column n goes to column n + k*column m)

        Parameters
        ==========

        op : string; the elementary row operation
        col : the column to apply the column operation
        k : the multiple to apply in the column operation
        col1 : one column of a column swap
        col2 : second column of a column swap or column "m" in the column operation
               "n->n+km"
        rn   ro   rp   rq   N)r|   r‚   r„   r†   )r8   rx   rn   ry   rz   r{   r9   r9   r:   Úelementary_col_op  s    z"MatrixReductions.elementary_col_opc                 C   s`   |   |||||d¡\}}}}}|dkr2|  ||¡S |dkrF|  ||¡S |dkr\|  |||¡S dS )a4  Performs the elementary row operation `op`.

        `op` may be one of

            * ``"n->kn"`` (row n goes to k*n)
            * ``"n<->m"`` (swap row n and row m)
            * ``"n->n+km"`` (row n goes to row n + k*row m)

        Parameters
        ==========

        op : string; the elementary row operation
        row : the row to apply the row operation
        k : the multiple to apply in the row operation
        row1 : one row of a row swap
        row2 : second row of a row swap or row "m" in the row operation
               "n->n+km"
        rŒ   ro   rp   rq   N)r|   r�   rŠ   r�   )r8   rx   rŒ   ry   rˆ   r‰   r9   r9   r:   Úelementary_row_op  s    z"MatrixReductions.elementary_row_op)rn   )ro   NNNN)ro   NNNN)r[   r\   r]   r^   r   ra   Úpropertyrb   rc   rj   rm   r   r   r   r   r|   r‚   r„   r†   rŠ   r�   r�   r�   r‘   r9   r9   r9   r:   r_   o   s,   
ÿ

7		
r_   c                   @   sb   e Zd ZdZddd„Zdefdd„Zddd„Zd	d
„ Ze	je_e
je_eje_eje_eeƒZdS )ÚMatrixSubspacesz Provides methods relating to the fundamental subspaces of a matrix.
    Should not be instantiated directly. See ``subspaces.py`` for their
    implementations.Fc                 C   s   t | |d�S ©N)rM   )r   ©r8   rM   r9   r9   r:   ÚcolumnspaceC  s    zMatrixSubspaces.columnspacec                 C   s   t | ||d�S )N)rM   r6   )r   )r8   rM   r6   r9   r9   r:   Ú	nullspaceF  s    zMatrixSubspaces.nullspacec                 C   s   t | |d�S r”   )r   r•   r9   r9   r:   ÚrowspaceI  s    zMatrixSubspaces.rowspacec                 O   s   t | f|ž|ŽS r<   )r    )ÚclsZvecsÚkwargsr9   r9   r:   ÚorthogonalizeO  s    zMatrixSubspaces.orthogonalizeN)F)F)r[   r\   r]   r^   r–   r   r—   r˜   r›   r   r   r   r    Úclassmethodr9   r9   r9   r:   r“   >  s   

r“   c                   @   s  e Zd ZdZd!dd„Zdefdd„Zd"dd	„Zd#d
d„Zd$dd„Z	d%dd„Z
edd„ ƒZedd„ ƒZedd„ ƒZedd„ ƒZedd„ ƒZd&dd„Zdd„ Zdd„ Zeje_eje_eje_eje_eje_eje_eje_eje_eje_eje_eje_eje_e je	_e!je
_d S )'ÚMatrixEigenzŒProvides basic matrix eigenvalue/vector operations.
    Should not be instantiated directly. See ``eigen.py`` for their
    implementations.Tc                 K   s   t | fd|i|—ŽS )NÚerror_when_incomplete)r!   )r8   rž   Úflagsr9   r9   r:   Ú	eigenvals_  s    zMatrixEigen.eigenvalsc                 K   s   t | f||dœ|—ŽS )N)rž   r6   )r"   )r8   rž   r6   rŸ   r9   r9   r:   Ú
eigenvectsb  s
    ÿÿzMatrixEigen.eigenvectsFc                 K   s   t | fd|i|—ŽS )NÚ
reals_only)r%   )r8   r¢   rš   r9   r9   r:   Úis_diagonalizablef  s    zMatrixEigen.is_diagonalizablec                 C   s   t | |||d�S )N)r¢   ÚsortÚ	normalize)r&   )r8   r¢   r¤   r¥   r9   r9   r:   Údiagonalizei  s    ÿzMatrixEigen.diagonalizec                 C   s   t | |d�S ©N)Úupper)r#   ©r8   r¨   r9   r9   r:   Úbidiagonalizem  s    zMatrixEigen.bidiagonalizec                 C   s   t | |d�S r§   )r$   r©   r9   r9   r:   Úbidiagonal_decompositionp  s    z$MatrixEigen.bidiagonal_decompositionc                 C   s   t | ƒS r<   )r'   r=   r9   r9   r:   Úis_positive_definites  s    r3   c                 C   s   t | ƒS r<   )r(   r=   r9   r9   r:   Úis_positive_semidefinitew  s    r4   c                 C   s   t | ƒS r<   )r)   r=   r9   r9   r:   Úis_negative_definite{  s    r1   c                 C   s   t | ƒS r<   )r*   r=   r9   r9   r:   Úis_negative_semidefinite  s    r2   c                 C   s   t | ƒS r<   )r+   r=   r9   r9   r:   Úis_indefiniteƒ  s    r0   c                 K   s   t | fd|i|—ŽS )NÚcalc_transform)r,   )r8   r±   rš   r9   r9   r:   Újordan_form‡  s    zMatrixEigen.jordan_formc                 K   s   t | f|ŽS r<   )r-   ©r8   rŸ   r9   r9   r:   Úleft_eigenvectsŠ  s    zMatrixEigen.left_eigenvectsc                 C   s   t | ƒS r<   )r.   r=   r9   r9   r:   Úsingular_values�  s    zMatrixEigen.singular_valuesN)T)F)FFF)T)T)T)"r[   r\   r]   r^   r    r   r¡   r£   r¦   rª   r«   r’   r¬   r­   r®   r¯   r°   r²   r´   rµ   r!   r"   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r#   r$   r9   r9   r9   r:   r�   Z  sD   










r�   c                   @   s>   e Zd ZdZddœdd„Zdd„ Zdd	„ Zd
d„ Zdd„ ZdS )ÚMatrixCalculusz,Provides calculus-related matrix operations.T)Úevaluatec                O   s:   ddl m} || f|žd|iŽ}t| tƒs6|r6| ¡ S |S )ae  Calculate the derivative of each element in the matrix.

        Examples
        ========

        >>> from sympy import Matrix
        >>> from sympy.abc import x, y
        >>> M = Matrix([[x, y], [1, 0]])
        >>> M.diff(x)
        Matrix([
        [1, 0],
        [0, 0]])

        See Also
        ========

        integrate
        limit
        r   )ÚArrayDerivativer·   )Z$sympy.tensor.array.array_derivativesr¸   Ú
isinstancer   Z
as_mutable)r8   r·   Úargsrš   r¸   Zderivr9   r9   r:   Údiff£  s
    zMatrixCalculus.diffc                    s   |   ‡ fdd„¡S )Nc                    s
   |   ˆ ¡S r<   ©r»   ©rL   ©Úargr9   r:   Ú<lambda>À  ó    z1MatrixCalculus._eval_derivative.<locals>.<lambda>©Z	applyfunc)r8   r¿   r9   r¾   r:   Ú_eval_derivative¿  s    zMatrixCalculus._eval_derivativec                    s   |   ‡ ‡fdd„¡S )aþ  Integrate each element of the matrix.  ``args`` will
        be passed to the ``integrate`` function.

        Examples
        ========

        >>> from sympy import Matrix
        >>> from sympy.abc import x, y
        >>> M = Matrix([[x, y], [1, 0]])
        >>> M.integrate((x, ))
        Matrix([
        [x**2/2, x*y],
        [     x,   0]])
        >>> M.integrate((x, 0, 2))
        Matrix([
        [2, 2*y],
        [2,   0]])

        See Also
        ========

        limit
        diff
        c                    s   | j ˆ ˆŽS r<   )Ú	integrater½   ©rº   rš   r9   r:   rÀ   Û  rÁ   z*MatrixCalculus.integrate.<locals>.<lambda>rÂ   )r8   rº   rš   r9   rÅ   r:   rÄ   Â  s    zMatrixCalculus.integratec                    s¤   t ˆ tƒsˆ ˆ ¡‰ ˆjd dkr.ˆjd }n"ˆjd dkrHˆjd }ntdƒ‚ˆ jd dkrjˆ jd }n"ˆ jd dkr„ˆ jd }ntdƒ‚ˆ ||‡ ‡fdd„¡S )aæ  Calculates the Jacobian matrix (derivative of a vector-valued function).

        Parameters
        ==========

        ``self`` : vector of expressions representing functions f_i(x_1, ..., x_n).
        X : set of x_i's in order, it can be a list or a Matrix

        Both ``self`` and X can be a row or a column matrix in any order
        (i.e., jacobian() should always work).

        Examples
        ========

        >>> from sympy import sin, cos, Matrix
        >>> from sympy.abc import rho, phi
        >>> X = Matrix([rho*cos(phi), rho*sin(phi), rho**2])
        >>> Y = Matrix([rho, phi])
        >>> X.jacobian(Y)
        Matrix([
        [cos(phi), -rho*sin(phi)],
        [sin(phi),  rho*cos(phi)],
        [   2*rho,             0]])
        >>> X = Matrix([rho*cos(phi), rho*sin(phi)])
        >>> X.jacobian(Y)
        Matrix([
        [cos(phi), -rho*sin(phi)],
        [sin(phi),  rho*cos(phi)]])

        See Also
        ========

        hessian
        wronskian
        r   r   z)``self`` must be a row or a column matrixz"X must be a row or a column matrixc                    s   ˆ|    ˆ | ¡S r<   r¼   )rR   rQ   ©ÚXr8   r9   r:   rÀ     rÁ   z)MatrixCalculus.jacobian.<locals>.<lambda>)r¹   r/   r�   ÚshapeÚ	TypeError)r8   rÇ   ÚmÚnr9   rÆ   r:   ÚjacobianÝ  s    $

zMatrixCalculus.jacobianc                    s   |   ‡ fdd„¡S )až  Calculate the limit of each element in the matrix.
        ``args`` will be passed to the ``limit`` function.

        Examples
        ========

        >>> from sympy import Matrix
        >>> from sympy.abc import x, y
        >>> M = Matrix([[x, y], [1, 0]])
        >>> M.limit(x, 2)
        Matrix([
        [2, y],
        [1, 0]])

        See Also
        ========

        integrate
        diff
        c                    s
   | j ˆ Ž S r<   )Úlimitr½   ©rº   r9   r:   rÀ   +  rÁ   z&MatrixCalculus.limit.<locals>.<lambda>rÂ   )r8   rº   r9   rÎ   r:   rÍ     s    zMatrixCalculus.limitN)	r[   r\   r]   r^   r»   rÃ   rÄ   rÌ   rÍ   r9   r9   r9   r:   r¶      s   9r¶   c                   @   s�   e Zd ZdZedƒefdd„Zdd„ Zdd„ Zd	d
„ Z	dd„ Z
d"dd„Zdd„ Zdd„ Zdd„ Zd#dd„Zd$dd„Zdd„ Zdd„ Zdd „ Zd!S )%ÚMatrixDeprecatedz+A class to house deprecated matrix methods.rK   c                 C   s   | j |d�S )Nr½   )rO   rN   r9   r9   r:   Úberkowitz_charpoly1  s    z#MatrixDeprecated.berkowitz_charpolyc                 C   s   | j dd�S )zwComputes determinant using Berkowitz method.

        See Also
        ========

        det
        berkowitz
        rE   rG   ©rV   r=   r9   r9   r:   Úberkowitz_det4  s    	zMatrixDeprecated.berkowitz_detc                 K   s   | j f |ŽS )zwComputes eigenvalues of a Matrix using Berkowitz method.

        See Also
        ========

        berkowitz
        )r    r³   r9   r9   r:   Úberkowitz_eigenvals?  s    z$MatrixDeprecated.berkowitz_eigenvalsc                 C   s:   | j g  }}|  ¡ D ]}| ||d  ¡ | }qt|ƒS )zpComputes principal minors using Berkowitz method.

        See Also
        ========

        berkowitz
        éÿÿÿÿ)ÚonerE   ÚappendÚtuple)r8   ÚsignZminorsZpolyr9   r9   r:   Úberkowitz_minorsI  s
    z!MatrixDeprecated.berkowitz_minorsc                 C   sš  ddl m} d}| s|S | js$tƒ ‚| | j }}dg|d  }t|ddƒD � ]ü}||d |ƒ|d  }}||d |…f  |d |…|f  }	}
|d |…d |…f |||f   }}|
g}td|d ƒD ]}| |||  ¡ qÄt|ƒD ]\}}|	| d ||< qä| j|g| }t|ƒD ]&}|d || d … ||d …|f< �q|||d < qJ|  	| j|d  g¡g}t|ƒD ]\}}| |||  ¡ �qj|t
tt
|ƒƒ S )Nr   )Úzeros))r   r   rÔ   rr   )r   r   )Zsympy.matricesrÚ   Z	is_squarer   re   ÚrangerÖ   Ú	enumeraterÕ   r�   r×   Úmap)r8   rÚ   ZberkÚAÚNZ
transformsrË   ÚTry   ÚRÚCÚaÚitemsrQ   ÚBZpolysr9   r9   r:   rE   Y  s2    $$$zMatrixDeprecated.berkowitzrE   c                 C   s   | j |d�S rF   )rT   rI   r9   r9   r:   ÚcofactorMatrix�  s    zMatrixDeprecated.cofactorMatrixc                 C   s   t | ƒS r<   r7   r=   r9   r9   r:   Ú
det_bareis„  s    zMatrixDeprecated.det_bareisc                 C   s   | j dd�S )a´  Compute matrix determinant using LU decomposition.


        Note that this method fails if the LU decomposition itself
        fails. In particular, if the matrix has no inverse this method
        will fail.

        TODO: Implement algorithm for sparse matrices (SFF),
        https://www.eecis.udel.edu/~saunders/papers/sffge/it5.ps

        See Also
        ========


        det
        det_bareiss
        berkowitz_det
        ZlurG   rÑ   r=   r9   r9   r:   Údet_LU_decomposition‡  s    z%MatrixDeprecated.det_LU_decompositionc                 C   s   | j ||d�S )N)ÚsizeZ
eigenvalue)Zjordan_block)r8   ZeigenvalrË   r9   r9   r:   Újordan_cellœ  s    zMatrixDeprecated.jordan_cellTc                 C   s   |   ¡ \}}|| ¡ fS r<   )r²   Zget_diag_blocks)r8   Zcalc_transformationÚPÚJr9   r9   r:   Újordan_cellsŸ  s    zMatrixDeprecated.jordan_cellsc                 C   s   | j |||d�S rF   )rX   rP   r9   r9   r:   Ú
minorEntry£  s    zMatrixDeprecated.minorEntryc                 C   s   |   ||¡S r<   )rZ   rY   r9   r9   r:   ÚminorMatrix¦  s    zMatrixDeprecated.minorMatrixc                 C   s   | j |dd�S )zEPermute the rows of the matrix with the given permutation in reverse.Zbackward©Ú	direction©Zpermute_rows©r8   Úpermr9   r9   r:   ÚpermuteBkwd©  s    zMatrixDeprecated.permuteBkwdc                 C   s   | j |dd�S )z:Permute the rows of the matrix with the given permutation.Úforwardrð   rò   ró   r9   r9   r:   Ú
permuteFwd­  s    zMatrixDeprecated.permuteFwdN)rE   )T)rE   )r[   r\   r]   r^   r   r	   rÐ   rÒ   rÓ   rÙ   rE   ræ   rç   rè   rê   rí   rî   rï   rõ   r÷   r9   r9   r9   r:   rÏ   /  s   
(


rÏ   N)>Zsympy.core.basicr   Zsympy.core.symbolr   Úcommonr   Ú
exceptionsr   Z	utilitiesr   r   r	   Zdeterminantr
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Z
reductionsr   r   r   r   Z	subspacesr   r   r   r    Zeigenr!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   Z
matrixbaser/   Z__doctest_requires__r5   r_   r“   r�   r¶   rÏ   r9   r9   r9   r:   Ú<module>   s(   D@û	@ PF 