§
    OŠtjÚt  ã                   ó@  — 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 d dlmZmZ d dlmZ d dlmZmZmZmZ d d	lmZ d d
lmZ d dlmZmZ d dlm Z  d dl!m"Z" d dl#m$Z$m%Z% ddl&m'Z'm(Z(m)Z) ddl*m+Z+m,Z, ddl-m.Z.  G d„ de,¦  «        Z/ G d„ de/¦  «        Z0d„ Z1dS )é    )Údefaultdict)Úindex)ÚExpr)ÚKindÚ
NumberKindÚUndefinedKind)ÚIntegerÚRational)Ú_sympifyÚSympifyError)ÚS)ÚZZÚQQÚGFÚEXRAW)ÚDomainMatrix)ÚDMNonInvertibleMatrixError)ÚCoercionFailedÚNotInvertible)Úsympy_deprecation_warning)Úis_sequence)Ú
filldedentÚas_inté   )Ú
ShapeErrorÚNonSquareMatrixErrorÚNonInvertibleMatrixError)ÚclassofÚ
MatrixBase)Ú
MatrixKindc                   ó„  — e Zd ZU dZeed<   d„ Zd+d„Zed„ ¦   «         Z	ed„ ¦   «         Z
ed„ ¦   «         Zed	„ ¦   «         Zd
„ Zd„ Zd„ Zed„ ¦   «         Zd„ Zd„ Zd„ Zd„ Zedefd„¦   «         Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zed„ ¦   «         Z ed„ ¦   «         Z!d„ Z"d„ Z#d „ Z$d!„ Z%d"„ Z&d#„ Z'd$„ Z(d,d&„Z)d'„ Z*d-d)„Z+d-d*„Z,dS ).Ú	RepMatrixa<  Matrix implementation based on DomainMatrix as an internal representation.

    The RepMatrix class is a superclass for Matrix, ImmutableMatrix,
    SparseMatrix and ImmutableSparseMatrix which are the main usable matrix
    classes in SymPy. Most methods on this class are simply forwarded to
    DomainMatrix.
    Ú_repc                 óò   — t          |t          ¦  «        sD	 t          |¦  «        }n# t          $ r
 t          cY S w xY wt          |t          ¦  «        st          S | j                             |j        ¦  «        S ©N)Ú
isinstancer"   r   r   ÚNotImplementedr#   Úunify_eq©ÚselfÚothers     úV/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sympy/matrices/repmatrix.pyÚ__eq__zRepMatrix.__eq__5   s}   € å˜%¥Ñ+Ô+ð 	&ð&Ý  ™œ��øÝð &ð &ð &Ý%Ð%Ð%Ð%ð&øøøå˜e¥YÑ/Ô/ð &Ý%Ð%àŒy×!Ò! %¤*Ñ-Ô-Ð-s   —' §;º;Nc                 ó¨  — |�+|rt          d¦  «        ‚| j                             |¦  «        S | j        }|j        }|sa|j        r|                     ¦   «         S |j        r?	 |                     t          ¦  «        S # t          $ r Y nw xY w|                     ¦   «         S  |j	        di |¤Ž}|j        j
        r|                     t          ¦  «        }|S )aG  Convert to a :class:`~.DomainMatrix`.

        Examples
        ========

        >>> from sympy import Matrix
        >>> M = Matrix([[1, 2], [3, 4]])
        >>> M.to_DM()
        DomainMatrix({0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}}, (2, 2), ZZ)

        The :meth:`DomainMatrix.to_Matrix` method can be used to convert back:

        >>> M.to_DM().to_Matrix() == M
        True

        The domain can be given explicitly or otherwise it will be chosen by
        :func:`construct_domain`. Any keyword arguments (besides ``domain``)
        are passed to :func:`construct_domain`:

        >>> from sympy import QQ, symbols
        >>> x = symbols('x')
        >>> M = Matrix([[x, 1], [1, x]])
        >>> M
        Matrix([
        [x, 1],
        [1, x]])
        >>> M.to_DM().domain
        ZZ[x]
        >>> M.to_DM(field=True).domain
        ZZ(x)
        >>> M.to_DM(domain=QQ[x]).domain
        QQ[x]

        See Also
        ========

        DomainMatrix
        DomainMatrix.to_Matrix
        DomainMatrix.convert_to
        DomainMatrix.choose_domain
        construct_domain
        Nz,Options cannot be used with domain parameter© )Ú	TypeErrorr#   Ú
convert_toÚdomainÚis_ZZÚcopyÚis_QQr   r   Úchoose_domainÚis_EXr   )r*   r2   ÚkwargsÚrepÚdomÚrep_doms         r,   Úto_DMzRepMatrix.to_DMA   sù   € ðV ÐØð PÝÐ NÑOÔOÐOØ”9×'Ò'¨Ñ/Ô/Ð/àŒiˆØŒjˆð ð 		"ØŒyð "Ø—x’x‘z”zÐ!Ø”ð "ðØŸ>š>­"Ñ-Ô-Ð-øÝ%ð ð ð Ø�Dðøøøà—x’x‘z”zÐ!ð $�#Ô#Ð-Ð- fÐ-Ð-ˆð Œ>Ôð 	0Ø×(Ò(­Ñ/Ô/ˆGàˆs   Á!A; Á;
BÂBc                 ól  — |j         }t          |¦  «        }|t          k    r]|j        r|}n|j        rt
          }nt          }||k    r|                     |¦  «        }|}|t          k    r|                     |¦  «        }|t          k    r(t          |t          ¦  «        st          dddd¬¦  «         ||fS )Ná+  
                non-Expr objects in a Matrix is deprecated. Matrix represents
                a mathematical matrix. To represent a container of non-numeric
                entities, Use a list of lists, TableForm, NumPy array, or some
                other data structure instead.
                ú1.9údeprecated-non-expr-in-matrixé   ©Údeprecated_since_versionÚactive_deprecations_targetÚ
stacklevel)r2   r   r   Ú
is_IntegerÚis_Rationalr   r1   Ú
from_sympyr&   r   r   )Úclsr9   Úelementr2   Ú
new_domains        r,   Ú_unify_element_sympyzRepMatrix._unify_element_sympy�   sÑ   € à”ˆÝ˜7Ñ#Ô#ˆà•UŠ?ˆ?àÔ!ð #Ø#�
�
ØÔ$ð #Ý�
�
å"�
ð
 ˜VÒ#Ð#Ø—n’n ZÑ0Ô0�Ø#�à�ŠˆØ$×/Ò/°Ñ8Ô8�à•UŠ?ˆ?¥:¨gµtÑ#<Ô#<ˆ?Ý%ðð */Ø+JØð
ñ 
ô 
ð 
ð �Gˆ|Ðó    c                 ó\  — t          d„ |D ¦   «         ¦  «        st          dddd¬¦  «         t          |||ft          ¦  «        }t          d„ |D ¦   «         ¦  «        rNt          d„ |D ¦   «         ¦  «        r|                     t
          ¦  «        }n|                     t          ¦  «        }|S )	Nc              3   ó@   K  — | ]}t          |t          ¦  «        V — Œd S r%   )Ú
