
    Vpf"              	          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dS )    N)lax)_const)promote_args_inexact)arctan)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         [/var/www/html/nettyfy-visnx/env/lib/python3.11/site-packages/jax/_src/scipy/stats/cauchy.pylogpdfr      s    8 '3FF-!S%!RU"WSWQ__e,,(7372u--...	378X3N3N)O)OPP	Q	QQ    c                 H    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                 z   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C-!S%!RU"WSWQ__e,,(	As##SWSWZ25F5F-K-KVT\M]M]%^%^	_	__r   c                 H    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                 T    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'      s3    > '{AsEBB-!S%	aR#u		r   c                 T    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)      s3    > '~q#uEE-!S%	SD%	 	  r   qc           	      `   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   isfr2      s    2 '|QUCC-!S%!RU"q"%!)$$'WSWWcgb!nn5566(	5))3	/	//r   c                 `   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   ppfr4     s    2 '|QUCC-!S%!RU"q"%!)$$'WSWSWR^^W5566(	5))3	/	//r   )r   r	   )numpyr   jaxr   jax._src.lax.laxr   r   jax._src.numpy.utilr   	jax.numpyr   jax._src.typingr   r   r   r!   r#   r%   r'   r)   r2   r4    r   r   <module>r<      s=              1 1 1 1 1 1 4 4 4 4 4 4       , , , , , , , , R  Ri  Ri  RI  Re  R  R  R  RF( (9 (9 ( (5 ( ( ( (>"` "`9 "`9 "` "`5 "` "` "` "`J% %i %i %I %e % % % %D   )  )  	  %        F !  !Y  !Y  !9  !U  !  !  !  !F0 09 09 0 05 0 0 0 0@0 09 09 0 05 0 0 0 0 0 0r   