+
    ‹°³jÁU  ã                   ó®  € ^ RI Ht ^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RI
Ht ^ RIHtHt ^ RIHtHtHtHtHtHtHtHtHt ^ R	IHtHtHtHtHtHtH t  ^ R
I!H"t"  ! R R]4      t#R t$ ! R R4      t% ! R R4      t& ! R R4      t'R]%R]'R]'R]&/t( ! R R] ]4      t) ! R R])4      t*R t+ ! R R])4      t,R t- ! R  R!])4      t.R" t/ ! R# R$])4      t0R% t1R&# )'é    )Úprod)ÚBasic)Úpi)ÚS)Úexp)Ú
multigamma)ÚsympifyÚ_sympify)	ÚImmutableMatrixÚInverseÚTraceÚDeterminantÚMatrixSymbolÚ
MatrixBaseÚ	TransposeÚ	MatrixSetÚmatrix2numpy)Ú_value_checkÚRandomMatrixSymbolÚNamedArgsMixinÚPSpaceÚ_symbol_converterÚMatrixDomainÚDistribution)Úimport_modulec                   óŽ   a € ] tR t^t o RtR t]! R 4      t]! R 4      t]R 4       t	]R 4       t
]R 4       tR tRR
 ltRtV tR	# )ÚMatrixPSpacez8
Represents probability space for
Matrix Distributions.
c                óÐ   € \        V4      p\        V4      \        V4      rCVP                  '       d   VP                  '       g   \        R 4      h\        P
                  ! WW#V4      # )zDimensions should be integers)r   r
   Ú
is_integerÚ
ValueErrorr   Ú__new__)ÚclsÚsymÚdistributionÚdim_nÚdim_ms   &&&&&Úa/home/luca/screen-checking/.venv/lib/python3.14/site-packages/sympy/stats/matrix_distributions.pyr!   ÚMatrixPSpace.__new__   sQ   € Ü Ó$ˆÜ “¬°«ˆuØ× × Ð  U×%5×%5Ð%5ÜÐ<Ó=Ð=Ü�}Š}˜S |¸EÓBÐBó    c                ó(   € V P                   ^,          # )é   ©Úargs©Úselfs   &r'   Ú<lambda>ÚMatrixPSpace.<lambda>    s   € ¨¯©°1®r)   c                ó(   € V P                   ^ ,          # ©r   r,   r.   s   &r'   r0   r1   !   s   €  4§9¡9¨Q¦<r)   c                óV   € \        V P                  V P                  P                  4      # ©N)r   Úsymbolr$   Úsetr.   s   &r'   ÚdomainÚMatrixPSpace.domain#   s   € ä˜DŸK™K¨×):Ñ):×)>Ñ)>Ó?Ð?r)   c                óv   € \        V P                  V P                  ^,          V P                  ^,          V 4      # )é   )r   r6   r-   r.   s   &r'   ÚvalueÚMatrixPSpace.value'   s'   € ä! $§+¡+¨t¯y©y¸­|¸T¿Y¹YÀq½\È4ÓPÐPr)   c                ó   € V P                   0# r5   )r<   r.   s   &r'   ÚvaluesÚMatrixPSpace.values+   s   € à—
‘
ˆ|Ðr)   c                óÄ   € VP                  \        4      p\        V4      ^8”  g   \        V\        4      '       g   \	        R4      hV P
                  P                  V4      # )r+   ztCurrently, no algorithm has been implemented to handle general expressions containing multiple matrix distributions.)Úatomsr   ÚlenÚ
isinstanceÚNotImplementedErrorr$   Úpdf)r/   Úexprr-   Úrmss   &&* r'   Úcompute_densityÚMatrixPSpace.compute_density/   sT   € Ø�j‰jÔ+Ó,ˆÜˆs‹8�aŒ<¤
¨4Ô1C× DÒ DÜ%ð '5ó 6ð 6ð × Ñ ×$Ñ$ TÓ*Ð*r)   Nc                óT   € V P                   V P                  P                  WVR7      /# )z]
Internal sample method