issubclassr   ©Ú.0Útyps     r,   ú	<genexpr>z1RepMatrix._dod_to_DomainMatrix.<locals>.<genexpr>º   s,   è è € Ð:Ð:¨S•:˜c¥4Ñ(Ô(Ð:Ð:Ð:Ð:Ð:Ð:rM   r>   r?   r@   é   rB   c              3   ó@   K  — | ]}t          |t          ¦  «        V — Œd S r%   )rP   r
   rQ   s     r,   rT   z1RepMatrix._dod_to_DomainMatrix.<locals>.<genexpr>É   s,   è è € Ð:Ð:¨S�z˜#�xÑ(Ô(Ð:Ð:Ð:Ð:Ð:Ð:rM   c              3   ó@   K  — | ]}t          |t          ¦  «        V — Œd S r%   )rP   r	   rQ   s     r,   rT   z1RepMatrix._dod_to_DomainMatrix.<locals>.<genexpr>Ê   s,   è è € Ð=Ð=°•:˜c¥7Ñ+Ô+Ð=Ð=Ð=Ð=Ð=Ð=rM   )Úallr   r   r   r1   r   r   )rI   ÚrowsÚcolsÚdodÚtypesr9   s         r,   Ú_dod_to_DomainMatrixzRepMatrix._dod_to_DomainMatrix·   sÈ   € õ Ð:Ð:°EÐ:Ñ:Ô:Ñ:Ô:ð 	Ý%ðð */Ø+JØð
