
    \h[                        S SK Jr  S SKJr  SSKJr  SSKJr  SSKJ	r	J
r
Jr  SSKJrJrJrJrJrJrJrJrJrJrJrJrJrJrJr  SSKJrJrJrJ r   SS	K!J"r"J#r#J$r$J%r%  SS
K&J'r'J(r(J)r)J*r*J+r+J,r,J-r-J.r.J/r/J0r0J1r1J2r2J3r3J4r4  SSK5J6r6  SS/0r7 " S S\5      r8 " S S\85      r9 " S S\95      r: " S S\:5      r; " S S\5      r< " S S\5      r=g)    )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)zMatrixEigen.is_indefinitez MatrixEigen.is_negative_definitez$MatrixEigen.is_negative_semidefinitez MatrixEigen.is_positive_definitez$MatrixEigen.is_positive_semidefinite
matplotlibc                      \ rS rSrSr\4S jrS r\S4S jr	S r
S rS	 rSS
 jrS\4S jrSS jrSS jrSS jrS rSS jrS r\R                  \l        \R                  \l        \R                  \l        \R                  \l        \R                  \
l        \R                  \l        \R                  \	l        \R                  \l        \R                  \l        \R                  \l        \ R                  \l        \!R                  \l        \R                  \l        \"R                  \l        \#R                  \l        \$R                  \l        Sr%g)MatrixDeterminant/   zProvides basic matrix determinant operations. Should not be instantiated
directly. See ``determinant.py`` for their implementations.c                     [        XS9$ )N)
iszerofuncr   )selfr6   s     O/var/www/auris/envauris/lib/python3.13/site-packages/sympy/matrices/matrices.py_eval_det_bareiss#MatrixDeterminant._eval_det_bareiss3   s    D88    c                     [        U 5      $ N)r   r8   s    r9   _eval_det_berkowitz%MatrixDeterminant._eval_det_berkowitz6   s    d##r<   Nc                     [        XUS9$ )N)r6   simpfunc)r   )r8   r6   rC   s      r9   _eval_det_luMatrixDeterminant._eval_det_lu9   s    tXFFr<   c                     [        U 5      $ r>   )r   r?   s    r9   _eval_det_bird MatrixDeterminant._eval_det_bird<   s    r<   c                     [        U 5      $ r>   )r   r?   s    r9   _eval_det_laplace#MatrixDeterminant._eval_det_laplace?       D!!r<   c                     [        U 5      $ r>   r   r?   s    r9   _eval_determinant#MatrixDeterminant._eval_determinantB       Dzr<   c                     [        XS9$ Nmethod)r   r8   rU   s     r9   adjugateMatrixDeterminant.adjugateE   s    --r<   lambdac                     [        XUS9$ )N)xsimplify)r   r8   r[   r\   s      r9   charpolyMatrixDeterminant.charpolyH   s    X66r<   c                     [        XX#S9$ rS   )r   r8   ijrU   s       r9   cofactorMatrixDeterminant.cofactorK   s    !33r<   c                     [        XS9$ rS   )r   rV   s     r9   cofactor_matrix!MatrixDeterminant.cofactor_matrixN   s    44r<   c                     [        XUS9$ )N)rU   r6   rN   )r8   rU   r6   s      r9   detMatrixDeterminant.detQ   s    DJ??r<   c                     [        U 5      $ r>   )r   r?   s    r9   perMatrixDeterminant.perT   rQ   r<   c                     [        XX#S9$ rS   )r   ra   s       r9   minorMatrixDeterminant.minorW   s    dq00r<   c                     [        XU5      $ r>   )r   r8   rb   rc   s      r9   minor_submatrix!MatrixDeterminant.minor_submatrixZ   s    ++r<    	berkowitz)bareissN)&__name__
__module____qualname____firstlineno____doc__r	   r:   r@   r   rD   rG   rJ   rO   rW   r
   r^   rd   rg   rj   rm   rp   rt   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   __static_attributes__rv   r<   r9   r3   r3   /   s@   C ,E 9$ '. G". "I 745@1, ,B+I+I"+G+O+O (+7+?+?+9+A+A(1(9(9N+7+?+?+2??L+/<<+4+<+<H+4+<+<H+4+<+<H+;+C+CO+/<<CK+/<<CK+1>>EM+;+C+COr<   r3   c                   (   \ rS rSrSr\SS4S jr\S 5       r\S4S jr	S r