Returns dictionary mapping RandomMatrixSymbol to realization value.
)ÚlibraryÚseed)r<   r$   Úsample)r/   ÚsizerL   rM   s   &&&&r'   rN   ÚMatrixPSpace.sample7   s*   € ð —
‘
˜D×-Ñ-×4Ñ4°TÐQUÐ4ÓVÐWÐWr)   © ©rQ   ÚscipyN)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r!   Úpropertyr$   r6   r8   r<   r?   rI   rN   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r'   r   r      sw   ø‡ € ñòCñ Ñ5Ó6€LÙÑ/Ó0€Fàñ@ó ð@ð ñQó ðQð ñó ðò+÷Xò Xr)   r   c                 óÆ   € \        \        \        V4      4      pV! V!  pVP                  ! V!   VP                  p\        WV^ ,          V^,          4      pVP                  # r3   )ÚlistÚmapr	   ÚcheckÚ	dimensionr   r<   )r6   r"   r-   ÚdistÚdimÚpspaces   &&&   r'   Úrvrf   @   sQ   € Ü””G˜TÓ"Ó#€DÙ�‰:€DØ‡J‚J�ÒØ
�.‰.€CÜ˜&¨¨A­°°AµÓ7€FØ�<‰<Ðr)   c                   ó>   a € ] tR t^It o RtRR lt]R 4       tRtV t	R# )ÚSampleMatrixScipyz7Returns the sample from scipy of the given distributionNc                ó&   € V P                  WV4      # r5   )Ú_sample_scipy©r"   rc   rO   rM   s   &&&&r'   r!   ÚSampleMatrixScipy.__new__K   ó   € Ø× Ñ  ¨TÓ2Ð2r)   c                óÚ  a
€ ^ RI Ho
 ^ RIpRV
3R lRV
3R l/pRR RR /pVP                  4       pVP                  P
                  V9  d   R# Ve   \        V\        4      '       d   VP                  P                  VR	7      pMTpWQP                  P
                  ,          ! V\        V4      V4      p	V	P                  W&VP                  P
                  ,          ! V4      ,           4      # )
zSample from SciPy.)ÚstatsNÚWishartDistributionc                 ó–   <€ SP                   P                  \        V P                  4      \	        V P
                  \        4      VR 7      # ))ÚdfÚscalerO   )ÚwishartÚrvsÚintÚnr   Úscale_matrixÚfloat©rc   rO   Ú
rand_stateÚscipy_statss   &&&€r'   r0   Ú1SampleMatrixScipy._sample_scipy.<locals>.<lambda>U   s<   ø€ À+×BUÑBU×BYÑBYÜ�t—v‘v“;¤l°4×3DÑ3DÄeÓ&LÐSWð CZô CYr)   ÚMatrixNormalDistributionc                 óÒ   <€ SP                   P                  \        V P                  \        4      \        V P
                  \        4      \        V P                  \        4      WR 7      # ))ÚmeanÚrowcovÚcolcovrO   Úrandom_state)Úmatrix_normalru   r   Úlocation_matrixry   Úscale_matrix_1Úscale_matrix_2rz   s   &&&€r'   r0   r}   W   sQ   ø€ À{×G`ÑG`×GdÑGdÜ! $×"6Ñ"6¼Ó>Ü# D×$7Ñ$7¼Ó?Ü# D×$7Ñ$7¼Ó?Àdð Heô Her)   c                 ó.   € V P                   P                  # r5   ©rx   Úshape©rc   s   &r'   r0   r}   ^   ó   € °×0AÑ0A×0GÒ0Gr)   c                 ó.   € V P                   P                  # r5   ©r…   rŠ   r‹   s   &r'   r0   r}   _   ó   € °d×6JÑ6J×6PÒ6Pr)   ©rM   )rS   ro   ÚnumpyÚkeysÚ	__class__rT   rD   rv   ÚrandomÚdefault_rngr   Úreshape)r"   rc   rO   rM   r‘   Úscipy_rv_mapÚsample_shapeÚ	dist_listr{   Úsampr|   s   &&&&      @r'   rj   ÚSampleMatrixScipy._sample_scipyN   sÐ   ø€ õ 	/Ûà!ô $Yà&ô )eð
ˆð "Ñ#GØ&Ñ)Pð
ˆð
 !×%Ñ%Ó'ˆ	à�>‰>×"Ñ"¨)Ô3ÙàŠ<œ: d¬C×0Ò0ØŸ™×1Ñ1°tÐ1Ó<‰JàˆJØŸN™N×3Ñ3Ö4°T¼4À»:ÀzÓRˆØ�|‰|˜D°·±×0GÑ0GÖ#HÈÓ#NÕNÓOÐOr)   rQ   r5   )
rT   rU   rV   rW   rX   r!   Úclassmethodrj   rZ   r[   r\   s   @r'   rh   rh   I   s#   ø‡ € ÙAô3ð ñPó öPr)   rh   c                   ó>   a € ] tR t^ot o RtRR lt]R 4       tRtV t	R# )ÚSampleMatrixNumpyz7Returns the sample from numpy of the given distributionNc                ó&   € V P                  WV4      # r5   )Ú_sample_numpyrk   s   &&&&r'   r!   ÚSampleMatrixNumpy.__new__s   rm   r)   c                ó¨  € / p/ pVP                  4       pVP                  P                  V9  d   R# ^ RIpVe   \	        V\
        4      '       d   VP                  P                  VR7      pMTpWAP                  P                  ,          ! V\        V4      V4      p	V	P                  W%VP                  P                  ,          ! V4      ,           4      # )zSample from NumPy.Nr�   )