ñ 
ô 
ð 
õ ˜3  t ­eÑ4Ô4ˆåÐ:Ð:°EÐ:Ñ:Ô:Ñ:Ô:ð 	)ÝÐ=Ð=°uÐ=Ñ=Ô=Ñ=Ô=ð )Ø—n’n¥RÑ(Ô(��à—n’n¥RÑ(Ô(�àˆ
rM   c                 ó  — t          t          ¦  «        }t          |¦  «        D ])\  }}|dk    rt          ||¦  «        \  }}|||         |<   Œ*t	          t          t          |¦  «        ¦  «        }	|                      ||||	¦  «        }
|
S ©Nr   )r   ÚdictÚ	enumerateÚdivmodÚsetÚmapÚtyper]   )rI   rY   rZ   Ú	flat_listÚelements_dodÚnrJ   ÚiÚjr\   r9   s              r,   Ú_flat_list_to_DomainMatrixz$RepMatrix._flat_list_to_DomainMatrixÑ   sŠ   € õ #¥4Ñ(Ô(ˆÝ# IÑ.Ô.ð 	-ð 	-‰JˆAˆwØ˜!Š|ˆ|Ý˜a ‘”‘��1Ø%,�˜Q” Ñ"øå•C�˜iÑ(Ô(Ñ)Ô)ˆà×&Ò& t¨T°<ÀÑGÔGˆØˆ
rM   c                 ó"  — t          t          ¦  «        }|                     ¦   «         D ]\  \  }}}|dk    r|||         |<   Œt          t	          t
          |                     ¦   «         ¦  «        ¦  «        }|                      ||||¦  «        }	|	S r_   )r   r`   Úitemsrc   rd   re   Úvaluesr]   )
rI   rY   rZ   Úsmatrg   ri   rj   rJ   r\   r9   s
             r,   Ú_smat_to_DomainMatrixzRepMatrix._smat_to_DomainMatrixß   s…   € õ #¥4Ñ(Ô(ˆØ#Ÿzšz™|œ|ð 	-ð 	-‰O‰FˆQ��GØ˜!Š|ˆ|Ø%,�˜Q” Ñ"øå•C�˜dŸkšk™mœmÑ,Ô,Ñ-Ô-ˆà×&Ò& t¨T°<ÀÑGÔGˆØˆ
rM   c                 óX   — | j                              ¦   «                              ¦   «         S r%   )r#   Úto_sympyÚto_list_flat©r*   s    r,   ÚflatzRepMatrix.flatì   s"   € ØŒy×!Ò!Ñ#Ô#×0Ò0Ñ2Ô2Ð2rM   c                 óX   — | j                              ¦   «                              ¦   «         S r%   )r#   rr   Úto_listrt   s    r,   Ú_eval_tolistzRepMatrix._eval_tolistï   s"   € ØŒy×!Ò!Ñ#Ô#×+Ò+Ñ-Ô-Ð-rM   c                 óX   — | j                              ¦   «                              ¦   «         S r%   )r#   rr   Úto_dokrt   s    r,   Ú_eval_todokzRepMatrix._eval_todokò   s"   € ØŒy×!Ò!Ñ#Ô#×*Ò*Ñ,Ô,Ð,rM   c                 óV   — |                       |                      |||¦  «        ¦  «        S r%   )Ú_fromreprp   )rI   rY   rZ   Údoks       r,   Ú_eval_from_dokzRepMatrix._eval_from_dokõ   s&   € à�|Š|˜C×5Ò5°d¸DÀ#ÑFÔFÑGÔGÐGrM   c                 óD   — t          |                      ¦   «         ¦  «        S r%   )ÚlistÚ_eval_iter_valuesrt   s    r,   Ú_eval_valueszRepMatrix._eval_valuesù   s   € Ý�D×*Ò*Ñ,Ô,Ñ-Ô-Ð-rM   c                 ó‚   — | j         }|j        }|                     ¦   «         }|j        st	          |j        |¦  «        }|S r%   )r#   r2   Úiter_valuesÚis_EXRAWrd   rr   )r*   r9   ÚKrn   s       r,   r‚   zRepMatrix._eval_iter_valuesü   s?   € ØŒiˆØŒJˆØ—’Ñ"Ô"ˆØŒzð 	-Ý˜œ VÑ,Ô,ˆFØˆrM   c                 ó„   ‡— | j         }|j        }|j        Š|                     ¦   «         }|j        sˆfd„|D ¦   «         }|S )Nc              3   ó8   •K  — | ]\  }}| ‰|¦  «        fV — Œd S r%   r/   )rR   ri   Úvrr   s      €r,   rT   z-RepMatrix._eval_iter_items.<locals>.<genexpr>
  s4   øè è € Ð8Ð8©$¨!¨Q�a˜˜ !™œÐ%Ð8Ð8Ð8Ð8Ð8Ð8rM   )r#   r2   rr   Ú
iter_itemsr†   )r*   r9   r‡   rm   rr   s       @r,   Ú_eval_iter_itemszRepMatrix._eval_iter_items  sO   ø€ ØŒiˆØŒJˆØ”:ˆØ—’Ñ Ô ˆØŒzð 	9Ø8Ð8Ð8Ð8°%Ð8Ñ8Ô8ˆEØˆrM   c                 óZ   — |                       | j                             ¦   «         ¦  «        S r%   ©r}   r#   r4   rt   s    r,   r4   zRepMatrix.copy  ó    € Ø�}Š}˜TœYŸ^š^Ñ-Ô-Ñ.Ô.Ð.rM   Úreturnc                 ó  — | j         j        }|t          t          fv rt          }nX|t
          k    r>d„ |                      ¦   «         D ¦   «         }t          |¦  «        dk    r|\  }nt          }nt          d¦  «        ‚t          |¦  «        S )Nc                 ó   — h | ]	}|j         ’Œ
S r/   )Úkind)rR   Úes     r,   ú	<setcomp>z!RepMatrix.kind.<locals>.<setcomp>  s   € Ð3Ð3Ð3 �Q”VÐ3Ð3Ð3rM   r   z%Domain should only be ZZ, QQ or EXRAW)r#   r2   r   r   r   r   rn   Úlenr   ÚRuntimeErrorr    )r*   r2   Úelement_kindÚkindss       r,   r“   zRepMatrix.kind  s‚   € à”Ô!ˆà•b�"�XÐÐÝ%ˆLˆLØ•uŠ_ˆ_Ø3Ð3 T§[¢[¡]¤]Ð3Ñ3Ô3ˆEÝ�5‰zŒz˜QŠˆØ!&‘��å,��åÐFÑGÔGÐGÝ˜,Ñ'Ô'Ð'rM   c                 óô   ‡— d}|                       ¦   «         }t          |¦  «        | j        | j        z  k    rt	          j        j        ‰Ž }|p,t          ˆfd„|                     ¦   «         D ¦   «         ¦  «        S )NFc              3   ó,   •K  — | ]} |j         ‰Ž V — Œd S r%   )Úhas)rR   ÚvalueÚpatternss     €r,   rT   z&RepMatrix._eval_has.<locals>.<genexpr>(  s,   øè è € ÐJÐJ°E˜9˜5œ9 hÐ/ÐJÐJÐJÐJÐJÐJrM   )	Útodokr–   rY   rZ   r   ÚZerorœ   Úanyrn   )r*   rž   Úzhasr~   s    `  r,   Ú	_eval_haszRepMatrix._eval_has   so   ø€ ð ˆØ�jŠj‰lŒlˆÝˆs‰8Œ8�t”y ¤Ñ*Ò*Ð*Ý”6”:˜xÐ(ˆDØÐJ•sÐJÐJÐJÐJ¸S¿ZºZ¹\¼\ÐJÑJÔJÑJÔJÐJrM   c                 ó¶   ‡ — t          ˆ fd„t          ‰ j        ¦  «        D ¦   «         ¦  «        sdS t          ‰                      ¦   «         ¦  «        ‰ j        k    S )Nc              3   ó4   •K  — | ]}‰||f         d k    V — ŒdS )r   Nr/   )rR   ri   r*   s     €r,   rT   z.RepMatrix._eval_is_Identity.<locals>.<genexpr>+  s/   øè è € Ð=Ð= q�4˜˜1˜”: ’?Ð=Ð=Ð=Ð=Ð=Ð=rM   F)rX   ÚrangerY   r–   rŸ   rt   s   `r,   Ú_eval_is_IdentityzRepMatrix._eval_is_Identity*  sT   ø€ ÝÐ=Ð=Ð=Ð=­E°$´)Ñ,<Ô,<Ð=Ñ=Ô=Ñ=Ô=ð 	Ø�5Ý�4—:’:‘<”<Ñ Ô  D¤IÒ-Ð-rM   c                 ó†   — | | j         z
                       |¦  «        }t          |                     ¦   «         ¦  «        dk    S r_   )ÚTÚ	applyfuncr–   rn   )r*   ÚsimpfuncÚdiffs      r,   Ú_eval_is_symmetriczRepMatrix._eval_is_symmetric/  s6   € Ø�t”v‘×(Ò(¨Ñ2Ô2ˆÝ�4—;’;‘=”=Ñ!Ô! QÒ&Ð&rM   c                 óZ   — |                       | j                             ¦   «         ¦  «        S )aB  Returns the transposed SparseMatrix of this SparseMatrix.

        Examples
        ========

        >>> from sympy import SparseMatrix
        >>> a = SparseMatrix(((1, 2), (3, 4)))
        >>> a
        Matrix([
        [1, 2],
        [3, 4]])
        >>> a.T
        Matrix([
        [1, 3],
        [2, 4]])
        )r}   r#   Ú	transposert   s    r,   Ú_eval_transposezRepMatrix._eval_transpose3  s$   € ð" �}Š}˜TœY×0Ò0Ñ2Ô2Ñ3Ô3Ð3rM   c                 óf   — |                       | j                             |j        ¦  «        ¦  «        S r%   )r}   r#   Úvstackr)   s     r,   Ú_eval_col_joinzRepMatrix._eval_col_joinF  ó&   € Ø�}Š}˜TœY×-Ò-¨e¬jÑ9Ô9Ñ:Ô:Ð:rM   c                 óf   — |                       | j                             |j        ¦  «        ¦  «        S r%   )r}   r#   Úhstackr)   s     r,   Ú_eval_row_joinzRepMatrix._eval_row_joinI  r´   rM   c                 ó^   — |                       | j                             ||¦  «        ¦  «        S r%   )r}   r#   Úextract)r*   ÚrowsListÚcolsLists      r,   Ú_eval_extractzRepMatrix._eval_extractL  s&   € Ø�}Š}˜TœY×.Ò.¨x¸ÑBÔBÑCÔCÐCrM   c                 ó"   — t          | |¦  «        S r%   )Ú_getitem_RepMatrix)r*   Úkeys     r,   Ú__getitem__zRepMatrix.__getitem__O  s   € Ý! $¨Ñ,Ô,Ð,rM   c                 ód   — t          j        ||ft          ¦  «        }|                      |¦  «        S r%   )r   Úzerosr   r}   ©rI   rY   rZ   r9   s       r,   Ú_eval_zeroszRepMatrix._eval_zerosR  s*   € åÔ  $¨ ­rÑ2Ô2ˆØ�|Š|˜CÑ Ô Ð rM   c                 ód   — t          j        ||ft          ¦  «        }|                      |¦  «        S r%   )r   Úeyer   r}   rÃ   s       r,   Ú	_eval_eyezRepMatrix._eval_eyeW  s*   € åÔ  d˜|­RÑ0Ô0ˆØ�|Š|˜CÑ Ô Ð rM   c                 ób   — t          | |¦  «                             | j        |j        z   ¦  «        S r%   ©r   r}   r#   r)   s     r,   Ú	_eval_addzRepMatrix._eval_add\  ó)   € Ý�t˜UÑ#Ô#×,Ò,¨T¬Y¸¼Ñ-CÑDÔDÐDrM   c                 ób   — t          | |¦  «                             | j        |j        z  ¦  «        S r%   rÉ   r)   s     r,   Ú_eval_matrix_mulzRepMatrix._eval_matrix_mul_  rË   rM   c                 ó¶   — | j                              |j         ¦  «        \  }}|                     |¦  «        }t          | |¦  «                             |¦  «        S r%   )r#   ÚunifyÚmul_elementwiser   r}   )r*   r+   ÚselfrepÚotherrepÚnewreps        r,   Ú_eval_matrix_mul_elementwisez&RepMatrix._eval_matrix_mul_elementwiseb  sM   € Ø œIŸOšO¨E¬JÑ7Ô7Ñˆ�Ø×(Ò(¨Ñ2Ô2ˆÝ�t˜UÑ#Ô#×,Ò,¨VÑ4Ô4Ð4rM   c                 óŽ   — |                       | j        |¦  «        \  }}|                      |                     |¦  «        ¦  «        S r%   )rL   r#   r}   Ú	scalarmul©r*   r+   r9   s      r,   Ú_eval_scalar_mulzRepMatrix._eval_scalar_mulg  s;   € Ø×.Ò.¨t¬y¸%Ñ@Ô@‰
ˆˆUØ�}Š}˜SŸ]š]¨5Ñ1Ô1Ñ2Ô2Ð2rM   c                 óŽ   — |                       | j        |¦  «        \  }}|                      |                     |¦  «        ¦  «        S r%   )rL   r#   r}   Ú
rscalarmulr×   s      r,   Ú_eval_scalar_rmulzRepMatrix._eval_scalar_rmulk  s;   € Ø×.Ò.¨t¬y¸%Ñ@Ô@‰
ˆˆUØ�}Š}˜SŸ^š^¨EÑ2Ô2Ñ3Ô3Ð3rM   c                 óf   — |                       | j                             t          ¦  «        ¦  «        S r%   )r}   r#   rª   Úabsrt   s    r,   Ú	_eval_AbszRepMatrix._eval_Abso  s$   € Ø�}Š}˜TœY×0Ò0µÑ5Ô5Ñ6Ô6Ð6rM   c                 ó¸   — | j         }|j        }|t          t          fv r|                      ¦   «         S |                      |                     d„ ¦  «        ¦  «        S )Nc                 ó*   — |                       ¦   «         S r%   )Ú	conjugate)r”   s    r,   ú<lambda>z+RepMatrix._eval_conjugate.<locals>.<lambda>x  s   € ¸¿º¹¼€ rM   )r#   r2   r   r   r4   r}   rª   )r*   r9   r2   s      r,   Ú_eval_conjugatezRepMatrix._eval_conjugater  sO   € ØŒiˆØ”ˆØ•b�"�XÐÐØ—9’9‘;”;Ðà—=’= §¢Ð/FÐ/FÑ!GÔ!GÑHÔHÐHrM   Fc                 ó  — | j         t          |dd¦  «        k    rdS d}t          | j        ¦  «        D ]Q}t          | j        ¦  «        D ]:}| ||f                              |||f         |¦  «        }|du r  dS |dur|du r|}Œ;ŒR|S )a1  Applies ``equals`` to corresponding elements of the matrices,
        trying to prove that the elements are equivalent, returning True
        if they are, False if any pair is not, and None (or the first
        failing expression if failing_expression is True) if it cannot
        be decided if the expressions are equivalent or not. This is, in
        general, an expensive operation.

        Examples
        ========

        >>> from sympy import Matrix
        >>> from sympy.abc import x
        >>> A = Matrix([x*(x - 1), 0])
        >>> B = Matrix([x**2 - x, 0])
        >>> A == B
        False
        >>> A.simplify() == B.simplify()
        True
        >>> A.equals(B)
        True
        >>> A.equals(2)
        False

        See Also
        ========
        sympy.core.expr.Expr.equals
        ÚshapeNFT)rå   Úgetattrr¦   rY   rZ   Úequals)r*   r+   Úfailing_expressionÚrvri   rj   Úanss          r,   rç   zRepMatrix.equalsz  s´   € ð8 Œ:� ¨°Ñ6Ô6Ò6Ð6Ø�5àˆÝ�t”yÑ!Ô!ð 	ð 	ˆAÝ˜4œ9Ñ%Ô%ð ð �Ø˜1˜a˜4”j×'Ò'¨¨a°¨d¬Ð5GÑHÔH�Ø˜%�<�<Ø ˜5˜5˜5Ø �_�_¨¨t¨¨Ø�Bøðð ˆ	rM   c                 óP  — | j         st          ¦   «         ‚	 t          |¦  «        }n# t          $ r t	          d¦  «        ‚w xY wt          |d¬¦  «        }	 |                      |¦  «        }n# t          $ r t          d¦  «        ‚w xY w|j        r>	 | 	                    ¦   «         }nn# t          $ r}d|› d�}t          |¦  «        |‚d}~ww xY w|                     ¦   «         \  }}	 d|z  }	n## t          $ r d|› d�}t          |¦  «        ‚w xY w||	z  }|                     ¦   «         S )	aZ  
        Returns the inverse of the integer matrix ``M`` modulo ``m``.

        Examples
        ========

        >>> from sympy import Matrix
        >>> A = Matrix(2, 2, [1, 2, 3, 4])
        >>> A.inv_mod(5)
        Matrix([
        [3, 1],
        [4, 2]])
        >>> A.inv_mod(3)
        Matrix([
        [1, 1],
        [0, 1]])

        z%inv_mod: modulus m must be an integerF)Ú	symmetricz(inv_mod: matrix entries must be integerszMatrix is not invertible (mod ú)Nr   )Ú	is_squarer   r   Ú
ValueErrorr0   r   r<   r   Úis_FieldÚinvr   r   Úadj_detr   Ú	to_Matrix)
ÚMÚmr‡   ÚdMÚdMiÚexcÚmsgÚdMadjÚdetÚdetinvs
             r,   Úinv_modzRepMatrix.inv_mod£  sˆ  € ð( Œ{ð 	)Ý&Ñ(Ô(Ð(ð	EÝ�q‘	”	ˆAˆAøÝð 	Eð 	Eð 	EÝÐCÑDÔDÐDð	Eøøøõ ˆq˜EÐ"Ñ"Ô"ˆð	IØ—’˜‘”ˆBˆBøÝð 	Ið 	Ið 	IÝÐGÑHÔHÐHð	Iøøøð Œ:ð 	!ð=Ø—f’f‘h”h��øÝ-ð =ð =ð =Ø;°qÐ;Ð;Ð;�Ý.¨sÑ3Ô3¸Ð<øøøøð=øøøð Ÿš™œ‰JˆE�3ð4Ø˜S™��øÝ ð 4ð 4ð 4Ø;°qÐ;Ð;Ð;�Ý.¨sÑ3Ô3Ð3ð4øøøð ˜&‘.ˆCà�}Š}‰ŒÐs9   —' §AÁA, Á,BÂB& Â&
CÂ0CÃCÃ&C, Ã, Dç      è?c                 óØ   — t          j        t          |¦  «        ¦  «        }| j                             t
          ¦  «        }|                     |¬¦  «        }|                      |¦  «        S )u0  LLL-reduced basis for the rowspace of a matrix of integers.

        Performs the Lenstraâ€“Lenstraâ€“LovÃ¡sz (LLL) basis reduction algorithm.

        The implementation is provided by :class:`~DomainMatrix`. See
        :meth:`~DomainMatrix.lll` for more details.

        Examples
        ========

        >>> from sympy import Matrix
        >>> M = Matrix([[1, 0, 0, 0, -20160],
        ...             [0, 1, 0, 0, 33768],
        ...             [0, 0, 1, 0, 39578],
        ...             [0, 0, 0, 1, 47757]])
        >>> M.lll()
        Matrix([
        [ 10, -3,  -2,  8,  -4],
        [  3, -9,   8,  1, -11],
        [ -3, 13,  -9, -3,  -9],
        [-12, -7, -11,  9,  -1]])

        See Also
        ========

        lll_transform
        sympy.polys.matrices.domainmatrix.DomainMatrix.lll
        ©Údelta)r   rH   r   r#   r1   r   Úlllr}   )r*   r  rö   Úbasiss       r,   r  zRepMatrix.lll×  sS   € õ: ”�h u™oœoÑ.Ô.ˆØŒY×!Ò!¥"Ñ%Ô%ˆØ—’˜U�Ñ#Ô#ˆØ�}Š}˜UÑ#Ô#Ð#rM   c                 ó  — t          j        t          |¦  «        ¦  «        }| j                             t
          ¦  «        }|                     |¬¦  «        \  }}|                      |¦  «        }|                      |¦  «        }||fS )u\  LLL-reduced basis and transformation matrix.

        Performs the Lenstraâ€“Lenstraâ€“LovÃ¡sz (LLL) basis reduction algorithm.

        The implementation is provided by :class:`~DomainMatrix`. See
        :meth:`~DomainMatrix.lll_transform` for more details.

        Examples
        ========

        >>> from sympy import Matrix
        >>> M = Matrix([[1, 0, 0, 0, -20160],
        ...             [0, 1, 0, 0, 33768],
        ...             [0, 0, 1, 0, 39578],
        ...             [0, 0, 0, 1, 47757]])
        >>> B, T = M.lll_transform()
        >>> B
        Matrix([
        [ 10, -3,  -2,  8,  -4],
        [  3, -9,   8,  1, -11],
        [ -3, 13,  -9, -3,  -9],
        [-12, -7, -11,  9,  -1]])
        >>> T
        Matrix([
        [ 10, -3,  -2,  8],
        [  3, -9,   8,  1],
        [ -3, 13,  -9, -3],
        [-12, -7, -11,  9]])

        The transformation matrix maps the original basis to the LLL-reduced
        basis:

        >>> T * M == B
        True

        See Also
        ========

        lll
        sympy.polys.matrices.domainmatrix.DomainMatrix.lll_transform
        r   )r   rH   r   r#   r1   r   Úlll_transformr}   )r*   r  rö   r  Ú	transformÚBr©   s          r,   r  zRepMatrix.lll_transformù  su   € õT ”�h u™oœoÑ.Ô.ˆØŒY×!Ò!¥"Ñ%Ô%ˆØ×+Ò+°%Ð+Ñ8Ô8ÑˆˆyØ�MŠM˜%Ñ Ô ˆØ�MŠM˜)Ñ$Ô$ˆØ�!ˆtˆrM   r%   )F)rþ   )-Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__annotations__r-   r<   ÚclassmethodrL   r]   rk   rp   ru   rx   r{   r   rƒ   r‚   rŒ   r4   Úpropertyr    r“   r£   r§   r­   r°   r³   r·   r¼   rÀ   rÄ   rÇ   rÊ   rÍ   rÔ   rØ   rÛ   rÞ   rã   rç   rý   r  r  r/   rM   r,   r"   r"      så  € € € € € € ðð ð6 ÐÐÑð
.ð 
.ð 
.ðMð Mð Mð Mð^ ð$ð $ñ „[ð$ðL ðð ñ „[ðð2 ðð ñ „[ðð ð
ð 
ñ „[ð
ð3ð 3ð 3ð.ð .ð .ð-ð -ð -ð ðHð Hñ „[ðHð.ð .ð .ðð ð ðð ð ð/ð /ð /ð ð(�jð (ð (ð (ñ „Xð(ðKð Kð Kð.ð .ð .ð
'ð 'ð 'ð4ð 4ð 4ð&;ð ;ð ;ð;ð ;ð ;ðDð Dð Dð-ð -ð -ð ð!ð !ñ „[ð!ð ð!ð !ñ „[ð!ðEð Eð EðEð Eð Eð5ð 5ð 5ð
3ð 3ð 3ð4ð 4ð 4ð7ð 7ð 7ðIð Ið Ið'ð 'ð 'ð 'ðR2ð 2ð 2ðh $ð  $ð  $ð  $ðD/ð /ð /ð /ð /ð /rM   r"   c                   ó¾   ‡ — e Zd ZdZdZd„ Zeddœd„¦   «         Zeˆ fd„¦   «         Zd„ Z	d	„ Z
d
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zˆ xZS )ÚMutableRepMatrixzCMutable matrix based on DomainMatrix as the internal representationFc                 ó   —  | j         |i |¤ŽS r%   )Ú_new)rI   Úargsr8   s      r,   Ú__new__zMutableRepMatrix.__new__6  s   € ØˆsŒx˜Ð( Ð(Ð(Ð(rM   T©r4   c                óô   — |du r)t          |¦  «        dk    rt          d¦  «        ‚|\  }}}n  | j        |i |¤Ž\  }}}t          |¦  «        }|                      |||¦  «        }|                      |¦  «        S )NFé   zA'copy=False' requires a matrix be initialized as rows,cols,[list])r–   r0   Ú_handle_creation_inputsr�   rk   r}   )rI   r4   r  r8   rY   rZ   rf   r9   s           r,   r  zMutableRepMatrix._new9  s‹   € à�5ˆ=ˆ=õ �4‰yŒy˜AŠ~ˆ~ÝÐ cÑdÔdÐdØ$(Ñ!ˆD�$˜	˜	à$? CÔ$?ÀÐ$PÈÐ$PÐ$PÑ!ˆD�$˜	Ý˜Y™œˆIà×,Ò,¨T°4¸ÑCÔCˆà�|Š|˜CÑ Ô Ð rM   c                 ó€   •— t          ¦   «                              | ¦  «        }|j        \  |_        |_        ||_        |S r%   )Úsuperr  rå   rY   rZ   r#   )rI   r9   ÚobjÚ	__class__s      €r,   r}   zMutableRepMatrix._fromrepI  s4   ø€ å‰gŒg�oŠo˜cÑ"Ô"ˆØ œYÑˆŒ�#”(ØˆŒØˆ
rM   c                 óZ   — |                       | j                             ¦   «         ¦  «        S r%   rŽ   rt   s    r,   r4   zMutableRepMatrix.copyP  r�   rM   c                 ó*   — |                       ¦   «         S r%   r  rt   s    r,   Ú
as_mutablezMutableRepMatrix.as_mutableS  s   € Ø�yŠy‰{Œ{ÐrM   c                 óÎ   — |                       ||¦  «        }|�L|\  }}}|                      | j        |¦  «        \  | _        }| j        j                             |||¦  «         dS dS )a@  

        Examples
        ========

        >>> from sympy import Matrix, I, zeros, ones
        >>> m = Matrix(((1, 2+I), (3, 4)))
        >>> m
        Matrix([
        [1, 2 + I],
        [3,     4]])
        >>> m[1, 0] = 9
        >>> m
        Matrix([
        [1, 2 + I],
        [9,     4]])
        >>> m[1, 0] = [[0, 1]]

        To replace row r you assign to position r*m where m
        is the number of columns:

        >>> M = zeros(4)
        >>> m = M.cols
        >>> M[3*m] = ones(1, m)*2; M
        Matrix([
        [0, 0, 0, 0],
        [0, 0, 0, 0],
        [0, 0, 0, 0],
        [2, 2, 2, 2]])

        And to replace column c you can assign to position c:

        >>> M[2] = ones(m, 1)*4; M
        Matrix([
        [0, 0, 4, 0],
        [0, 0, 4, 0],
        [0, 0, 4, 0],
        [2, 2, 4, 2]])
        N)Ú_setitemrL   r#   r9   Úsetitem)r*   r¿   r�   ré   ri   rj   s         r,   Ú__setitem__zMutableRepMatrix.__setitem__V  so   € ðP �]Š]˜3 Ñ&Ô&ˆØˆ>Ø‰KˆAˆq�%Ø#×8Ò8¸¼ÀEÑJÔJÑˆDŒI�uØŒIŒM×!Ò! ! Q¨Ñ.Ô.Ð.Ð.Ð.ð ˆ>rM   c                 ó¤   — t          j        | j        d d …d |…f         | j        d d …|dz   d …f         ¦  «        | _        | xj        dz  c_        d S ©Nr   )r   r¶   r#   rZ   )r*   Úcols     r,   Ú_eval_col_delzMutableRepMatrix._eval_col_del„  sS   € Ý Ô'¨¬	°!°!°!°D°S°D°&Ô(9¸4¼9ÀQÀQÀQÀsÈ1ÁuÀvÀvÀXÔ;NÑOÔOˆŒ	Øˆ	Œ	�Q‰ˆ	Œ	ˆ	ˆ	rM   c                 ó¤   — t          j        | j        d |…d d …f         | j        |dz   d …d d …f         ¦  «        | _        | xj        dz  c_        d S r%  )r   r²   r#   rY   )r*   Úrows     r,   Ú_eval_row_delzMutableRepMatrix._eval_row_delˆ  sS   € Ý Ô'¨¬	°$°3°$°q°q°q°&Ô(9¸4¼9ÀSÈÁUÀVÀVÈQÈQÈQÀYÔ;OÑPÔPˆŒ	Øˆ	Œ	�Q‰ˆ	Œ	ˆ	ˆ	rM   c                 óŠ   — |                       |¦  «        }|                      | d d …d |…f         || d d …|d …f         ¦  «        S r%   )r  r¶   )r*   r&  r+   s      r,   Ú_eval_col_insertz!MutableRepMatrix._eval_col_insertŒ  sI   € Ø—	’	˜%Ñ Ô ˆØ�{Š{˜4    $ 3 $ œ<¨°°Q°Q°Q°s°t°t°V´Ñ=Ô=Ð=rM   c                 óŠ   — |                       |¦  «        }|                      | d |…d d …f         || |d …d d …f         ¦  «        S r%   )r  r²   )r*   r)  r+   s      r,   Ú_eval_row_insertz!MutableRepMatrix._eval_row_insert�  sI   € Ø—	’	˜%Ñ Ô ˆØ�{Š{˜4    Q Q Q œ<¨°°S°T°T¸!¸!¸!°V´Ñ=Ô=Ð=rM   c                 óf   — t          | j        ¦  «        D ]} || ||f         |¦  «        | ||f<   ŒdS )aŽ  In-place operation on col j using two-arg functor whose args are
        interpreted as (self[i, j], i).

        Examples
        ========

        >>> from sympy import eye
        >>> M = eye(3)
        >>> M.col_op(1, lambda v, i: v + 2*M[i, 0]); M
        Matrix([
        [1, 2, 0],
        [0, 1, 0],
        [0, 0, 1]])

        See Also
        ========
        col
        row_op
        N©r¦   rY   )r*   rj   Úfri   s       r,   Úcol_opzMutableRepMatrix.col_op”  sJ   € õ( �t”yÑ!Ô!ð 	*ð 	*ˆAØ˜˜4  1 œ: qÑ)Ô)ˆD��A�‰JˆJð	*ð 	*rM   c                 ót   — t          d| j        ¦  «        D ]!}| ||f         | ||f         c| ||f<   | ||f<   Œ"dS )a‹  Swap the two given columns of the matrix in-place.

        Examples
        ========

        >>> from sympy import Matrix
        >>> M = Matrix([[1, 0], [1, 0]])
        >>> M
        Matrix([
        [1, 0],
        [1, 0]])
        >>> M.col_swap(0, 1)
        >>> M
        Matrix([
        [0, 1],
        [0, 1]])

        See Also
        ========

        col
        row_swap
        r   Nr0  ©r*   ri   rj   Úks       r,   Úcol_swapzMutableRepMatrix.col_swap«  óW   € õ0 �q˜$œ)Ñ$Ô$ð 	<ð 	<ˆAØ%)¨!¨Q¨$¤Z°°a¸°d´Ð"ˆD��A�‰J˜˜Q ˜T™
˜
ð	<ð 	<rM   c                 óf   — t          | j        ¦  «        D ]} || ||f         |¦  «        | ||f<   ŒdS )aª  In-place operation on row ``i`` using two-arg functor whose args are
        interpreted as ``(self[i, j], j)``.

        Examples
        ========

        >>> from sympy import eye
        >>> M = eye(3)
        >>> M.row_op(1, lambda v, j: v + 2*M[0, j]); M
        Matrix([
        [1, 0, 0],
        [2, 1, 0],
        [0, 0, 1]])

        See Also
        ========
        row
        zip_row_op
        col_op

        N©r¦   rZ   )r*   ri   r1  rj   s       r,   Úrow_opzMutableRepMatrix.row_opÆ  sJ   € õ, �t”yÑ!Ô!ð 	*ð 	*ˆAØ˜˜4  1 œ: qÑ)Ô)ˆD��A�‰JˆJð	*ð 	*rM   c                 óX   — t          | j        ¦  «        D ]}| ||fxx         |z  cc<   ŒdS )a  Multiply the given row by the given factor in-place.

        Examples
        ========

        >>> from sympy import eye
        >>> M = eye(3)
        >>> M.row_mult(1,7); M
        Matrix([
        [1, 0, 0],
        [0, 7, 0],
        [0, 0, 1]])

        Nr9  )r*   ri   Úfactorrj   s       r,   Úrow_multzMutableRepMatrix.row_multà  sC   € õ �t”yÑ!Ô!ð 	 ð 	 ˆAØ��1�ˆIˆIŒI˜ÑˆIˆI‰IˆIð	 ð 	 rM   c                 ón   — t          | j        ¦  «        D ]}| ||fxx         || ||f         z  z  cc<   Œ dS )a  Add k times row s (source) to row t (target) in place.

        Examples
        ========

        >>> from sympy import eye
        >>> M = eye(3)
        >>> M.row_add(0, 2,3); M
        Matrix([
        [1, 0, 0],
        [0, 1, 0],
        [3, 0, 1]])
        Nr9  )r*   ÚsÚtr5  rj   s        r,   Úrow_addzMutableRepMatrix.row_addò  sO   € õ �t”yÑ!Ô!ð 	%ð 	%ˆAØ��1�ˆIˆIŒI˜˜4  ! œ9™Ñ$ˆIˆI‰IˆIð	%ð 	%rM   c                 ót   — t          d| j        ¦  «        D ]!}| ||f         | ||f         c| ||f<   | ||f<   Œ"dS )aˆ  Swap the two given rows of the matrix in-place.

        Examples
        ========

        >>> from sympy import Matrix
        >>> M = Matrix([[0, 1], [1, 0]])
        >>> M
        Matrix([
        [0, 1],
        [1, 0]])
        >>> M.row_swap(0, 1)
        >>> M
        Matrix([
        [1, 0],
        [0, 1]])

        See Also
        ========

        row
        col_swap
        r   Nr9  r4  s       r,   Úrow_swapzMutableRepMatrix.row_swap  r7  rM   c                 óv   — t          | j        ¦  «        D ]#} || ||f         | ||f         ¦  «        | ||f<   Œ$dS )a°  In-place operation on row ``i`` using two-arg functor whose args are
        interpreted as ``(self[i, j], self[k, j])``.

        Examples
        ========

        >>> from sympy import eye
        >>> M = eye(3)
        >>> M.zip_row_op(1, 0, lambda v, u: v + 2*u); M
        Matrix([
        [1, 0, 0],
        [2, 1, 0],
        [0, 0, 1]])

        See Also
        ========
        row
        row_op
        col_op

        Nr9  )r*   ri   r5  r1  rj   s        r,   Ú
zip_row_opzMutableRepMatrix.zip_row_op  sR   € õ, �t”yÑ!Ô!ð 	3ð 	3ˆAØ˜˜4  1 œ: t¨A¨q¨D¤zÑ2Ô2ˆD��A�‰JˆJð	3ð 	3rM   c                 ó¶   — t          |¦  «        st          dt          |¦  «        z  ¦  «        ‚|                      | t          | ¦  «        |¦  «        ¦  «        S )ai  Copy in elements from a list.

        Parameters
        ==========

        key : slice
            The section of this matrix to replace.
        value : iterable
            The iterable to copy values from.

        Examples
        ========

        >>> from sympy import eye
        >>> I = eye(3)
        >>> I[:2, 0] = [1, 2] # col
        >>> I
        Matrix([
        [1, 0, 0],
        [2, 1, 0],
        [0, 0, 1]])
        >>> I[1, :2] = [[3, 4]]
        >>> I
        Matrix([
        [1, 0, 0],
        [3, 4, 0],
        [0, 0, 1]])

        See Also
        ========

        copyin_matrix
        z,`value` must be an ordered iterable, not %s.)r   r0   re   Úcopyin_matrix)r*   r¿   r�   s      r,   Úcopyin_listzMutableRepMatrix.copyin_list8  sW   € õD ˜5Ñ!Ô!ð 	ZÝÐJÍTÐRWÉ[Ì[ÑXÑYÔYÐYØ×!Ò! # z¥t¨D¡z¤z°%Ñ'8Ô'8Ñ9Ô9Ð9rM   c                 ó*  — |                       |¦  «        \  }}}}|j        }||z
  ||z
  }	}|||	fk    rt          t          d¦  «        ¦  «        ‚t	          |j        ¦  «        D ].}
t	          |j        ¦  «        D ]}||
|f         | |
|z   ||z   f<   ŒŒ/dS )a   Copy in values from a matrix into the given bounds.

        Parameters
        ==========

        key : slice
            The section of this matrix to replace.
        value : Matrix
            The matrix to copy values from.

        Examples
        ========

        >>> from sympy import Matrix, eye
        >>> M = Matrix([[0, 1], [2, 3], [4, 5]])
        >>> I = eye(3)
        >>> I[:3, :2] = M
        >>> I
        Matrix([
        [0, 1, 0],
        [2, 3, 0],
        [4, 5, 1]])
        >>> I[0, 1] = M
        >>> I
        Matrix([
        [0, 0, 1],
        [2, 2, 3],
        [4, 4, 5]])

        See Also
        ========

        copyin_list
        zXThe Matrix `value` doesn't have the same dimensions as the in sub-Matrix given by `key`.N)Ú
key2boundsrå   r   r   r¦   rY   rZ   )r*   r¿   r�   ÚrloÚrhiÚcloÚchirå   ÚdrÚdcri   rj   s               r,   rG  zMutableRepMatrix.copyin_matrix^  sÔ   € ðF "Ÿ_š_¨SÑ1Ô1ÑˆˆS�#�sØ”ˆØ�s‘˜C #™IˆBˆØ�R˜�HÒÐÝ�Zð )Oñ Pô Pñ Qô Qð Qõ �u”zÑ"Ô"ð 	5ð 	5ˆAÝ˜5œ:Ñ&Ô&ð 5ð 5�Ø).¨q°!¨t¬��Q˜‘W˜a #™gÐ%Ñ&Ð&ð5ð	5ð 	5rM   c                 óú   ‡ ‡— t          ‰¦  «        Š‰s&t          j        ‰ j        t          ¦  «        ‰ _        dS ˆ ˆfd„t          ‰ j        ¦  «        D ¦   «         }t          |‰ j        t          ¦  «        ‰ _        dS )aN  Fill self with the given value.

        Notes
        =====

        Unless many values are going to be deleted (i.e. set to zero)
        this will create a matrix that is slower than a dense matrix in
        operations.

        Examples
        ========

        >>> from sympy import SparseMatrix
        >>> M = SparseMatrix.zeros(3); M
        Matrix([
        [0, 0, 0],
        [0, 0, 0],
        [0, 0, 0]])
        >>> M.fill(1); M
        Matrix([
        [1, 1, 1],
        [1, 1, 1],
        [1, 1, 1]])

        See Also
        ========

        zeros
        ones
        c                 ól   •— i | ]0}|t                                t          ‰j        ¦  «        ‰¦  «        “Œ1S r/   )r`   Úfromkeysr¦   rZ   )rR   ri   r*   r�   s     €€r,   ú
