Ë
    ñuki¤  ã                   ó  — d dl Zd dlmZ d dlm Z d dlmZ d dlm	Z	 d dl
mZmZmZmZ d dlmZmZ dded	ed
ededef
d„Zdded	ed
ededef
d„Zdded	ed
ededef
d„Zdded	ed
ededef
d„Zdded	ed
ededef
d„Zdded	ed
ededef
d„Zy)é    N)Úlax)Únumpy)Ú_const)Úpromote_args_inexact)ÚgammalnÚxlogyÚgammaincÚ	gammaincc)ÚArrayÚ	ArrayLikeÚxÚaÚlocÚscaleÚreturnc           	      ó0  — t        d| |||«      \  } }}}t        j                  | |«      }t        | d«      }t	        j
                  |t        j                  t        j                  | |«      |«      |«      }t        j                  t        t        j                  ||«      |«      |«      }t        j                  t        |«      t        j                  |«      «      }t        j                  ||«      }	t	        j
                  ||	t        j                   «      S )a4  Gamma log probability distribution function.

  JAX implementation of :obj:`scipy.stats.gamma` ``logpdf``.

  The Gamma probability distribution is given by

  .. math::

     f(x, a) = \frac{1}{\Gamma(a)}x^{a-1}e^{-x}

  Where :math:`\Gamma(a)` is the :func:`~jax.scipy.special.gamma` function.
  It is defined for :math:`x \ge 0` and :math:`a > 0`.

  Args:
    x: arraylike, value at which to evaluate the PDF
    a: arraylike, distribution shape parameter
    loc: arraylike, distribution offset parameter
    scale: arraylike, distribution scale parameter

  Returns:
    array of logpdf values.

  See Also:
    - :func:`jax.scipy.stats.gamma.cdf`
    - :func:`jax.scipy.stats.gamma.pdf`
    - :func:`jax.scipy.stats.gamma.sf`
    - :func:`jax.scipy.stats.gamma.logcdf`
    - :func:`jax.scipy.stats.gamma.logsf`
  zgamma.logpdfé   )r   r   ÚgeÚ
_lax_constÚjnpÚwhereÚdivÚsubr   Úaddr   ÚlogÚnpÚinf)
r   r   r   r   ÚokÚoneÚyÚlog_linear_termÚshape_termsÚ	log_probss
             úU/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/jax/_src/scipy/stats/gamma.pyÚlogpdfr%      sÇ   € ô< *¨.¸!¸QÀÀUÓKÑ€!€QˆˆUÜ
‡vvˆaƒ~€"Ü1aÓ€#Ü	‡ii”C—G‘GœCŸG™G A s›O¨UÓ3°SÓ9€!Ü—G‘GœE¤#§'¡'¨!¨S£/°1Ó5°qÓ9€/Ü—‘œ ›
¤C§G¡G¨E£NÓ3€+Üg‰go {Ó3€)Ü	‰2y¤2§6¡6 'Ó	*Ð*ó    c                 óD   — t        j                  t        | |||«      «      S )a-  Gamma probability distribution function.

  JAX implementation of :obj:`scipy.stats.gamma` ``pdf``.

  The Gamma probability distribution is given by

  .. math::

     f(x, a) = \frac{1}{\Gamma(a)}x^{a-1}e^{-x}

  Where :math:`\Gamma(a)` is the :func:`~jax.scipy.special.gamma` function.
  It is defined for :math:`x \ge 0` and :math:`a > 0`.

  Args:
    x: arraylike, value at which to evaluate the PDF
    a: arraylike, distribution shape parameter
    loc: arraylike, distribution offset parameter
    scale: arraylike, distribution scale parameter

  Returns:
    array of pdf values.

  See Also:
    - :func:`jax.scipy.stats.gamma.cdf`
    - :func:`jax.scipy.stats.gamma.sf`
    - :func:`jax.scipy.stats.gamma.logcdf`
    - :func:`jax.scipy.stats.gamma.logpdf`
    - :func:`jax.scipy.stats.gamma.logsf`
  )r   Úexpr%   ©r   r   r   r   s       r$   Úpdfr*   A   s   € ô< 
‰”˜˜1˜c 5Ó)Ó	*Ð*r&   c                 ó   — t        d| |||«      \  } }}}t        |t        j                  t	        | d«      t        j
                  t        j                  | |«      |«      t	        | t        j                  «      «      «      S )a  Gamma cumulative distribution function.

  JAX implementation of :obj:`scipy.stats.gamma` ``cdf``.

  The cdf is defined as

  .. math::

     f_{cdf}(x, a) = \int_{-\infty}^x f_{pdf}(y, a)\mathrm{d}y

  where :math:`f_{pdf}` is the probability density function,
  :func:`jax.scipy.stats.gamma.pdf`.

  Args:
    x: arraylike, value at which to evaluate the CDF
    a: arraylike, distribution shape parameter
    loc: arraylike, distribution offset parameter
    scale: arraylike, distribution scale parameter

  Returns:
    array of cdf values.

  See Also:
    - :func:`jax.scipy.stats.gamma.pdf`
    - :func:`jax.scipy.stats.gamma.sf`
    - :func:`jax.scipy.stats.gamma.logcdf`
    - :func:`jax.scipy.stats.gamma.logpdf`
    - :func:`jax.scipy.stats.gamma.logsf`
  z	gamma.cdfr   )	r   r	   r   Úclampr   r   r   r   r   r)   s       r$   Úcdfr-   b   sk   € ô< *¨+°q¸!¸SÀ%ÓHÑ€!€QˆˆUÜ	ØÜ‡IIÜAÓÜ	‡ggŒcg‰ga˜‹o˜uÓ%Ü”B—F‘FÓóó