r’   r“   rT   r‘   rD   rv   r”   r•   r   r–   )
r"   rc   rO   rM   Únumpy_rv_mapr˜   r™   r‘   r{   rš   s
   &&&&      r'   r    ÚSampleMatrixNumpy._sample_numpyv   sª   € ð
ˆð
ˆð !×%Ñ%Ó'ˆ	à�>‰>×"Ñ"¨)Ô3ÙãØŠ<œ: d¬C×0Ò0ØŸ™×1Ñ1°tÐ1Ó<‰JàˆJØŸN™N×3Ñ3Ö4°T¼4À»:ÀzÓRˆØ�|‰|˜D°·±×0GÑ0GÖ#HÈÓ#NÕNÓOÐOr)   rQ   r5   )
rT   rU   rV   rW   rX   r!   rœ   r    rZ   r[   r\   s   @r'   rž   rž   o   s#   ø‡ € ÙAô3ð ñPó öPr)   rž   c                   ó>   a € ] tR t^Žt o RtRR lt]R 4       tRtV t	R# )ÚSampleMatrixPymcz6Returns the sample from pymc of the given distributionNc                ó&   € V P                  WV4      # r5   )Ú_sample_pymcrk   s   &&&&r'   r!   ÚSampleMatrixPymc.__new__‘   s   € Ø×Ñ ¨DÓ1Ð1r)   c                ó†  a	€  ^ RI o	RV	3R lRV	3R l/pRR RR /pVP                  4       pVP                  P
                  V9  d   R# ^ RIpVP                  R4      P                  VP                  4       S	P                  4       ;_uu_ 4        WAP                  P
                  ,          ! V4       S	P                  \        V4      ^R	VR	R	R
7      R,          pRRR4       XP                  W%VP                  P
                  ,          ! V4      ,           4      #   \         d	    ^ RIo	 EL%i ; i  + '       g   i     L^; i)zSample from PyMC.Nr~   c           	      óè   <€ SP                  R \        V P                  \        4      \        V P                  \        4      \        V P
                  \        4      V P                  P                  R7      # )ÚX)Úmur�   r‚   rŠ   )ÚMatrixNormalr   r…   ry   r†   r‡   rŠ   ©rc   Úpymcs   &€r'   r0   Ú/SampleMatrixPymc._sample_pymc.<locals>.<lambda>�   sW   ø€ °T×5FÑ5FÀsÜ × 4Ñ 4´eÓ<Ü# D×$7Ñ$7¼Ó?Ü# D×$7Ñ$7¼Ó?Ø×*Ñ*×0Ñ0ð	 6Gô 62r)   rp   c                 ó‚   <€ SP                  R \        V P                  4      \        V P                  \
        4      R7      # )r¬   )Únur   )ÚWishartBartlettrv   rw   r   rx   ry   r¯   s   &€r'   r0   r±   ¢   s3   ø€ °×0DÑ0DÀSÜ�t—v‘v“;¤,¨t×/@Ñ/@Ä%Ó"Hð 1Eô 1Jr)   c                 ó.   € V P                   P                  # r5   r‰   r‹   s   &r'   r0   r±   §   rŒ   r)   c                 ó.   € V P                   P                  # r5   rŽ   r‹   s   &r'   r0   r±   ¨   r�   r)   r°   F)ÚdrawsÚchainsÚprogressbarÚrandom_seedÚreturn_inferencedataÚcompute_convergence_checksr¬   )r°   ÚImportErrorÚpymc3r’   r“   rT   ÚloggingÚ	getLoggerÚsetLevelÚERRORÚModelrN   r   r–   )
r"   rc   rO   rM   Úpymc_rv_mapr˜   r™   r¿   Úsampsr°   s
   &&&&     @r'   r¨   ÚSampleMatrixPymc._sample_pymc”   s  ø€ ð	!Ûð 'ô )2ð
 "ô $Jð
