
    ukiM
                         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lmZmZ dded	ed
ededef
dZdded	ed
ededef
dZy)    N)lax)numpy)_const)promote_args_inexact)gammalnxlogy)Array	ArrayLikeknplocreturnc           
      d   t        d| |||      \  } }}}t        | d      }t        j                  | |      }t        j                  t        j                  t	        t        j
                  ||            t	        |            t	        t        j
                  ||                  }t        j
                  t        ||      t        |t        j                  ||                  }t        j
                  ||      }t        j                  t        j                  | |      t        j                   |      S )aI  Negative-binomial log probability mass function.

  JAX implementation of :obj:`scipy.stats.nbinom` ``logpmf``.

  The negative-binomial probability mass function is given by

  .. math::

     f(k) = {{k+n-1} \choose {n-1}}p^n(1-p)^k

  for :math:`k \ge 0` and :math:`0 \le p \le 1`.

  Args:
    k: arraylike, value at which to evaluate the PMF
    n: arraylike, distribution shape parameter
    p: arraylike, distribution shape parameter
    loc: arraylike, distribution offset parameter

  Returns:
    array of logpdf values.

  See Also:
    :func:`jax.scipy.stats.nbinom.pmf`
  znbinom.logpmf   )r   
_lax_constr   subr   addr   jnpwhereltnpinf)	r   r   r   r   oney	comb_termlog_linear_term	log_probss	            V/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/jax/_src/scipy/stats/nbinom.pylogpmfr       s    2 &oq!QD,!Q31a#	ggao!ggGGGCGGAqM"GAJ/C1I) GGE!QKq#''#q/)BC/ggi1)	366!S>BFF7I	66    c                 D    t        j                  t        | |||            S )aB  Negative-binomial probability mass function.

  JAX implementation of :obj:`scipy.stats.nbinom` ``pmf``.

  The negative-binomial probability mass function is given by

  .. math::

     f(k) = {{k+n-1} \choose {n-1}}p^n(1-p)^k

  for :math:`k \ge 0` and :math:`0 \le p \le 1`.

  Args:
    k: arraylike, value at which to evaluate the PMF
    n: arraylike, distribution shape parameter
    p: arraylike, distribution shape parameter
    loc: arraylike, distribution offset parameter

  Returns:
    array of pmf values.

  See Also:
    :func:`jax.scipy.stats.nbinom.logpmf`
  )r   expr    )r   r   r   r   s       r   pmfr$   =   s    2 
1a%	&&r!   )r   )r   r   jax._srcr   r   jax._src.lax.laxr   r   jax._src.numpy.utilr   jax._src.scipy.specialr   r   jax._src.typingr	   r
   r    r$    r!   r   <module>r+      sm      ! 1 4 1 ,!7i !7I !7) !7) !7E !7H'9 ' 'y 'y ' 'r!   