<dictcomp>z)MutableRepMatrix.fill.<locals>.<dictcomp>°  s3   ø€ Ð`Ð`Ð`È!˜A�tŸ}š}­U°4´9Ñ-=Ô-=¸uÑEÔEÐ`Ð`Ð`rM   N)r   r   rÂ   rå   r   r#   r¦   rY   )r*   r�   rg   s   `` r,   ÚfillzMutableRepMatrix.fill�  su   øø€ õ> ˜‘”ˆØð 	FÝ$Ô*¨4¬:µuÑ=Ô=ˆDŒIˆIˆIà`Ð`Ð`Ð`Ð`ÍuÐUYÔU^ÑO_ÔO_Ð`Ñ`Ô`ˆLÝ$ \°4´:½uÑEÔEˆDŒIˆIˆIrM   )r  r	  r
  r  Úis_zeror  r  r  r}   r4   r  r#  r'  r*  r,  r.  r2  r6  r:  r=  rA  rC  rE  rH  rG  rU  Ú__classcell__)r  s   @r,   r  r  +  s‘  ø€ € € € € ØMÐMð €Gð)ð )ð )ð Ø"ð !ð !ð !ð !ñ „[ð!ð ðð ð ð ñ „[ðð/ð /ð /ðð ð ð,/ð ,/ð ,/ð\ð ð ðð ð ð>ð >ð >ð>ð >ð >ð*ð *ð *ð.<ð <ð <ð6*ð *ð *ð4 ð  ð  ð$%ð %ð %ð$<ð <ð <ð63ð 3ð 3ð2$:ð $:ð $:ðL-5ð -5ð -5ð^$Fð $Fð $Fð $Fð $Fð $Fð $FrM   r  c                 ó¨  ‡	‡