\SSS4S	 jr\R                  \l        \R                  \l        \R                  \	l        \R                  \l        SS
 jrS rS rS rS rS rS rSS jrSS jrSrg)MatrixReductionso   zProvides basic matrix row/column operations. Should not be instantiated
directly. See ``reductions.py`` for some of their implementations.Fc                     [        XUUS9$ )N)r6   r\   with_pivots)r   )r8   r6   r\   r   s       r9   echelon_formMatrixReductions.echelon_forms   s    T8') 	)r<   c                     [        U 5      $ r>   )r   r?   s    r9   
is_echelonMatrixReductions.is_echelonw   s    4  r<   c                     [        XUS9$ )N)r6   r\   )r   )r8   r6   r\   s      r9   rankMatrixReductions.rank{   s    T8DDr<   c                     [        U R                  X R                  U R                  5      U5      5      u  p#USS2SU R                  24   USS2UR                  * S24   4$ )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   hstackeyerowscols)r8   rhsr_s       r9   rref_rhsMatrixReductions.rref_rhs~   sU    " T[[xx		':C@AJTYYJ1sxxij=!111r<   Tc                     [        XUX4S9$ )N)r6   r\   pivotsnormalize_last)r   )r8   r6   r\   r   r   s        r9   rrefMatrixReductions.rref   s    T8: 	:r<   c                 2   US;  a  [        SR                  Xa5      5      eUS:X  a  U R                  OU R                  nUS:X  aR  Ub  UOUnUb  Uc  [        SR                  U5      5      eSUs=::  a  U:  d  O  [        SR                  Xb5      5      eGO}US	:X  a  X#XE1R	                  S/5      n[        U5      S
:  a  X$U1R	                  S/5      n[        U5      S
:w  a  [        SR                  U5      5      eUu  pESUs=::  a  U:  d  O  [        SR                  Xd5      5      eSUs=::  a  U:  d  O  [        SR                  Xe5      5      eOUS:X  a  Uc  UOUnUc  UOUnUb  Ub  Uc  [        SR                  U5      5      eX%:X  a  [        SR                  U5      5      eSUs=::  a  U:  d  O  [        SR                  Xb5      5      eSUs=::  a  U:  d  O  [        SR                  Xe5      5      eO[        S[        U5      -  5      eXX4U4$ )zValidate 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'colr   NzEFor a {0} operation 'n->kn' you must provide the kwargs `{0}` and `k`r   z#This matrix does not have a {} '{}'r      zIFor a {0} operation 'n<->m' you must provide the kwargs `{0}1` and `{0}2`r   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formatr   r   
differencelenrepr)	r8   opr   kcol1col2	error_str	self_colsr   s	            r9   _normalize_op_args#MatrixReductions._normalize_op_args   sG    22 ??Evi?TV V "+e!3DII	 =#dC{ai  "88>y8IK K'i' !F!M!Mi!]^^ ( 7] D'22D6:D4y1}4(33TF;4yA~  "<<BF9<MO OJD(y( !F!M!Mi!^__(y( !F!M!Mi!^__ ) 9_+$3C<4TD{dlai  "AAG	ART T{  "117	1BD D'i' !F!M!Mi!]^^(y( !F!M!Mi!^__ ) 3d2h>??%%r<   c                 f   ^ ^^ UUU 4S jnT R                  T R                  T R                  U5      $ )Nc                 .   > UT:X  a	  TTX4   -  $ TX4   $ r>   rv   )rb   rc   r   r   r8   s     r9   entryBMatrixReductions._eval_col_op_multiply_col_by_const.<locals>.entry   &    Cx4:~%:r<   _newr   r   )r8   r   r   r   s   ``` r9   "_eval_col_op_multiply_col_by_const3MatrixReductions._eval_col_op_multiply_col_by_const   %    	 yyDIIu55r<   c                 f   ^ ^^ UUU 4S jnT R                  T R                  T R                  U5      $ )Nc                 D   > UT:X  a  TU T4   $ UT:X  a  TU T4   $ TX4   $ r>   rv   )rb   rc   r   r   r8   s     r9   r   1MatrixReductions._eval_col_op_swap.<locals>.entry   s9    DyAtG}$dAtG}$:r<   r   )r8   r   r   r   s   ``` r9   _eval_col_op_swap"MatrixReductions._eval_col_op_swap   %    	 yyDIIu55r<   c                 j   ^ ^^^ UUUU 4S jnT R                  T R                  T R                  U5      $ )Nc                 >   > UT:X  a  TX4   TTU T4   -  -   $ TX4   $ r>   rv   )rb   rc   r   r   r   r8   s     r9   r   FMatrixReductions._eval_col_op_add_multiple_to_other_col.<locals>.entry   s4    CxADzAQW$555:r<   r   )r8   r   r   r   r   s   ```` r9   &_eval_col_op_add_multiple_to_other_col7MatrixReductions._eval_col_op_add_multiple_to_other_col   *    	 	 yyDIIu55r<   c                 f   ^ ^^ UUU 4S jnT R                  T R                  T R                  U5      $ )Nc                 D   > U T:X  a  TTU4   $ U T:X  a  TTU4   $ TX4   $ r>   rv   )rb   rc   row1row2r8   s     r9   r   1MatrixReductions._eval_row_op_swap.<locals>.entry   s9    DyD!G}$dD!G}$:r<   r   )r8   r   r   r   s   ``` r9   _eval_row_op_swap"MatrixReductions._eval_row_op_swap   r   r<   c                 f   ^ ^^ UUU 4S jnT R                  T R                  T R                  U5      $ )Nc                 .   > U T:X  a	  TTX4   -  $ TX4   $ r>   rv   )rb   rc   r   rowr8   s     r9   r   BMatrixReductions._eval_row_op_multiply_row_by_const.<locals>.entry   r   r<   r   )r8   r   r   r   s   ``` r9   "_eval_row_op_multiply_row_by_const3MatrixReductions._eval_row_op_multiply_row_by_const   r   r<   c                 j   ^ ^^^ UUUU 4S jnT R                  T R                  T R                  U5      $ )Nc                 >   > U T:X  a  TX4   TTTU4   -  -   $ TX4   $ r>   rv   )rb   rc   r   r   r   r8   s     r9   r   FMatrixReductions._eval_row_op_add_multiple_to_other_row.<locals>.entry   s4    CxADzAT1W$555:r<   r   )r8   r   r   r   r   s   ```` r9   &_eval_row_op_add_multiple_to_other_row7MatrixReductions._eval_row_op_add_multiple_to_other_row   r   r<   Nc                     U R                  XX4US5      u  pp4nUS:X  a  U R                  X#5      $ US:X  a  U R                  XE5      $ US:X  a  U R                  X#U5      $ g)a  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"
r   r   r   r   N)r   r   r   r   )r8   r   r   r   r   r   s         r9   elementary_col_op"MatrixReductions.elementary_col_op  s    ( "&!8!8!4QV!W$ =::3BB=))$55?>>stLL r<   c                     U R                  XX4US5      u  pp4nUS:X  a  U R                  X#5      $ US:X  a  U R                  XE5      $ US:X  a  U R                  X#U5      $ g)a  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   r   r   r   N)r   r   r   r   )r8   r   r   r   r   r   s         r9   elementary_row_op"MatrixReductions.elementary_row_op  r   r<   rv   )r   )r   NNNN)rz   r{   r|   r}   r~   r   r   propertyr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rv   r<   r9   r   r   o   s    J '.5 ) ! ! & E2( &d:
 )00L&..J ==DL ==DL5&n666666M<Mr<   r   c                       \ rS rSrSrS
S jrS\4S jrS
S jrS r	\
R                  \l        \R                  \l        \R                  \l        \R                  \	l        \" \	5      r	Srg	)MatrixSubspacesi>  zProvides methods relating to the fundamental subspaces of a matrix.
Should not be instantiated directly. See ``subspaces.py`` for their
implementations.Fc                     [        XS9$ N)r\   )r   r8   r\   s     r9   columnspaceMatrixSubspaces.columnspaceC  s    D44r<   c                     [        XUS9$ )N)r\   r6   )r   )r8   r\   r6   s      r9   	nullspaceMatrixSubspaces.nullspaceF  s    $jIIr<   c                     [        XS9$ r   )r    r   s     r9   rowspaceMatrixSubspaces.rowspaceI  s    11r<   c                      [        U /UQ70 UD6$ r>   )r!   )clsvecskwargss      r9   orthogonalizeMatrixSubspaces.orthogonalizeO  s    c3D3F33r<   rv   NF)rz   r{   r|   r}   r~   r   r   r   r   r   r   r   r    r!   classmethodr   rv   r<   r9   r   r   >  sg    5 "'7 J24 )00K&..I%--H*22M'6Mr<   r   c                      \ rS rSrSrSS jrS\4S jrSS jrSS jr	SS jr
SS	 jr\S
 5       r\S 5       r\S 5       r\S 5       r\S 5       rSS jrS rS r\R                  \l        \R                  \l        \R                  \l        \R                  \	l        \R                  \l        \R                  \l        \R                  \l        \R                  \l        \R                  \l        \R                  \l        \R                  \l        \ R                  \l        \!R                  \