ˆð "Ñ#GØ&Ñ)Pð
ˆð
  ×$Ñ$Ó&ˆ	à�>‰>×"Ñ"¨)Ô3ÙÛØ×Ñ˜&Ó!×*Ñ*¨7¯=©=Ô9Ø�Z‰Z�\�\ØŸ™×/Ñ/Ö0°Ô6Ø—K‘K¤d¨4£j¸ÈÐ[_Ðv{ð  Y^�Kó  _ð  `cõ  dˆE÷ ð �}‰}˜T°·±×1HÑ1HÖ$IÈ$Ó$OÕOÓPÐPøô5 ô 	!Þ ð	!ú÷. �\ús   ƒD ÂA
D0ÄD-Ä,D-Ä0E 	rQ   r5   )
rT   rU   rV   rW   rX   r!   rœ   r¨   rZ   r[   r\   s   @r'   r¦   r¦   Ž   s#   ø‡ € Ù@ô2ð ñQó öQr)   r¦   rS   r¾   r°   r‘   c                   óJ   a € ] tR t^Át o RtR t]R 4       tR tRR lt	Rt
V tR# )	ÚMatrixDistributionz)
Abstract class for Matrix Distribution.
c                ó²   € V Uu. uF/  p\        V\        4      '       d   \        V4      M
\        V4      NK1  	  pp\        P
                  ! V .VO5!  # u upi r5   )rD   r_   r   r
   r   r!   )r"   r-   Úargs   &* r'   r!   ÚMatrixDistribution.__new__Å   sX   € á.2ó4Ù.2 sô )3°3¼×(=Ò(=” Ô$Ü˜c“]ò#Ù.2ð 	ð 4ä�}Š}˜SÐ( 4Ó(Ð(ùò4s   …5Ac                 ó   € R # r5   rQ   r,   s   *r'   ra   ÚMatrixDistribution.checkÊ   s   € ár)   c                óf   € \        V\        4      '       d   \        V4      pV P                  V4      # r5   )rD   r_   r   rF   )r/   rG   s   &&r'   Ú__call__ÚMatrixDistribution.__call__Î   s'   € Ü�dœD×!Ò!Ü" 4Ó(ˆDØ�x‰x˜‹~Ðr)   Nc                ó  € . ROpW$9  d   \        R\        V4      ,          4      h\        V4      '       g   \        RV,          4      h\        V,          ! WV4      pVe   V# \        RV P
                  P                  : RV: 24      h)zW
Internal sample method

Returns dictionary mapping RandomSymbol to realization value.
z&Sampling from %s is not supported yet.zFailed to import %szSampling for z# is not currently implemented from )rS   r‘   r¾   r°   )rE   Ústrr   r    Ú_get_sample_class_matrixrvr“   rT   )r/   rO   rL   rM   Ú	librariesrÅ   s   &&&&  r'   rN   ÚMatrixDistribution.sampleÓ   s„   € ò 8ˆ	ØÔ#Ü%Ð&NÜ*-¨g«,õ'7ó 8ð 8ä˜W×%Ò%ÜÐ2°WÕ<Ó=Ð=ä*¨7Ö3°DÀÓEˆàÒØˆLÝ!à—>‘>×*Ô*ªGð5óð 	r)   rQ   rR   )rT   rU   rV   rW   rX   r!   Ústaticmethodra   rÏ   rN   rZ   r[   r\   s   @r'   rÈ   rÈ   Á   s2   ø‡ € ñò)ð
 ñó ðò÷
ò r)   rÈ   c                   óZ   a € ] tR t^ñt o Rt]R 4       t]R 4       t]R 4       t	R t
RtV tR# )ÚMatrixGammaDistributionc                óâ   € \        V\        4      '       g   \        VP                  R 4       \        VP                  R4       \        V P
                  R4       \        VP
                  R4       R# )ú+The shape matrix must be positive definite.úShould be square matrixú#Shape parameter should be positive.z#Scale parameter should be positive.N©rD   r   r   Úis_positive_definiteÚ	is_squareÚis_positive©ÚalphaÚbetarx   s   &&&r'   ra   ÚMatrixGammaDistribution.checkõ   s[   € ä˜,¬×5Ò5Ü˜×:Ñ:ð =4ô 5ä�\×+Ñ+ð .ô 	ä�U×&Ñ&Ð(MÔNÜ�T×%Ñ%Ð'LÖMr)   c                óp   € V P                   P                  ^ ,          p\        W\        P                  4      # r3   ©rx   rŠ   r   r   ÚReals©r/   Úks   & r'   r7   ÚMatrixGammaDistribution.setÿ   ó)   € à×Ñ×#Ñ# AÕ&ˆÜ˜œqŸw™wÓ'Ð'r)   c                ó.   € V P                   P                  # r5   r‰   r.   s   &r'   rb   Ú!MatrixGammaDistribution.dimension  ó   € à× Ñ ×&Ñ&Ð&r)   c                óf  € V P                   V P                  V P                  rCpVP                  ^ ,          p\	        V\
        4      '       d   \        V4      p\	        V\        \        34      '       g   \        R\        V4      ,          4      h\        V4      ) V,          V,          p\        \        V4      4      W5V,          ,          \        W%4      ,          ,          p\        V4      V) ,          p\        V4      V\!        V^,           4      ^,          ,
          ,          p	Wx,          V	,          # ©r   ú4%s should be an isinstance of Matrix or MatrixSymbol)râ   rã   rx   rŠ   rD   r_   r   r   r   r    rÒ   r   r   r   r   r   r   )
r/   Úxrâ   rã   rx   ÚpÚsigma_inv_xÚterm1Úterm2Úterm3s
   &&        r'   rF   ÚMatrixGammaDistribution.pdf  sê   € Ø$(§J¡J°·	±	¸4×;LÑ;L�\ˆØ×Ñ˜qÕ!ˆÜ�aœ×ÒÜ Ó"ˆAÜ˜!œj¬,Ð7×8Ò8Üð &Ü(+¨A«õ/ó 0ð 0ä Ó-Ð-¨aÕ/°$Õ6ˆÜ”E˜+Ó&Ó'¨$°5µ­/¼ZÈÓ=QÕ)QÕRˆÜ˜\Ó*¨u¨fÕ5ˆÜ˜Q“ 5¬1¨Q°­U«8°A­:Õ#5Õ6ˆØ�}˜uÕ$Ð$r)   rQ   Nrá   ©rT   rU   rV   rW   Ú	_argnamesrÖ   ra   rY   r7   rb   rF   rZ   r[   r\   s   @r'   rØ   rØ   ñ   sP   ø‡ € à1€IàñNó ðNð ñ(ó ð(ð ñ'ó ð'÷%ð %r)   rØ   c                ój   € \        V\        4      '       d   \        V4      p\        V \        WV34      # )a•  
Creates a random variable with Matrix Gamma Distribution.

The density of the said distribution can be found at [1].

Parameters
==========

alpha: Positive Real number
    Shape Parameter
beta: Positive Real number
    Scale Parameter
scale_matrix: Positive definite real square matrix
    Scale Matrix

Returns
=======

RandomSymbol

Examples
========

>>> from sympy.stats import density, MatrixGamma
>>> from sympy import MatrixSymbol, symbols
>>> a, b = symbols('a b', positive=True)
>>> M = MatrixGamma('M', a, b, [[2, 1], [1, 2]])
>>> X = MatrixSymbol('X', 2, 2)
>>> density(M)(X).doit()
exp(Trace(Matrix([
[-2/3,  1/3],
[ 1/3, -2/3]])*X)/b)*Determinant(X)**(a - 3/2)/(3**a*sqrt(pi)*b**(2*a)*gamma(a)*gamma(a - 1/2))
>>> density(M)([[1, 0], [0, 1]]).doit()
exp(-4/(3*b))/(3**a*sqrt(pi)*b**(2*a)*gamma(a)*gamma(a - 1/2))


References
==========

.. [1] https://en.wikipedia.org/wiki/Matrix_gamma_distribution

)rD   r_   r   rf   rØ   )r6   râ   rã   rx   s   &&&&r'   ÚMatrixGammarü     s1   € ôV �,¤×%Ò%Ü& |Ó4ˆÜˆfÔ-°¸\Ð/JÓKÐKr)   c                   óZ   a € ] tR tRt o Rt]R 4       t]R 4       t]R 4       t	R t
RtV tR# )	rp   iH  c                ó¶   € \        V\        4      '       g   \        VP                  R 4       \        VP                  R4       \        V P
                  R4       R# )rÚ   rÛ   rÜ   NrÝ   ©rw   rx   s   &&r'   ra   ÚWishartDistribution.checkL  sH   € ä˜,¬×5Ò5Ü˜×:Ñ:ð =4ô 5ä�\×+Ñ+ð .ô 	ä�Q—]‘]Ð$IÖJr)   c                óp   € V P                   P                  ^ ,          p\        W\        P                  4      # r3   ræ   rè   s   & r'   r7   ÚWishartDistribution.setU  rë   r)   c                ó.   € V P                   P                  # r5   r‰   r.   s   &r'   rb   ÚWishartDistribution.dimensionZ  rî   r)   c                óÀ  € V P                   V P                  r2VP                  ^ ,          p\        V\        4      '       d   \        V4      p\        V\        \        34      '       g   \        R\        V4      ,          4      h\        V4      ) V,          \        ^4      ,          p\        \        V4      4      ^WB,          \        ^4      ,          ,          \        V\        ^4      ,          V4      ,          ,          p\        V4      V) \        ^4      ,          ,          p\        V4      \        W$,
          ^,
          4      ^,          ,          pWg,          V,          # rð   )rw   rx   rŠ   rD   r_   r   r   r   r    rÒ   r   r   r   r   r   r   )	r/   rò   rw   rx   ró   rô   rõ   rö   r÷   s	   &&       r'   rF   ÚWishartDistribution.pdf^  sý   € ØŸ&™& $×"3Ñ"3ˆ<Ø×Ñ˜qÕ!ˆÜ�aœ×ÒÜ Ó"ˆAÜ˜!œj¬,Ð7×8Ò8Üð &Ü(+¨A«õ/ó 0ð 0ä Ó-Ð-¨aÕ/´!°A³$Õ6ˆÜ”E˜+Ó&Ó'¨!¨a­c´!°A³$­h­-¼:ÀaÌÈ!ËÅfÈaÓ;PÕ)PÕQˆÜ˜\Ó*¨q¨b´°1³­gÕ6ˆÜ˜Q“¤1 Q¥U¨Q¥Y£<°¥>Õ2ˆØ�}˜uÕ$Ð$r)   rQ   Nrÿ   rù   r\   s   @r'   rp   rp   H  sP   ø‡ € à%€IàñKó ðKð ñ(ó ð(ð ñ'ó ð'÷%ð %r)   rp   c                óh   € \        V\        4      '       d   \        V4      p\        V \        W34      # )aY  
Creates a random variable with Wishart Distribution.

The density of the said distribution can be found at [1].

Parameters
==========

n: Positive Real number
    Represents degrees of freedom
scale_matrix: Positive definite real square matrix
    Scale Matrix

Returns
=======

RandomSymbol

Examples
========

>>> from sympy.stats import density, Wishart
>>> from sympy import MatrixSymbol, symbols
>>> n = symbols('n', positive=True)
>>> W = Wishart('W', n, [[2, 1], [1, 2]])
>>> X = MatrixSymbol('X', 2, 2)
>>> density(W)(X).doit()
exp(Trace(Matrix([
[-1/3,  1/6],
[ 1/6, -1/3]])*X))*Determinant(X)**(n/2 - 3/2)/(2**n*3**(n/2)*sqrt(pi)*gamma(n/2)*gamma(n/2 - 1/2))
>>> density(W)([[1, 0], [0, 1]]).doit()
exp(-2/3)/(2**n*3**(n/2)*sqrt(pi)*gamma(n/2)*gamma(n/2 - 1/2))

References
==========

.. [1] https://en.wikipedia.org/wiki/Wishart_distribution

)rD   r_   r   rf   rp   )r6   rw   rx   s   &&&r'   ÚWishartr  l  s/   € ôP �,¤×%Ò%Ü& |Ó4ˆÜˆfÔ)¨AÐ+<Ó=Ð=r)   c                   óZ   a € ] tR tRt o Rt]R 4       t]R 4       t]R 4       t	R t
RtV tR# )	r~   i›  c           	     óB  € \        V\        4      '       g   \        VP                  R 4       \        V\        4      '       g   \        VP                  R 4       \        VP                  R4       \        VP                  R4       V P
                  ^ ,          pV P
                  ^,          p\        VP
                  ^ ,          V8H  R\        V4      : R\        V4      : 24       \        VP
                  ^ ,          V8H  R\        V4      : R\        V4      : 24       R# )rÚ   ú)Scale matrix 1 should be be square matrixú)Scale matrix 2 should be be square matrixú"Scale matrix 1 should be of shape ú x ú"Scale matrix 2 should be of shape N)rD   r   r   rÞ   rß   rŠ   rÒ   )r…   r†   r‡   rw   ró   s   &&&  r'   ra   ÚMatrixNormalDistribution.checkŸ  sè   € ä˜.¬,×7Ò7Ü˜×<Ñ<ð ?4ô 5ä˜.¬,×7Ò7Ü˜×<Ñ<ð ?4ô 5ä�^×-Ñ-ð 0ô 	ä�^×-Ñ-ð 0ô 	à×!Ñ! !Õ$ˆØ×!Ñ! !Õ$ˆÜ�^×)Ñ)¨!Õ,°Ò1Ü! !žf¤c¨!¥fð4.ô 	/ä�^×)Ñ)¨!Õ,°Ò1Ü! !žf¤c¨!¥fð4.ö 	/r)   c                óf   € V P                   P                  w  r\        W\        P                  4      # r5   ©r…   rŠ   r   r   rç   ©r/   rw   ró   s   &  r'   r7   ÚMatrixNormalDistribution.set²  ó&   € à×#Ñ#×)Ñ)‰ˆÜ˜œqŸw™wÓ'Ð'r)   c                ó.   € V P                   P                  # r5   rŽ   r.   s   &r'   rb   Ú"MatrixNormalDistribution.dimension·  ó   € à×#Ñ#×)Ñ)Ð)r)   c                óÚ  € V P                   V P                  V P                  rCpVP                  w  rV\	        V\
        4      '       d   \        V4      p\	        V\        \        34      '       g   \        R \        V4      ,          4      h\        V4      \        W,
          4      ,          \        V4      ,          W,
          ,          p\        \        V4      ) \        ^4      ,          4      p^\         ,          \        WV,          4      ^,          ,          \#        V4      \        V4      ^,          ,          ,          \#        V4      \        V4      ^,          ,          ,          p	W‰,          # )rñ   )r…   r†   r‡   rŠ   rD   r_   r   r   r   r    rÒ   r   r   r   r   r   r   r   )
r/   rò   ÚMÚUÚVrw   ró   rõ   ÚnumÚdens
   &&        r'   rF   ÚMatrixNormalDistribution.pdf»  sü   € Ø×&Ñ&¨×(;Ñ(;¸T×=PÑ=PˆaˆØ�w‰w‰ˆÜ�aœ×ÒÜ Ó"ˆAÜ˜!œj¬,Ð7×8Ò8Üð &Ü(+¨A«õ/ó 0ð 0ä˜“
œ9 Q¥UÓ+Õ+¬G°A«JÕ6¸½Õ>ˆÜ”5˜“<�-¤ !£Õ$Ó%ˆØ”�t”q˜�“v˜a•xÕ ¤;¨q£>´A°a³D¸µFÕ#;Õ;¼kÈ!»nÌqÐQRËtÐTUÍvÕ>VÕVˆØ�wˆr)   rQ   N)r…   r†   r‡   rù   r\   s   @r'   r~   r~   ›  sN   ø‡ € àG€Iàñ/ó ð/ð$ ñ(ó ð(ð ñ*ó ð*÷ð r)   r~   c                óò   € \        V\        4      '       d   \        V4      p\        V\        4      '       d   \        V4      p\        V\        4      '       d   \        V4      pWV3p\        V \        V4      # )aC  
Creates a random variable with Matrix Normal Distribution.

The density of the said distribution can be found at [1].

Parameters
==========

location_matrix: Real ``n x p`` matrix
    Represents degrees of freedom
scale_matrix_1: Positive definite matrix
    Scale Matrix of shape ``n x n``
scale_matrix_2: Positive definite matrix
    Scale Matrix of shape ``p x p``

Returns
=======

RandomSymbol

Examples
========

>>> from sympy import MatrixSymbol
>>> from sympy.stats import density, MatrixNormal
>>> M = MatrixNormal('M', [[1, 2]], [1], [[1, 0], [0, 1]])
>>> X = MatrixSymbol('X', 1, 2)
>>> density(M)(X).doit()
exp(-Trace((Matrix([
[-1],
[-2]]) + X.T)*(Matrix([[-1, -2]]) + X))/2)/(2*pi)
>>> density(M)([[3, 4]]).doit()
exp(-4)/(2*pi)

References
==========

.. [1] https://en.wikipedia.org/wiki/Matrix_normal_distribution

)rD   r_   r   rf   r~   )r6   r…   r†   r‡   r-   s   &&&& r'   r®   r®   È  sd   € ôR �/¤4×(Ò(Ü)¨/Ó:ˆÜ�.¤$×'Ò'Ü(¨Ó8ˆÜ�.¤$×'Ò'Ü(¨Ó8ˆØ¨^Ð<€DÜˆfÔ.°Ó5Ð5r)   c                   óZ   a € ] tR tRt o Rt]R 4       t]R 4       t]R 4       t	R t
RtV tR# )	ÚMatrixStudentTDistributioniý  c           	     óŒ  € \        V\        4      '       g   \        VP                  R 8g  R4       \        V\        4      '       g   \        VP                  R 8g  R4       \        VP                  R 8g  R4       \        VP                  R 8g  R4       VP
                  ^ ,          pVP
                  ^,          p\        VP
                  ^ ,          V8H  R\        V4      : R\        V4      : 24       \        VP
                  ^ ,          V8H  R\        V4      : R\        V4      : 24       \        V P                  R 8g  R4       R# )	FrÚ   r  r  r  r  r  z#Degrees of freedom must be positiveN)rD   r   r   rÞ   rß   rŠ   rÒ   rà   )r³   r…   r†   r‡   rw   ró   s   &&&&  r'   ra   Ú MatrixStudentTDistribution.check  s$  € ä˜.¬,×7Ò7Ü˜×<Ñ<ÀÑEð Hbô cä˜.¬,×7Ò7Ü˜×<Ñ<ÀÑEð Hbô cä�^×-Ñ-°Ñ6ð 9Bô 	Cä�^×-Ñ-°Ñ6ð 9Bô 	Cà×!Ñ! !Õ$ˆØ×!Ñ! !Õ$ˆÜ�^×)Ñ)¨!Õ,°Ò1ÜJMÈaÎ&ÔRUÐVWÕRXð4Zô 	[ä�^×)Ñ)¨!Õ,°Ò1ÜJMÈaÎ&ÔRUÐVWÕRXð4Zô 	[ä�R—^‘^ uÑ,Ð.SÖTr)   c                óf   € V P                   P                  w  r\        W\        P                  4      # r5   r  r  s   &  r'   r7   ÚMatrixStudentTDistribution.set  r  r)   c                ó.   € V P                   P                  # r5   rŽ   r.   s   &r'   rb   Ú$MatrixStudentTDistribution.dimension  r  r)   c           	     óŠ  € ^ RI Hp \        V\        4      '       d   \	        V4      p\        V\
        \        34      '       g   \        R\        V4      ,          4      hV P                  V P                  V P                  V P                  3w  r4rVVP                  w  rx\        W7,           V,           ^,
          ^,          V4      \        V4      V) ^,          ,          ,          \        V4      V) ^,          ,          ,          \         Wx,          ^,          ,          \        W8,           ^,
          ^,          V4      ,          ,          p	V	\        V! V4      \#        V4      W,
          ,          \#        V4      ,          \%        W,
          4      ,          ,           4      W7,           V,           ^,
          ) ^,          ,          ,          # )r   )Úeyerñ   )Úsympy.matrices.denser*  rD   r_   r   r   r   r    rÒ   r³   r…   r†   r‡   rŠ   r   r   r   r   r   )
r/   rò   r*  r³   r  ÚOmegaÚSigmarw   ró   ÚKs
   &&        r'   rF   ÚMatrixStudentTDistribution.pdf  sL  € Ý,Ü�aœ×ÒÜ Ó"ˆAÜ˜!œj¬,Ð7×8Ò8Üð /Ü14°Q³õ8ó 9ð 9à"Ÿg™g t×';Ñ';¸T×=PÑ=PÐRV×ReÑReÐeÑˆˆuØ�w‰w‰ˆä˜� �
 Q�¨Õ)¨1Ó-´¸EÓ0BÀaÀRÈÅTÕ0JÕJÌ[ÐY^ÓM_ÐcdÐbdÐefÕbfÕMgÕgÜ�a•c˜!•e�}œz¨2­6°A­:°q­.¸!Ó<Õ<õ>ˆà”K¡ A£¬°«¸½Õ)?ÄÈÃÕ)NÌyÐYZÕY^ÓO_Õ)_Õ _Ó`Ø•F˜Q•J •MÐ" 1Õ$õ&õ &ð 	&r)   rQ   N)r³   r…   r†   r‡   rù   r\   s   @r'   r"  r"  ý  sP   ø‡ € àM€IàñUó ðUð& ñ(ó ð(ð ñ*ó ð*÷&ð &r)   r"  c                óò   € \        V\        4      '       d   \        V4      p\        V\        4      '       d   \        V4      p\        V\        4      '       d   \        V4      pWW43p\        V \        V4      # )a  
Creates a random variable with Matrix Gamma Distribution.

The density of the said distribution can be found at [1].

Parameters
==========

nu: Positive Real number
    degrees of freedom
location_matrix: Positive definite real square matrix
    Location Matrix of shape ``n x p``
scale_matrix_1: Positive definite real square matrix
    Scale Matrix of shape ``p x p``
scale_matrix_2: Positive definite real square matrix
    Scale Matrix of shape ``n x n``

Returns
=======

RandomSymbol

Examples
========

>>> from sympy import MatrixSymbol,symbols
>>> from sympy.stats import density, MatrixStudentT
>>> v = symbols('v',positive=True)
>>> M = MatrixStudentT('M', v, [[1, 2]], [[1, 0], [0, 1]], [1])
>>> X = MatrixSymbol('X', 1, 2)
>>> density(M)(X)
gamma(v/2 + 1)*Determinant((Matrix([[-1, -2]]) + X)*(Matrix([
[-1],
[-2]]) + X.T) + Matrix([[1]]))**(-v/2 - 1)/(pi**1.0*gamma(v/2)*Determinant(Matrix([[1]]))**1.0*Determinant(Matrix([
[1, 0],
[0, 1]]))**0.5)

References
==========

.. [1] https://en.wikipedia.org/wiki/Matrix_t-distribution

)rD   r_   r   rf   r"  )r6   r³   r…   r†   r‡   r-   s   &&&&& r'   ÚMatrixStudentTr1  /  sd   € ôX �/¤4×(Ò(Ü)¨/Ó:ˆÜ�.¤$×'Ò'Ü(¨Ó8ˆÜ�.¤$×'Ò'Ü(¨Ó8ˆØ Ð@€DÜˆfÔ0°$Ó7Ð7r)   N)2Úmathr   Úsympy.core.basicr   Úsympy.core.numbersr   Úsympy.core.singletonr   Ú&sympy.functions.elementary.exponentialr   Ú'sympy.functions.special.gamma_functionsr   Úsympy.core.sympifyr	   r
   Úsympy.matricesr   r   r   r   r   r   r   r   r   Úsympy.stats.rvr   r   r   r   r   r   r   Úsympy.externalr   r   rf   rh   rž   r¦   rÓ   rÈ   rØ   rü   rp   r  r~   r®   r"  r1  rQ   r)   r'   Ú<module>r<     sù   ðÝ å "Ý !Ý "Ý 6Ý >ß 0÷*÷ *õ *÷K÷ Kñ Kå (ô)X�6ô )XòX÷#Pñ #P÷LPñ P÷>&Qñ &QðR ÐØÐØ
ÐØÐð	Ð ô'˜ ~ô 'ô`#%Ð0ô #%òJ-Lôd"%Ð,ô "%òH*>ô^+Ð1ô +òZ06ôj.&Ð!3ô .&ôd38r)   