ð r&   c                 óD   — t        j                  t        | |||«      «      S )a  Gamma log cumulative distribution function.

  JAX implementation of :obj:`scipy.stats.gamma` ``logcdf``.

  The cdf is defined as

  .. math::

     f_{cdf}(x, a) = \int_{-\infty}^x f_{pdf}(y, a)\mathrm{d}y

  where :math:`f_{pdf}` is the probability density function,
  :func:`jax.scipy.stats.gamma.pdf`.

  Args:
    x: arraylike, value at which to evaluate the CDF
    a: arraylike, distribution shape parameter
    loc: arraylike, distribution offset parameter
    scale: arraylike, distribution scale parameter

  Returns:
    array of logcdf values.

  See Also:
    - :func:`jax.scipy.stats.gamma.cdf`
    - :func:`jax.scipy.stats.gamma.pdf`
    - :func:`jax.scipy.stats.gamma.sf`
    - :func:`jax.scipy.stats.gamma.logpdf`
    - :func:`jax.scipy.stats.gamma.logsf`
  )r   r   r-   r)   s       r$   Úlogcdfr/   ‹   s   € ô< 
‰”Q˜˜3 Ó&Ó	'Ð'r&   c           	      óü   — t        d| |||«      \  } }}}t        j                  t        j                  | |«      |«      }t	        j
                  t        j                  |t        |d«      «      dt        ||«      «      S )aï  Gamma survival function.

  JAX implementation of :obj:`scipy.stats.gamma` ``sf``.

  The survival function is defined as

  .. math::

     f_{sf}(x, k) = 1 - f_{cdf}(x, k)

  where :math:`f_{cdf}(x, k)` is the cumulative distribution function,
  :func:`jax.scipy.stats.gamma.cdf`.

  Args:
    x: arraylike, value at which to evaluate the SF
    a: arraylike, distribution shape parameter
    loc: arraylike, distribution offset parameter
    scale: arraylike, distribution scale parameter

  Returns:
    array of sf values.

  See Also:
    - :func:`jax.scipy.stats.gamma.cdf`
    - :func:`jax.scipy.stats.gamma.pdf`
    - :func:`jax.scipy.stats.gamma.logcdf`
    - :func:`jax.scipy.stats.gamma.logpdf`
    - :func:`jax.scipy.stats.gamma.logsf`
  zgamma.sfr   r   )	r   r   r   r   r   r   Últr   r
   )r   r   r   r   r    s        r$   Úsfr2   ¬   sd   € ô< *¨*°a¸¸CÀÓGÑ€!€QˆˆUÜ	‡ggŒcg‰ga˜‹o˜uÓ%€!Ü	‰”3—6‘6˜!œZ¨¨1Ó-Ó.°´9¸QÀ³?Ó	CÐCr&   c                 óD   — t        j                  t        | |||«      «      S )aö  Gamma log survival function.

  JAX implementation of :obj:`scipy.stats.gamma` ``logsf``.

  The survival function is defined as

  .. math::

     f_{sf}(x, k) = 1 - f_{cdf}(x, k)

  where :math:`f_{cdf}(x, k)` is the cumulative distribution function,
  :func:`jax.scipy.stats.gamma.cdf`.

  Args:
    x: arraylike, value at which to evaluate the SF
    a: arraylike, distribution shape parameter
    loc: arraylike, distribution offset parameter
    scale: arraylike, distribution scale parameter

  Returns:
    array of logsf values.

  See Also:
    - :func:`jax.scipy.stats.gamma.cdf`
    - :func:`jax.scipy.stats.gamma.pdf`
    - :func:`jax.scipy.stats.gamma.sf`
    - :func:`jax.scipy.stats.gamma.logcdf`
    - :func:`jax.scipy.stats.gamma.logpdf`
  )r   r   r2   r)   s       r$   Úlogsfr4   Ï   s   € ô< 
‰”Aq˜#˜uÓ%Ó	&Ð&r&   )r   r   )r   r   Újax._srcr   r   Újax._src.lax.laxr   r   Újax._src.numpy.utilr   Újax._src.scipy.specialr   r   r	   r
   Újax._src.typingr   r   r%   r*   r-   r/   r2   r4   © r&   r$   ú<module>r;      s   ðó å Ý !Ý 1Ý 4ß FÓ Fß ,ñ%+ˆið %+˜Ið %+¨Ið %+À)ð %+ÐTYó %+ñP+ˆ9ð +˜ð +¨ð +¸yð +ÐQVó +ñB&ˆ9ð &˜ð &¨ð &¸yð &ÐQVó &ñR(ˆið (˜Ið (¨Ið (À)ð (ÐTYó (ñB Dˆ)ð  D˜	ð  D¨	ð  D¸ið  DÐPUó  DñF'ˆYð '˜9ð '¨9ð 'Àð 'ÐSXô 'r&   