l        \"R                  \l        Sr#g)MatrixEigeniZ  zProvides basic matrix eigenvalue/vector operations.
Should not be instantiated directly. See ``eigen.py`` for their
implementations.Tc                     [        U 4SU0UD6$ )Nerror_when_incomplete)r"   )r8   r   flagss      r9   	eigenvalsMatrixEigen.eigenvals_  s    $U6KUuUUr<   c                      [        U 4UUS.UD6$ )N)r   r6   )r#   )r8   r   r6   r   s       r9   
eigenvectsMatrixEigen.eigenvectsb  s$    4 07L%0).0 	0r<   c                     [        U 4SU0UD6$ )N
reals_only)r&   )r8   r   r   s      r9   is_diagonalizableMatrixEigen.is_diagonalizablef  s    !$H:HHHr<   c                     [        XUUS9$ )N)r   sort	normalize)r'   )r8   r   r  r  s       r9   diagonalizeMatrixEigen.diagonalizei  s    Dd#% 	%r<   c                     [        XS9$ N)upper)r$   r8   r	  s     r9   bidiagonalizeMatrixEigen.bidiagonalizem  s    d00r<   c                     [        XS9$ r  )r%   r
  s     r9   bidiagonal_decomposition$MatrixEigen.bidiagonal_decompositionp  s    (;;r<   c                     [        U 5      $ r>   )r(   r?   s    r9   is_positive_definite MatrixEigen.is_positive_definites      $T**r<   c                     [        U 5      $ r>   )r)   r?   s    r9   is_positive_semidefinite$MatrixEigen.is_positive_semidefinitew      (..r<   c                     [        U 5      $ r>   )r*   r?   s    r9   is_negative_definite MatrixEigen.is_negative_definite{  r  r<   c                     [        U 5      $ r>   )r+   r?   s    r9   is_negative_semidefinite$MatrixEigen.is_negative_semidefinite  r  r<   c                     [        U 5      $ r>   )r,   r?   s    r9   is_indefiniteMatrixEigen.is_indefinite  s    d##r<   c                     [        U 4SU0UD6$ )Ncalc_transform)r-   )r8   r"  r   s      r9   jordan_formMatrixEigen.jordan_form  s    DJJ6JJr<   c                     [        U 40 UD6$ r>   )r.   r8   r   s     r9   left_eigenvectsMatrixEigen.left_eigenvects  s    ...r<   c                     [        U 5      $ r>   )r/   r?   s    r9   singular_valuesMatrixEigen.singular_values  s    %%r<   rv   NTr   )FFF)$rz   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%   r   rv   r<   r9   r   r   Z  sn   V 04 0I%1< + + / / + + / / $ $K/& *4););I)4)<)<J);)C)C)5)=)=K)>)F)F )B)J)J$)>)F)F )B)J)J$)7)?)?M)5)=)=K)9)A)AO)9)A)AO)7)?)?M)B)J)J$r<   r   c                   >    \ rS rSrSrSS.S jrS rS rS rS	 r	S
r
g)MatrixCalculusi  z,Provides calculus-related matrix operations.T)evaluatec                    SSK Jn  U" U /UQ7SU06n[        U [        5      (       d  U(       a  UR	                  5       $ U$ )zCalculate 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/  )$sympy.tensor.array.array_derivativesr1  
isinstancer   
as_mutable)r8   r/  argsr   r1  derivs         r9   diffMatrixCalculus.diff  s?    * 	I?t?h?$&&8##%%r<   c                 .   ^ U R                  U4S j5      $ )Nc                 &   > U R                  T5      $ r>   r7  )r[   args    r9   <lambda>1MatrixCalculus._eval_derivative.<locals>.<lambda>  s    sr<   	applyfunc)r8   r<  s    `r9   _eval_derivativeMatrixCalculus._eval_derivative  s    ~~344r<   c                 2   ^^ U R                  UU4S j5      $ )af  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                 (   > U R                   " T0 TD6$ r>   )	integrate)r[   r5  r   s    r9   r=  *MatrixCalculus.integrate.<locals>.<lambda>  s    T(DV(Dr<   r?  )r8   r5  r   s    ``r9   rE  MatrixCalculus.integrate  s    2 ~~DEEr<   c                   ^ ^ [        T[        5      (       d  T R                  T5      mT R                  S   S:X  a  T R                  S   nO.T R                  S   S:X  a  T R                  S   nO[	        S5      eTR                  S   S:X  a  TR                  S   nO.TR                  S   S:X  a  TR                  S   nO[	        S5      eT R                  X#UU 4S j5      $ )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                 2   > TU    R                  TU   5      $ r>   r;  )rc   rb   Xr8   s     r9   r=  )MatrixCalculus.jacobian.<locals>.<lambda>  s    DGLL1,>r<   )r3  r0   r   shape	TypeError)r8   rJ  mns   ``  r9   jacobianMatrixCalculus.jacobian  s    H !Z((		!A ::a=A

