
    Vh	                         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	 d dl
mZmZ d dlmZ d dlmZ d	gZ G d
 d	e	      Zy)    )Optional)Tensor)constraints)Exponential)TransformedDistribution)AffineTransformExpTransform)broadcast_all)_sizeParetoc            	       .    e Zd ZdZej
                  ej
                  dZ	 ddededee	   ddf fdZ
	 dd	ed
ed    dd f fdZedefd       Zedefd       Zedefd       Z ej"                  dd      dej$                  fd       ZdefdZ xZS )r   a  
    Samples from a Pareto Type 1 distribution.

    Example::

        >>> # xdoctest: +IGNORE_WANT("non-deterministic")
        >>> m = Pareto(torch.tensor([1.0]), torch.tensor([1.0]))
        >>> m.sample()  # sample from a Pareto distribution with scale=1 and alpha=1
        tensor([ 1.5623])

    Args:
        scale (float or Tensor): Scale parameter of the distribution
        alpha (float or Tensor): Shape parameter of the distribution
    )alphascaleNr   r   validate_argsreturnc                     t        ||      \  | _        | _        t        | j                  |      }t	               t        d| j                        g}t        |   |||       y )N)r   r   )locr   )r
   r   r   r   r	   r   super__init__)selfr   r   r   	base_dist
transforms	__class__s         J/home/dcms/DCMS/lib/python3.12/site-packages/torch/distributions/pareto.pyr   zPareto.__init__!   sU     "/ue!<
DJ

-H	"no!4::&NO
JmL    batch_shape	_instancec                     | j                  t        |      }| j                  j                  |      |_        | j                  j                  |      |_        t
        |   ||      S )N)r   )_get_checked_instancer   r   expandr   r   )r   r   r   newr   s       r   r    zPareto.expand)   sV     ((;JJ%%k2	JJ%%k2	w~kS~99r   c                 d    | j                   j                  d      }|| j                  z  |dz
  z  S )N   min)r   clampr   r   as     r   meanzPareto.mean1   s2     JJ#4::~Q''r   c                     | j                   S N)r   r   s    r   modezPareto.mode7   s    zzr   c                     | j                   j                  d      }| j                  j                  d      |z  |dz
  j                  d      |dz
  z  z  S )N   r$   r#   )r   r&   r   powr'   s     r   variancezPareto.variance;   sM     JJ#zz~~a 1$QA!a%(@AAr   Fr   )is_discrete	event_dimc                 @    t        j                  | j                        S r+   )r   greater_than_eqr   r,   s    r   supportzPareto.supportA   s    **4::66r   c                     | j                   | j                  z  j                         d| j                  j                         z   z   S )Nr#   )r   r   log
reciprocalr,   s    r   entropyzPareto.entropyE   s5    

TZZ',,.!djj6K6K6M2MNNr   r+   )__name__
__module____qualname____doc__r   positivearg_constraintsr   r   boolr   r   r    propertyr)   r-   r1   dependent_property
Constraintr6   r:   __classcell__)r   s   @r   r   r      s    !, 4 4{?S?STO MQMM$*M;CD>M	M CG: :-5h-?:	: (f ( (
 f   B& B B
 $[##C7// 7 D7O Or   N)typingr   torchr   torch.distributionsr   torch.distributions.exponentialr   ,torch.distributions.transformed_distributionr   torch.distributions.transformsr   r	   torch.distributions.utilsr
   torch.typesr   __all__r    r   r   <module>rP      s5      + 7 P H 3  *7O$ 7Or   