‡— t          |t          ¦  «        �r�|\  }}	 | j                             t	          |¦  «        t	          |¦  «        ¦  «        S # t
          t          f$ �r1 t          |t          ¦  «        r|j        rt          |t          ¦  «        ra|j        sZ|dk     du s.|| j	        d         k    du s|dk     du s|| j	        d         k    du rt          d¦  «        ‚ddlm}  || ||¦  «        cY S t          |t          ¦  «        rt          | j        ¦  «        |         }nt!          |¦  «        rn|g}t          |t          ¦  «        rt          | j        ¦  «        |         }nt!          |¦  «        rn|g}|                      ||¦  «        cY S w xY w| j	        \  }Š	|‰	z  sg |         S | j        j        Š
‰
j        }t          |t          ¦  «        }|r&ˆ	ˆ
fd„t          |‰	z  ¦  «        |         D ¦   «         }n& ‰
j        t-          t	          |¦  «        ‰	¦  «        Ž g}|t.          k    r|j        Šˆfd„|D ¦   «         }|r|S |d         S )a2  Return portion of self defined by key. If the key involves a slice
    then a list will be returned (if key is a single slice) or a matrix
    (if key was a tuple involving a slice).

    Examples
    ========

    >>> from sympy import Matrix, I
    >>> m = Matrix([
    ... [1, 2 + I],
    ... [3, 4    ]])

    If the key is a tuple that does not involve a slice then that element
    is returned:

    >>> m[1, 0]
    3

    When a tuple key involves a slice, a matrix is returned. Here, the
    first column is selected (all rows, column 0):

    >>> m[:, 0]
    Matrix([
    [1],
    [3]])

    If the slice is not a tuple then it selects from the underlying
    list of elements that are arranged in row order and a list is
    returned if a slice is involved:

    >>> m[0]
    1
    >>> m[::2]
    [1, 3]
    r   Tr   zindex out of boundary)ÚMatrixElementc                 ó@   •— g | ]} ‰j         t          |‰¦  «        Ž ‘ŒS r/   )Úgetitemrb   )rR   rh   rZ   r9   s     €€r,   ú
