
    Vpf4                     6   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mZmZ 	 dded	ed
edededefdZ	 dded	ed
edededefdZ	 dded	ed
edededefdZ	 dded	ed
edededefdZ	 dded	ed
edededefdZ	 dded	ed
edededefdZdS )    )laxN)_const)promote_args_inexact)Array	ArrayLike)betalnbetaincxlogyxlog1py   xablocscalereturnc                 ,   t          d| ||||          \  } }}}}t          | d          }t          |d          }t          j        t	          ||                    }t          j        t          j        | |          |          }t          j        t          t          j        ||          |          t          t          j        ||          t          j        |                              }	t          j        t          j        ||	          t          j
        |                    }
t          j        t          j        t          j        | t          j        ||                    t          j        | |                    t          j         |
          }t          j        t          j        t          j        t          j        ||          t          j        ||                    t          j        ||                    t          j        |          }|S )ai  Beta log probability distribution function.

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

  The pdf of the beta function is:

  .. math::

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

  where :math:`\Gamma` is the :func:`~jax.scipy.special.gamma` function,
  It is defined for :math:`0\le x\le 1` and :math:`b>0`.

  Args:
    x: arraylike, value at which to evaluate the PDF
    a: arraylike, distribution shape parameter
    b: 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.beta.cdf`
    - :func:`jax.scipy.stats.beta.pdf`
    - :func:`jax.scipy.stats.beta.sf`
    - :func:`jax.scipy.stats.beta.logcdf`
    - :func:`jax.scipy.stats.beta.logsf`
  zbeta.logpdfr   r   )r   
_lax_constr   negr   divsubaddr
   r   logjnpwhere
logical_orgtltinflenan)r   r   r   r   r   onezero
shape_termylog_linear_term	log_probsresultresult_positive_constantss                Y/var/www/html/nettyfy-visnx/env/lib/python3.11/site-packages/jax/_src/scipy/stats/beta.pylogpdfr+      s   @ -]Aq!S%PP!Q31a#	Aq		$wva||$$*	gcgaoou%%!GE#'!S//155#CGAsOOSWQZZ@@B B/gcgj/::CGENNKK)9S^CF1cgc5.A.A$B$B$'F1cNN4 469gXyJ J&!is~cfQPTooWZW]^_aeWfWf7g7g7:veT7J7J)L )LMPWV\^ ^	""    c           	      L    t          j        t          | ||||                    S )ab  Beta probability distribution function.

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

  The pdf of the beta function is:

  .. math::

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

  where :math:`\Gamma` is the :func:`~jax.scipy.special.gamma` function.
  It is defined for :math:`0\le x\le 1` and :math:`b>0`.

  Args:
    x: arraylike, value at which to evaluate the PDF
    a: arraylike, distribution shape parameter
    b: 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.beta.cdf`
    - :func:`jax.scipy.stats.beta.sf`
    - :func:`jax.scipy.stats.beta.logcdf`
    - :func:`jax.scipy.stats.beta.logpdf`
    - :func:`jax.scipy.stats.beta.logsf`
  )r   expr+   r   r   r   r   r   s        r*   pdfr0   F   s%    @ 
1ae,,	-	--r,   c                    t          d| ||||          \  } }}}}t          ||t          j        t	          | d          t          j        t          j        | |          |          t	          | d                              S )a>  Beta cumulative distribution function

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

  The cdf is defined as

  .. math::

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

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

  Args:
    x: arraylike, value at which to evaluate the CDF
    a: arraylike, distribution shape parameter
    b: 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.beta.pdf`
    - :func:`jax.scipy.stats.beta.sf`
    - :func:`jax.scipy.stats.beta.logcdf`
    - :func:`jax.scipy.stats.beta.logpdf`
    - :func:`jax.scipy.stats.beta.logsf`
  zbeta.cdfr   r   r   r	   r   clampr   r   r   r/   s        r*   cdfr4   i   s    @ -ZAq#uMM!Q3	IA	gcgaoou%%A 
 
 r,   c           	      L    t          j        t          | ||||                    S )aF  Beta log cumulative distribution function.

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

  The cdf is defined as

  .. math::

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

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

  Args:
    x: arraylike, value at which to evaluate the CDF
    a: arraylike, distribution shape parameter
    b: 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.beta.cdf`
    - :func:`jax.scipy.stats.beta.pdf`
    - :func:`jax.scipy.stats.beta.sf`
    - :func:`jax.scipy.stats.beta.logpdf`
    - :func:`jax.scipy.stats.beta.logsf`
  )r   r   r4   r/   s        r*   logcdfr6      s%    @ 
Q1c5))	*	**r,   c                 
   t          d| ||||          \  } }}}}t          ||dt          j        t	          | d          t          j        t          j        | |          |          t	          | d                    z
            S )a1  Beta distribution survival function.

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

  The survival function is defined as

  .. math::

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

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

  Args:
    x: arraylike, value at which to evaluate the SF
    a: arraylike, distribution shape parameter
    b: 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.beta.cdf`
    - :func:`jax.scipy.stats.beta.pdf`
    - :func:`jax.scipy.stats.beta.logcdf`
    - :func:`jax.scipy.stats.beta.logpdf`
    - :func:`jax.scipy.stats.beta.logsf`
  zbeta.sfr   r   r2   r/   s        r*   sfr8      s    @ -Y1aeLL!Q3		A	gcgaoou%%A	 	 
 
 r,   c           	      L    t          j        t          | ||||                    S )a8  Beta distribution log survival function.

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

  The survival function is defined as

  .. math::

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

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

  Args:
    x: arraylike, value at which to evaluate the SF
    a: arraylike, distribution shape parameter
    b: 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.beta.cdf`
    - :func:`jax.scipy.stats.beta.pdf`
    - :func:`jax.scipy.stats.beta.sf`
    - :func:`jax.scipy.stats.beta.logcdf`
    - :func:`jax.scipy.stats.beta.logpdf`
  )r   r   r8   r/   s        r*   logsfr:      s%    @ 
Aq!S%((	)	))r,   )r   r   )jaxr   	jax.numpynumpyr   jax._src.lax.laxr   r   jax._src.numpy.utilr   jax._src.typingr   r   jax.scipy.specialr   r	   r
   r   r+   r0   r4   r6   r8   r:    r,   r*   <module>rC      s\               1 1 1 1 1 1 4 4 4 4 4 4 , , , , , , , , = = = = = = = = = = = = 34,# ,#i ,#I ,#) ,#,#&/,#8=,# ,# ,# ,#` 01 .  .9  .  .y  . .#, .5: .  .  .  .H 01) )9 ) )y ))#,)5:) ) ) )Z 34 +  +i  +I  +)  + +&/ +8= +  +  +  +H /0) )) )	 )i ))"+)49) ) ) )Z 23 *  *Y  *9  *  * *%. *7< *  *  *  *  *  *r,   