
    uki              	           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 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y)    )lax)numpy)_const)promote_args_inexact)expitlogit)Array	ArrayLikexlocscalereturnc                    t        d| ||      \  } }}t        j                  t        j                  | |      |      } t	        | d      }t        j                  | |      }t        j                  t        j
                  t        j                  |      t        j                  |t        j                  |                  t        j                  |            S )a  Logistic log probability distribution function.

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

  The logistic probability distribution function is given by

  .. math::

     f(x) = \frac{e^{-x}}{(1 + e^{-x})^2}

  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.logistic.cdf`
    - :func:`jax.scipy.stats.logistic.pdf`
    - :func:`jax.scipy.stats.logistic.sf`
    - :func:`jax.scipy.stats.logistic.isf`
    - :func:`jax.scipy.stats.logistic.ppf`
  zlogistic.logpdf   )
r   r   divsub
_lax_constmulnegjnp	logaddexplog)r   r   r   twohalf_xs        X/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/jax/_src/scipy/stats/logistic.pylogpdfr      s    6 ''8!S%H-!S%	ggcggaou%!1a#771c?&	s}}VSWWV_'MNPSPWPWX]P^	__    c                 B    t        j                  t        | ||            S )a  Logistic probability distribution function.

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

  The logistic probability distribution function is given by

  .. math::

     f(x) = \frac{e^{-x}}{(1 + e^{-x})^2}

  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.logistic.cdf`
    - :func:`jax.scipy.stats.logistic.sf`
    - :func:`jax.scipy.stats.logistic.isf`
    - :func:`jax.scipy.stats.logistic.logpdf`
    - :func:`jax.scipy.stats.logistic.ppf`
  )r   expr   r   r   r   s      r   pdfr!   :   s    4 
3&	''r   c                     t        d| ||      \  } }}t        j                  t        j                  t	        |       |      |      S )a  Logistic distribution percent point function.

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

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

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

  Returns:
    array of ppf values.

  See Also:
    - :func:`jax.scipy.stats.logistic.cdf`
    - :func:`jax.scipy.stats.logistic.pdf`
    - :func:`jax.scipy.stats.logistic.sf`
    - :func:`jax.scipy.stats.logistic.isf`
    - :func:`jax.scipy.stats.logistic.logpdf`
  zlogistic.ppf)r   r   addr   r   r    s      r   ppfr$   W   s:    . '~q#uE-!S%	q5)3	//r   c           
          t        d| ||      \  } }}t        t        j                  t        j                  t        j
                  | |      |                  S )a  Logistic distribution survival function.

  JAX implementation of :obj:`scipy.stats.logistic` ``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.logistic.cdf`.

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

  Returns:
    array of sf values.

  See Also:
    - :func:`jax.scipy.stats.logistic.cdf`
    - :func:`jax.scipy.stats.logistic.pdf`
    - :func:`jax.scipy.stats.logistic.isf`
    - :func:`jax.scipy.stats.logistic.logpdf`
    - :func:`jax.scipy.stats.logistic.ppf`
  zlogistic.sf)r   r   r   r   r   r   r    s      r   sfr&   r   sC    : '}aeD-!S%	swwswwswwq#67	88r   c           	          t        d| ||      \  } }}t        j                  t        j                  t        j                  t        |             |      |      S )aw  Logistic distribution inverse survival function.

  JAX implementation of :obj:`scipy.stats.logistic` ``isf``.

  Returns the inverse of the survival function,
  :func:`jax.scipy.stats.logistic.sf`.

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

  Returns:
    array of isf values.

  See Also:
    - :func:`jax.scipy.stats.logistic.cdf`
    - :func:`jax.scipy.stats.logistic.pdf`
    - :func:`jax.scipy.stats.logistic.sf`
    - :func:`jax.scipy.stats.logistic.logpdf`
    - :func:`jax.scipy.stats.logistic.ppf`
  zlogistic.isf)r   r   r#   r   r   r   r    s      r   isfr(      sC    . '~q#uE-!S%	q*E2C	88r   c                     t        d| ||      \  } }}t        t        j                  t        j                  | |      |            S )a  Logistic cumulative distribution function.

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

  The cdf is defined as

  .. math::

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

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

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

  Returns:
    array of cdf values.

  See Also:
    - :func:`jax.scipy.stats.logistic.pdf`
    - :func:`jax.scipy.stats.logistic.sf`
    - :func:`jax.scipy.stats.logistic.isf`
    - :func:`jax.scipy.stats.logistic.logpdf`
    - :func:`jax.scipy.stats.logistic.ppf`
  zlogistic.cdf)r   r   r   r   r   r    s      r   cdfr*      s:    : '~q#uE-!S%	swwswwq#.	//r   N)r      )jax._srcr   r   r   jax._src.lax.laxr   r   jax._src.numpy.utilr   jax._src.scipy.specialr   r   jax._src.typingr	   r
   r   r!   r$   r&   r(   r*    r   r   <module>r2      s      ! 1 4 / ,`i `i `I `e `D(9 (9 ( (5 (:09 09 0 05 069) 9) 9	 9% 9B99 99 9 95 9609 09 0 05 0r   