<listcomp>z&_getitem_RepMatrix.<locals>.<listcomp>ÿ  s*   ø€ ÐUÐUÐU¸�k�c”k¥6¨!¨T¡?¤?Ð3ÐUÐUÐUrM   c                 ó&   •— g | ]} ‰|¦  «        ‘ŒS r/   r/   )rR   Úvalrr   s     €r,   r\  z&_getitem_RepMatrix.<locals>.<listcomp>  s!   ø€ Ð6Ð6Ð6¨�h�h˜s‘m”mÐ6Ð6Ð6rM   )r&   Útupler#   Úgetitem_sympyÚindex_r0   Ú
IndexErrorr   Ú	is_numberrå   rï   Ú"sympy.matrices.expressions.matexprrY  Úslicer¦   rY   r   rZ   r¹   r9   r2   r[  rb   r   rr   )r*   r¿   ri   rj   rY  rY   r2   Úis_slicern   rZ   r9   rr   s            @@@r,   r¾   r¾   ´  s˜  øøø€ õH �#•uÑÔñ 2Ø‰ˆˆ1ð	&Ø”9×*Ò*­6°!©9¬9µf¸Q±i´iÑ@Ô@Ð@øÝ�:Ð&ð 	&ñ 	&ð 	&Ý˜1�dÑ#Ô#ð 1¨A¬Kð 1½ZÈÍ4Ñ=PÔ=Pð 1ÐYZÔYdð 1Ø˜’U˜t�O�O¨!¨t¬z¸!¬}Ò*<ÀÐ)EÐ)EØ˜’U˜t�O�O¨!¨t¬z¸!¬}Ò*<ÀÐ)EÐ)EÝ$Ð%<Ñ=Ô=Ð=ØLÐLÐLÐLÐLÐLØ$�} T¨1¨aÑ0Ô0Ð0Ð0Ð0å˜!�UÑ#Ô#ð Ý˜$œ)Ñ$Ô$ QÔ'��Ý˜Q‘”ð Øà�C�Ý˜!�UÑ#Ô#ð Ý˜$œ)Ñ$Ô$ QÔ'��Ý˜Q‘”ð Øà�C�Ø—<’<  1Ñ%Ô%Ð%Ð%Ð%ð)	&øøøð0 ”Z‰
ˆˆdð �d‰{ð 	Ø�c”7ˆNàŒiŒmˆØ”ˆÝ˜c¥5Ñ)Ô)ˆàð 	?ØUÐUÐUÐUÐU½UÀ4È$Á;Ñ=OÔ=OÐPSÔ=TÐUÑUÔUˆFˆFà!�c”k¥6­&°©+¬+°tÑ#<Ô#<Ð=Ð>ˆFà•UŠ?ˆ?Ø”ˆHØ6Ð6Ð6Ð6¨vÐ6Ñ6Ô6ˆFàð 	ØˆMà˜!”9Ðs    4A ÁB"FÃ9BFÆFN)2Úcollectionsr   Úoperatorr   ra  Úsympy.core.exprr   Úsympy.core.kindr   r   r   Úsympy.core.numbersr	   r
   Úsympy.core.sympifyr   r   Úsympy.core.singletonr   Úsympy.polys.domainsr   r   r   r   Úsympy.polys.matricesr   Úsympy.polys.matrices.exceptionsr   Úsympy.polys.polyerrorsr   r   Úsympy.utilities.exceptionsr   Úsympy.utilities.iterablesr   Úsympy.utilities.miscr   r   Ú
exceptionsr   r   r   Ú
matrixbaser   r   r“   r    r"   r  r¾   r/   rM   r,   ú<module>rw     s  ðØ #Ð #Ð #Ð #Ð #Ð #à $Ð $Ð $Ð $Ð $Ð $à  Ð  Ð  Ð  Ð  Ð  Ø ;Ð ;Ð ;Ð ;Ð ;Ð ;Ð ;Ð ;Ð ;Ð ;Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ø "Ð "Ð "Ð "Ð "Ð "Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø -Ð -Ð -Ð -Ð -Ð -Ø FÐ FÐ FÐ FÐ FÐ FØ @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ø @Ð @Ð @Ð @Ð @Ð @Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3à RÐ RÐ RÐ RÐ RÐ RÐ RÐ RÐ RÐ RØ +Ð +Ð +Ð +Ð +Ð +Ð +Ð +Ø Ð Ð Ð Ð Ð ðQð Qð Qð Qð Q�
ñ Qô Qð QðhFFð FFð FFð FFð FF�yñ FFô FFð FFðRVð Vð Vð Vð VrM   