Ñò
PÇKc           @   sŸ  d  d d d d d d d d d	 d
 d d d d d d d d d d d d g Z  e Z d d k i i Z d d k Z d d d „ Z	 d „  Z
 g  d „ Z g  d „ Z d g  d „ Z d g  d  „ Z d! „  Z g  d" „ Z g  d# „ Z g  d$ „ Z g  d% „ Z g  d& „ Z g  d' „ Z g  d( „ Z g  d) „ Z g  d* „ Z g  d+ „ Z g  d, „ Z g  d- „ Z g  d. „ Z g  d/ „ Z g  d0 „ Z d1 „  Z e  d2 j o e ƒ  n d S(3   t   ArgumentErrort   Ft   betat   binomialt
   chi_squaret   exponentialt   gammat   get_seedt   mean_var_testt   multinomialt   multivariate_normalt   negative_binomialt   noncentral_Ft   noncentral_chi_squaret   normalt   permutationt   poissont   randintt   randomt   random_integerst   seedt   standard_normalt   uniformiÿÿÿÿNi    c         C   s?   |  d j p | d j o t  i ƒ  n t  i |  | f ƒ d  S(   Ni    (   t   mtR   (   t   xt   y(    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyR      s    c           C   s   t  d ‚ d  S(   Nsš   If you want to save the state of the random number generator.
Then you should use obj = numpy.random.get_state() followed by.
numpy.random.set_state(obj).(   t   NotImplementedError(    (    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyR      s    c         C   s$   |  g  j o
 d }  n t i |  ƒ S(   s@   random(n) or random([n, m, ...]) returns array of random numbersN(   t   NoneR   t   random_sample(   t   shape(    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyR      s    
c         C   s*   | g  j o
 d } n t i |  | | ƒ S(   sc   uniform(minimum, maximum, shape=[]) returns array of given shape of random reals
    in given rangeN(   R   R   R   (   t   minimumt   maximumR   (    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyR   !   s    
c         C   s¥   t  |  t ƒ p t d ‚ n | d j o |  } d }  n t  | t ƒ p t d ‚ n | |  t | ƒ } t  | t i ƒ o |  | i t i ƒ S|  t | ƒ Sd S(   sk   randint(min, max, shape=[]) = random integers >=min, < max
    If max not given, random integers >= 0, <mins'   randint requires first argument integeri    s(   randint requires second argument integerN(   t
   isinstancet   intR    R   R   t   npt   ndarrayt   astype(   R   R   R   t   a(    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyR   (   s    
i   c         C   s   t  | |  d | ƒ S(   sR   random_integers(max, min=1, shape=[]) = random integers in range min-max inclusivei   (   R   (   R   R   R   (    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyR   8   s    c         C   s   t  i |  ƒ S(   s2   permutation(n) = a permutation of indices range(n)(   R   R   (   t   n(    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyR   <   s    c         C   s$   |  g  j o
 d }  n t i |  ƒ S(   s¢   standard_normal(n) or standard_normal([n, m, ...]) returns array of
           random numbers normally distributed with mean 0 and standard
           deviation 1N(   R   R   R   (   R   (    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyR   @   s    
c         C   s*   | g  j o
 d } n t i |  | | ƒ S(   sž   normal(mean, std, n) or normal(mean, std, [n, m, ...]) returns
    array of random numbers randomly distributed with specified mean and
    standard deviationN(   R   R   R   (   t   meant   stdR   (    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyR   H   s    
c         C   s*   | g  j o
 d } n t i |  | | ƒ S(   sU  multivariate_normal(mean, cov) or multivariate_normal(mean, cov, [m, n, ...])
    returns an array containing multivariate normally distributed random numbers
    with specified mean and covariance.

    mean must be a 1 dimensional array. cov must be a square two dimensional
    array with the same number of rows and columns as mean has elements.

    The first form returns a single 1-D array containing a multivariate
    normal.

    The second form returns an array of shape (m, n, ..., cov.shape[0]).
    In this case, output[i,j,...,:] is a 1-D array containing a multivariate
    normal.N(   R   R   R
   (   R'   t   covR   (    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyR
   P   s    
c         C   s'   | g  j o
 d } n t i |  | ƒ S(   sŠ   exponential(mean, n) or exponential(mean, [n, m, ...]) returns array
      of random numbers exponentially distributed with specified meanN(   R   R   R   (   R'   R   (    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyR   b   s    
c         C   s*   | g  j o
 d } n t i |  | | ƒ S(   sW   beta(a, b) or beta(a, b, [n, m, ...]) returns array of beta distributed random numbers.N(   R   R   R   (   R%   t   bR   (    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyR   i   s    
c         C   s*   | g  j o
 d } n t i |  | | ƒ S(   sZ   gamma(a, r) or gamma(a, r, [n, m, ...]) returns array of gamma distributed random numbers.N(   R   R   R   (   R%   t   rR   (    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyR   o   s    
c         C   s*   | g  j o
 d } n t i |  | | ƒ S(   s±   F(dfn, dfd) or F(dfn, dfd, [n, m, ...]) returns array of F distributed random numbers with dfn degrees of freedom in the numerator and dfd degrees of freedom in the denominator.N(   R   R   t   f(   t   dfnt   dfdR   (    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyR   u   s    
c         C   s-   | g  j o
 d } n t i |  | | | ƒ S(   s  noncentral_F(dfn, dfd, nonc) or noncentral_F(dfn, dfd, nonc, [n, m, ...]) returns array of noncentral F distributed random numbers with dfn degrees of freedom in the numerator and dfd degrees of freedom in the denominator, and noncentrality parameter nconc.N(   R   R   t   noncentral_f(   R-   R.   t   nconcR   (    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyR   {   s    
c         C   s'   | g  j o
 d } n t i |  | ƒ S(   s   chi_square(df) or chi_square(df, [n, m, ...]) returns array of chi squared distributed random numbers with df degrees of freedom.N(   R   R   t	   chisquare(   t   dfR   (    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyR      s    
c         C   s*   | g  j o
 d } n t i |  | | ƒ S(   sÁ   noncentral_chi_square(df, nconc) or chi_square(df, nconc, [n, m, ...]) returns array of noncentral chi squared distributed random numbers with df degrees of freedom and noncentrality parameter.N(   R   R   t   noncentral_chisquare(   R2   R0   R   (    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyR   ‡   s    
c         C   s*   | g  j o
 d } n t i |  | | ƒ S(   s  binomial(trials, p) or binomial(trials, p, [n, m, ...]) returns array of binomially distributed random integers.

           trials is the number of trials in the binomial distribution.
           p is the probability of an event in each trial of the binomial distribution.N(   R   R   R   (   t   trialst   pR   (    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyR      s    
c         C   s*   | g  j o
 d } n t i |  | | ƒ S(   sI  negative_binomial(trials, p) or negative_binomial(trials, p, [n, m, ...]) returns
           array of negative binomially distributed random integers.

           trials is the number of trials in the negative binomial distribution.
           p is the probability of an event in each trial of the negative binomial distribution.N(   R   R   R   (   R4   R5   R   (    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyR   –   s    
c         C   s*   | g  j o
 d } n t i |  | | ƒ S(   sé  multinomial(trials, probs) or multinomial(trials, probs, [n, m, ...]) returns
           array of multinomial distributed integer vectors.

           trials is the number of trials in each multinomial distribution.
           probs is a one dimensional array. There are len(prob)+1 events.
           prob[i] is the probability of the i-th event, 0<=i<len(prob).
           The probability of event len(prob) is 1.-np.sum(prob).

       The first form returns a single 1-D array containing one multinomially
           distributed vector.

           The second form returns an array of shape (m, n, ..., len(probs)).
           In this case, output[i,j,...,:] is a 1-D array containing a multinomially
           distributed integer 1-D array.N(   R   R   R	   (   R4   t   probsR   (    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyR	       s    
c         C   s'   | g  j o
 d } n t i |  | ƒ S(   s€   poisson(mean) or poisson(mean, [n, m, ...]) returns array of poisson
           distributed random integers with specified mean.N(   R   R   R   (   R'   R   (    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyR   ³   s    
c   
      C   sÜ   t  |  ƒ d } t i |  d d ƒ| } |  | } t i | | d d ƒ| d } d Gt  |  ƒ G| GHd G| Gd G| GHd G| Gd G| GH| g  j oB t i | | | d d ƒd | d	 d
 }	 d G| Gd G|	 GHn d  S(   Ng      ð?t   axisi    s   
Average of s   (should be about s   ):s2   Variance of those random numbers (should be about g     ‡Ã@g      @g       @s2   Skewness of those random numbers (should be about (   t   lenR"   t   sum(
   R   t   typeR'   t   vart   skewR&   t   x_meant   x_minus_meant   x_vart   x_skew(    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyR   »   s    
!-c       	   C   sd  t  i ƒ  }  t  i |  ƒ t  i ƒ  } | d |  d i ƒ  o t d ‚ n d Gt ƒ  GHd Gt i t d ƒ d d ƒd GHt d	 d
 g ƒ } t | i	 ƒ d j p( | i	 d d	 j p | i	 d d
 j o t d ‚ n dB | _	 d Gt i | d d ƒd GHt
 d d dC ƒ } t | i	 ƒ d j p( | i	 d d
 j p | i	 d d	 j o t d ‚ n dD | _	 t i i | ƒ d j p t i i | ƒ d j o t d ‚ n d GHt d d	 d d g ƒGHd Gt d	 ƒ GHd Gt d d ƒ GHd GHt d	 d d g ƒGHd } t d | d	 d
 g ƒ } t | i	 ƒ d j p( | i	 d d	 j p | i	 d d
 j o t d ‚ n dE | _	 t | d | d f d | d d ƒ t d d ƒ } t | d | f | | d d ƒ t t i d	 d g ƒ t i d d g d d  g f ƒ ƒ } d! G| GH| i	 dF j o t d" ‚ n t t i d	 d g ƒ t i d d g d d  g g ƒ d  d g ƒ } d# GH| GH| i	 dG j o t d" ‚ n t t i d$ d d% g ƒ t i d d d g d d d g d d d g g ƒ d ƒ } t i | d d ƒd } d& GH| GH| | } d' GHt i t i | ƒ | ƒ d( GHt d) d* d ƒ } t | d+ d, d- ƒ t d. d d ƒ } t | d/ dH dJ ƒ t d0 d ƒ } t | d1 d2 d3 d t i d d0 ƒ ƒ t d) d* d ƒ } t | d4 d5 d6 ƒ t d7 d ƒ } t | d8 d d d9 ƒ d: GHt d; d d; ƒ GHd< GHt d; d d; g ƒ GHd= GHt  d; d> d d> g d? ƒ } | GHd@ Gt i | d d ƒdA GHd  S(K   Ni   s   Failed seed test.s   First random number iss"   Average of 10000 random numbers isi'  R7   i    g     ˆÃ@i
   iè  i   s   random returned wrong shapes'   Average of 100 by 100 random numbers isg      à?g333333ã?s   uniform returned wrong shapes%   uniform returned out of desired ranges   randint(1, 10, shape=[50])R   i2   s   permutation(10)s   randint(3,9)i   i	   s   random_integers(10, shape=[20])i   g      @g       @s$   standard_normal returned wrong shapes8   normally distributed numbers with mean 2 and variance %fs5   random numbers exponentially distributed with mean %fi   s   
A multivariate normals(   multivariate_normal returned wrong shapes-   A 4x3x2 array containing multivariate normalsiœÿÿÿid   s<   Average of 10000 multivariate normals with mean [-100,0,100]s\   Estimated covariance of 10000 multivariate normals with covariance [[3,2,1],[2,2,1],[1,1,1]]g    €‡Ã@g      @g      $@s   beta(5.,10.) random numbersgZd;ßOÕ?gyé&1¬Œ?g{®Gáz„?s   gamma(.01,2.) random numbersg      &@s5   chi squared random numbers with 11 degrees of freedomi   i   s1   F random numbers with 5 and 10 degrees of freedomg      ô?gš™™™™™õ?g      I@s#   poisson random numbers with mean 50gìQ¸…ëÁ?sG   
Each element is the result of 16 binomial trials with probability 0.5:i   sP   
Each element is the result of 16 negative binomial trials with probability 0.5:sX   
Each row is the result of 16 multinomial trials with probabilities [0.1, 0.5, 0.1 0.3]:gš™™™™™¹?i   s   Mean = g       @(   i'  (   iè  i
   (   i'  (   i'  (   i   (   i   i   i   iÈ   iÈ   i N  (!   R   t	   get_statet	   set_statet   anyt
   SystemExitR   R"   R9   R8   R   R   R   t   reduceR   R   R   R   R   R   R   R
   t   arrayt   dott	   transposeR   R   R   t   sqrtR   R   R   R   R	   (   t   objt   obj2R   R   t   sR=   R>   (    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyt   testÇ   s„    ">	>	2>	%!9	 B Q
't   __main__(!   t   __all__t
   ValueErrorR    t   numpy.random.mtrandR   t   mtrandR   t   numpyR"   R   R   R   R   R   R   R   R   R   R
   R   R   R   R   R   R   R   R   R   R	   R   R   RM   t   __name__(    (    (    sM   P:\graphics\Tools\Python26\Lib\site-packages\numpy\oldnumeric\random_array.pyt   <module>   sB   					
	B