
    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m	Z	 dde	de	de	d	efd
Z
dde	de	de	d	efdZdde	de	de	d	efdZdde	de	de	d	efdZdde	de	de	d	efdZdde	de	de	d	efdZdde	de	de	d	efdZy)    N)lax)numpy)promote_args_inexact)Array	ArrayLikexlocscalereturnc                 j   t        d| ||      \  } }}t        j                  |      }t        j                  t        j                  | |      |      }t        j
                  t        j                  ||            }t        j                  t        j                  | |      t        j                   |      S )a  Exponential log probability distribution function.

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

  The Exponential probability distribution function is

  .. math::

     f(x) = \begin{cases}
       e^{-x} & x \ge 0 \\
       0 & \mathrm{otherwise}
     \end{cases}

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

  Returns:
    array of logpdf values.

  See Also:
    :func:`jax.scipy.stats.expon.cdf`
    :func:`jax.scipy.stats.expon.pdf`
    :func:`jax.scipy.stats.expon.ppf`
    :func:`jax.scipy.stats.expon.sf`
    :func:`jax.scipy.stats.expon.logcdf`
    :func:`jax.scipy.stats.expon.logpdf`
    :func:`jax.scipy.stats.expon.logsf`
  zexpon.logpdf)r   r   logdivsubnegaddjnpwhereltnpinf)r   r	   r
   	log_scalelinear_term	log_probss         U/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/jax/_src/scipy/stats/expon.pylogpdfr      s}    > '~q#uE-!S%ggen)3/+ggcggk956)	366!S>BFF7I	66    c                 B    t        j                  t        | ||            S )a  Exponential probability distribution function.

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

  The Exponential probability distribution function is

  .. math::

     f(x) = \begin{cases}
       e^{-x} & x \ge 0 \\
       0 & \mathrm{otherwise}
     \end{cases}

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

  Returns:
    array of pdf values.

  See Also:
    :func:`jax.scipy.stats.expon.cdf`
    :func:`jax.scipy.stats.expon.pdf`
    :func:`jax.scipy.stats.expon.ppf`
    :func:`jax.scipy.stats.expon.sf`
    :func:`jax.scipy.stats.expon.logcdf`
    :func:`jax.scipy.stats.expon.logpdf`
    :func:`jax.scipy.stats.expon.logsf`
  )r   expr   r   r	   r
   s      r   pdfr    =   s    > 
3&	''r   c           	      B   t        d| ||      \  } }}t        j                  t        j                  ||       |      }t	        j
                  t        j                  | |      t	        j                  |      t        j                  t        j                  |                  S )a(  Exponential cumulative density function.

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

  The cdf is defined as

  .. math::

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

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

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

  Returns:
    array of pdf values.

  See Also:
    :func:`jax.scipy.stats.expon.cdf`
    :func:`jax.scipy.stats.expon.pdf`
    :func:`jax.scipy.stats.expon.ppf`
    :func:`jax.scipy.stats.expon.sf`
    :func:`jax.scipy.stats.expon.logcdf`
    :func:`jax.scipy.stats.expon.logpdf`
    :func:`jax.scipy.stats.expon.logsf`
  z	expon.cdf)
r   r   r   r   r   r   r   
zeros_liker   expm1r   r	   r
   neg_scaled_xs       r   cdfr&   _   ss    > '{AsEB-!S%a%0,	FF1cNNN< GGCIIl#$
 r   c           	      h    t        j                  t        j                  t        | ||                  S )a/  Exponential log cumulative density function.

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

  The cdf is defined as

  .. math::

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

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

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

  Returns:
    array of pdf values.

  See Also:
    :func:`jax.scipy.stats.expon.cdf`
    :func:`jax.scipy.stats.expon.pdf`
    :func:`jax.scipy.stats.expon.ppf`
    :func:`jax.scipy.stats.expon.sf`
    :func:`jax.scipy.stats.expon.logcdf`
    :func:`jax.scipy.stats.expon.logpdf`
    :func:`jax.scipy.stats.expon.logsf`
  )r   log1pr   sfr   s      r   logcdfr*      s%    > 
3772ae,-	..r   c                     t        d| ||      \  } }}t        j                  t        j                  ||       |      }t	        j
                  t        j                  | |      t	        j                  |      |      S )a  Exponential log survival function.

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

  The survival function is defined as

  .. math::

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

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

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

  Returns:
    array of pdf values.

  See Also:
    :func:`jax.scipy.stats.expon.cdf`
    :func:`jax.scipy.stats.expon.pdf`
    :func:`jax.scipy.stats.expon.ppf`
    :func:`jax.scipy.stats.expon.sf`
    :func:`jax.scipy.stats.expon.logcdf`
    :func:`jax.scipy.stats.expon.logpdf`
    :func:`jax.scipy.stats.expon.logsf`
  zexpon.sf)r   r   r   r   r   r   r   r"   r$   s       r   logsfr,      sZ    > 'z1c5A-!S%a%0,	366!S>3>>,#?	NNr   c                 B    t        j                  t        | ||            S )a  Exponential survival function.

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

  The survival function is defined as

  .. math::

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

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

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

  Returns:
    array of pdf values.

  See Also:
    :func:`jax.scipy.stats.expon.cdf`
    :func:`jax.scipy.stats.expon.pdf`
    :func:`jax.scipy.stats.expon.ppf`
    :func:`jax.scipy.stats.expon.sf`
    :func:`jax.scipy.stats.expon.logcdf`
    :func:`jax.scipy.stats.expon.logpdf`
    :func:`jax.scipy.stats.expon.logsf`
  )r   r   r,   r   s      r   r)   r)      s    > 
q#u%	&&r   qc           	      N   t        d| ||      \  } }}t        j                  t        j                  ||       |      }t	        j
                  t	        j                  |       | dk  z  | dkD  z  t        j                  t        j                  t        j                  |                  S )a  Exponential survival function.

  JAX implementation of :obj:`scipy.stats.expon` ``ppf``.

  The percent point function is defined as the inverse of the
  cumulative distribution function, :func:`jax.scipy.stats.expon.cdf`.

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

  Returns:
    array of pdf values.

  See Also:
    :func:`jax.scipy.stats.expon.cdf`
    :func:`jax.scipy.stats.expon.pdf`
    :func:`jax.scipy.stats.expon.ppf`
    :func:`jax.scipy.stats.expon.sf`
    :func:`jax.scipy.stats.expon.logcdf`
    :func:`jax.scipy.stats.expon.logpdf`
    :func:`jax.scipy.stats.expon.logsf`
  z	expon.ppfr      )r   r   r   r   r   r   isnanr   nanr   r(   )r.   r	   r
   neg_scaled_qs       r   ppfr4      s~    2 '{AsEB-!S%a%0,	IIaLAEa!e$FFGGCIIl#$
 r   )r   r0   )r   r   jax._srcr   r   jax._src.numpy.utilr   jax._src.typingr   r   r   r    r&   r*   r,   r)   r4    r   r   <module>r9      s     ! 4 ,#7i #7i #7I #7e #7L(9 (9 ( (5 (D%9 %9 % %5 %P/i /i /I /e /D!OY !OY !O9 !OU !OH') ') '	 '% 'D9 9  5 r   