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

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

  The Cauchy probability distribution function is

  .. math::

     f(x) = \frac{1}{\pi(1 + 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 logpdf values

  See Also:
    - :func:`jax.scipy.stats.cauchy.cdf`
    - :func:`jax.scipy.stats.cauchy.pdf`
    - :func:`jax.scipy.stats.cauchy.sf`
    - :func:`jax.scipy.stats.cauchy.logcdf`
    - :func:`jax.scipy.stats.cauchy.logsf`
    - :func:`jax.scipy.stats.cauchy.isf`
    - :func:`jax.scipy.stats.cauchy.ppf`
  zcauchy.logpdf)r   
_lax_constnppir   divsublogmulnegaddlog1p)r	   r
   r   r   scaled_xnormalize_terms         V/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/jax/_src/scipy/stats/cauchy.pylogpdfr      s    8 '3F-!S%!RUU"WWSWWQ_e,(773772u-..	3778X3N)OP	QQ    c                 B    t        j                  t        | ||            S )a  Cauchy probability distribution function.

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

  The Cauchy probability distribution function is

  .. math::

     f(x) = \frac{1}{\pi(1 + 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.cauchy.cdf`
    - :func:`jax.scipy.stats.cauchy.sf`
    - :func:`jax.scipy.stats.cauchy.logcdf`
    - :func:`jax.scipy.stats.cauchy.logpdf`
    - :func:`jax.scipy.stats.cauchy.logsf`
    - :func:`jax.scipy.stats.cauchy.isf`
    - :func:`jax.scipy.stats.cauchy.ppf`
  )r   expr   r	   r
   r   s      r   pdfr    <   s    8 
3&	''r   c                 d   t        d| ||      \  } }}t        | t        j                        }t	        j
                  t	        j                  | |      |      }t	        j                  t        | d      t	        j                  t	        j
                  t        | d      |      t        |                  S )a5  Cauchy cumulative distribution function.

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

  The cdf is defined as

  .. math::

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

  where here :math:`f_{pdf}` is the Cauchy probability distribution function,
  :func:`jax.scipy.stats.cauchy.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.cauchy.pdf`
    - :func:`jax.scipy.stats.cauchy.sf`
    - :func:`jax.scipy.stats.cauchy.logcdf`
    - :func:`jax.scipy.stats.cauchy.logpdf`
    - :func:`jax.scipy.stats.cauchy.logsf`
    - :func:`jax.scipy.stats.cauchy.isf`
    - :func:`jax.scipy.stats.cauchy.ppf`
  z
cauchy.cdfg      ?g      ?)
r   r   r   r   r   r   r   r   r   r   )r	   r
   r   r   r   s        r   cdfr"   [   s    > '|QUC-!S%!RUU"WWSWWQ_e,(	As#SWWSWWZ25F-KVT\M]%^	__r   c                 B    t        j                  t        | ||            S )a;  Cauchy log cumulative distribution function.

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

  The cdf is defined as

  .. math::

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

  where here :math:`f_{pdf}` is the Cauchy probability distribution function,
  :func:`jax.scipy.stats.cauchy.pdf`.

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

  Returns:
    array of logcdf values.

  See Also:
    - :func:`jax.scipy.stats.cauchy.cdf`
    - :func:`jax.scipy.stats.cauchy.pdf`
    - :func:`jax.scipy.stats.cauchy.sf`
    - :func:`jax.scipy.stats.cauchy.logpdf`
    - :func:`jax.scipy.stats.cauchy.logsf`
    - :func:`jax.scipy.stats.cauchy.isf`
    - :func:`jax.scipy.stats.cauchy.ppf`
  )r   r   r"   r   s      r   logcdfr$      s    > 
QU#	$$r   c                 D    t        d| ||      \  } }}t        |  | |      S )a!  Cauchy distribution log survival function.

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

  The survival function is defined as

  .. math::

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

  where :math:`f_{cdf}(x)` is the cumulative distribution function,
  :func:`jax.scipy.stats.cauchy.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.cauchy.cdf`
    - :func:`jax.scipy.stats.cauchy.pdf`
    - :func:`jax.scipy.stats.cauchy.logcdf`
    - :func:`jax.scipy.stats.cauchy.logpdf`
    - :func:`jax.scipy.stats.cauchy.logsf`
    - :func:`jax.scipy.stats.cauchy.isf`
    - :func:`jax.scipy.stats.cauchy.ppf`
  z	cauchy.sf)r   r"   r   s      r   sfr&      s-    > '{AsEB-!S%	aR#u	r   c                 D    t        d| ||      \  } }}t        |  | |      S )a$  Cauchy distribution log survival function.

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

  The survival function is defined as

  .. math::

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

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

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

  Returns:
    array of logsf values.

  See Also:
    - :func:`jax.scipy.stats.cauchy.cdf`
    - :func:`jax.scipy.stats.cauchy.pdf`
    - :func:`jax.scipy.stats.cauchy.sf`
    - :func:`jax.scipy.stats.cauchy.logcdf`
    - :func:`jax.scipy.stats.cauchy.logpdf`
    - :func:`jax.scipy.stats.cauchy.isf`
    - :func:`jax.scipy.stats.cauchy.ppf`
  zcauchy.logsf)r   r$   r   s      r   logsfr(      s-    > '~q#uE-!S%	SD%	  r   qc           	      b   t        d| ||      \  } }}t        | t        j                        }t        | t        j                  dz        }t	        j
                  t	        j                  |t	        j                  ||                   }t	        j                  t	        j                  ||      |      S )a  Cauchy distribution inverse survival function.

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

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

  Args:
    q: 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.cauchy.cdf`
    - :func:`jax.scipy.stats.cauchy.pdf`
    - :func:`jax.scipy.stats.cauchy.sf`
    - :func:`jax.scipy.stats.cauchy.logcdf`
    - :func:`jax.scipy.stats.cauchy.logpdf`
    - :func:`jax.scipy.stats.cauchy.logsf`
    - :func:`jax.scipy.stats.cauchy.ppf`
  z
cauchy.isf   	r   r   r   r   r   tanr   r   r   r)   r
   r   r   half_piunscaleds         r   isfr1      s}    2 '|QUC-!S%!RUU"q"%%!)$'WWSWWWcggb!n56(	5)3	//r   c                 b   t        d| ||      \  } }}t        | t        j                        }t        | t        j                  dz        }t	        j
                  t	        j                  t	        j                  ||       |            }t	        j                  t	        j                  ||      |      S )a  Cauchy distribution percent point function.

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

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

  Args:
    q: 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.cauchy.cdf`
    - :func:`jax.scipy.stats.cauchy.pdf`
    - :func:`jax.scipy.stats.cauchy.sf`
    - :func:`jax.scipy.stats.cauchy.logcdf`
    - :func:`jax.scipy.stats.cauchy.logpdf`
    - :func:`jax.scipy.stats.cauchy.logsf`
    - :func:`jax.scipy.stats.cauchy.isf`
  z
cauchy.ppfr+   r,   r.   s         r   ppfr3     s}    2 '|QUC-!S%!RUU"q"%%!)$'WWSWWSWWR^W56(	5)3	//r   )r      )numpyr   jax._srcr   jax._src.lax.laxr   r   jax._src.numpy.ufuncsr   jax._src.numpy.utilr   jax._src.typingr   r   r   r    r"   r$   r&   r(   r1   r3    r   r   <module>r<      s1      1 ( 4 , Ri  Ri  RI  Re  RF(9 (9 ( (5 (>"`9 "`9 "` "`5 "`J%i %i %I %e %D )  )  	  %  F !Y  !Y  !9  !U  !F09 09 0 05 0@09 09 0 05 0r   