1AZZ]a

1AGHH771:?
AWWQZ1_
A@AA yy>??r<   c                 .   ^ U R                  U4S j5      $ )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                 "   > U R                   " T6 $ r>   )limit)r[   r5  s    r9   r=  &MatrixCalculus.limit.<locals>.<lambda>+  s    r<   r?  )r8   r5  s    `r9   rT  MatrixCalculus.limit  s    * ~~677r<   rv   N)rz   r{   r|   r}   r~   r7  rA  rE  rP  rT  r   rv   r<   r9   r.  r.    s$    6#' 85F67@r8r<   r.  c                       \ rS rSrSr\" S5      \4S jrS rS r	S r
S rSS	 jrS
 rS rS rSS jrSS jrS rS rS rSrg)MatrixDeprecatedi/  z+A class to house deprecated matrix methods.rY   c                      U R                  US9$ )N)r[   )r^   r]   s      r9   berkowitz_charpoly#MatrixDeprecated.berkowitz_charpoly1  s    }}q}!!r<   c                      U R                  SS9$ )zOComputes determinant using Berkowitz method.

See Also
========

det
berkowitz
rx   rT   rj   r?   s    r9   berkowitz_detMatrixDeprecated.berkowitz_det4  s     xx{x++r<   c                 &    U R                   " S0 UD6$ )zWComputes eigenvalues of a Matrix using Berkowitz method.

See Also
========

berkowitz
rv   )r   r&  s     r9   berkowitz_eigenvals$MatrixDeprecated.berkowitz_eigenvals?  s     ~~&&&r<   c                     U R                   / p!U R                  5        H  nUR                  XS   -  5        U* nM     [        U5      $ )zPComputes principal minors using Berkowitz method.

See Also
========

berkowitz
)onerx   appendtuple)r8   signminorspolys       r9   berkowitz_minors!MatrixDeprecated.berkowitz_minorsI  sE     xxfNN$DMM$b/*5D % V}r<   c                    SSK Jn  SnU (       d  U$ U R                  (       d
  [        5       eX R                  pCS/US-
  -  n[        USS5       H  nU" US-   U5      US-
  pX8S U24   * US U2U4   pUS U2S U24   X8U4   * pU
/n[        SUS-
  5       H  nUR                  X<U   -  5        M     [        U5       H  u  pX-  S   X'   M     U R                  U/U-   n[        U5       H  nUS Xm-
  S-    X}S 2U4'   M     XuUS-
  '   M     U R                  U R                  US   * /5      /n[        U5       H  u  pUR                  XU   -  5        M     U[        [        [        U5      5      -   $ )Nr   )zeros))r   r   rd  r   )r   r   )sympy.matricesrn  	is_squarer   r   rangerf  	enumeratere  r   rg  map)r8   rn  berkAN
transformsrO  Tr   RCaitemsrb   Bpolyss                   r9   rx   MatrixDeprecated.berkowitzY  s   (K~~&((YY1SAE]
q!RAQ?AEq!eH9aAhqRaR!V9qAwhqCE1a!e_Qq\* % "%(E4= ) XXqME)E1X !%!),"a%  !"q1u' !* DHHqwh/01j)DALL1X& * eCu-...r<   c                      U R                  US9$ rS   )rg   rV   s     r9   cofactorMatrixMatrixDeprecated.cofactorMatrix  s    ##6#22r<   c                     [        U 5      $ r>   r7   r?   s    r9   
det_bareisMatrixDeprecated.det_bareis  rL   r<   c                      U R                  SS9$ )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
lurT   r]  r?   s    r9   det_LU_decomposition%MatrixDeprecated.det_LU_decomposition  s    & xxtx$$r<   c                      U R                  X!S9$ )N)size
eigenvalue)jordan_block)r8   eigenvalrO  s      r9   jordan_cellMatrixDeprecated.jordan_cell  s      a ==r<   c                 H    U R                  5       u  p#X#R                  5       4$ r>   )r#  get_diag_blocks)r8   calc_transformationPJs       r9   jordan_cellsMatrixDeprecated.jordan_cells  s$    !##%%%r<   c                 "    U R                  XUS9$ rS   )rp   ra   s       r9   
minorEntryMatrixDeprecated.minorEntry  s    zz!vz..r<   c                 $    U R                  X5      $ r>   )rt   rs   s      r9   minorMatrixMatrixDeprecated.minorMatrix  s    ##A))r<   c                 "    U R                  USS9$ )zEPermute the rows of the matrix with the given permutation in reverse.backward	directionpermute_rowsr8   perms     r9   permuteBkwdMatrixDeprecated.permuteBkwd  s       <<r<   c                 "    U R                  USS9$ )z:Permute the rows of the matrix with the given permutation.forwardr  r  r  s     r9   
permuteFwdMatrixDeprecated.permuteFwd  s       ;;r<   rv   Nrw   r,  )rz   r{   r|   r}   r~   r   r
   rZ  r^  ra  rk  rx   r  r  r  r  r  r  r  r  r  r   rv   r<   r9   rX  rX  /  sU    5#(?Y "	,' &/P3"%*>&/*=<r<   rX  N)>sympy.core.basicr   sympy.core.symbolr   commonr   
exceptionsr   	utilitiesr   r	   r
   determinantr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   
reductionsr   r   r   r   	subspacesr   r   r    r!   eigenr"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   
matrixbaser0   __doctest_requires__r3   r   r   r   r.  rX  rv   r<   r9   <module>r     s   
 # #   , D D     A @ J J6 6 6 6 #- 0<n =D =D@LM( LM^7& 78CK/ CKLK8\ K8^@<| @<r<   