ó
˙ź÷Xc           @` sŹ   d  d l  m Z m Z m Z d  d l Z d  d l m Z m Z m Z m	 Z	 m
 Z
 d  d l m Z d  d l m Z d  d l Z d e f d     YZ e d k r¨ e   n  d S(	   i    (   t   divisiont   absolute_importt   print_functionN(   t   TestCaset   run_module_suitet   assert_t   assert_array_equalt   assert_raises(   t   random(   t   longt   TestRegressionc           B` st   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z RS(   c         C` sq   xj t  j d d d  D]S } t j j | d d  } t t  j | t  j k  oe t  j | t  j k   q Wd  S(   Ng      Ŕg      @i   i   i2   (   t   npt   linspaceR   t   mtrandt   vonmisesR   t   allt   pi(   t   selft   mut   r(    (    sA   /tmp/pip-build-2Vcwy8/numpy/numpy/random/tests/test_regression.pyt   test_VonMises_range   s    c         C` sâ   t  t j t j j d d d d d d k    t  t j t j j d d d d d d k   d d d f g } t j d k } | rą t j d k rą | j d d d f  n  x* | D]" } t  t j j |   d k  q¸ Wd  S(   Ni   i   i   t   sizei
   i   i    i   i   i    t   win32i(   i   iţ˙ i   iţ˙ i   iţ˙ I       I       Iţ˙˙˙˙   I       Iţ˙˙˙˙   I       Iţ˙˙˙˙   (	   R   R   R   R   t   hypergeometrict   syst   maxsizet   platformt   append(   R   t   argst	   is_64bitst   arg(    (    sA   /tmp/pip-build-2Vcwy8/numpy/numpy/random/tests/test_regression.pyt   test_hypergeometric_range   s    11c         C` sŞ   d } t  j j d  t  j j d d | } t  j | d k  t |  } d | } t | d k |  t  j | d k  t |  } d	 | } t | d
 k  |  d  S(   Nič  i    gé?R   i   s"   Frequency was %f, should be > 0.45gÍĚĚĚĚĚÜ?i   s"   Frequency was %f, should be < 0.23gq=
×ŁpÍ?(   R   R   t   seedt	   logseriest   sumt   floatR   (   R   t   Nt   rvsnt   freqt   msg(    (    sA   /tmp/pip-build-2Vcwy8/numpy/numpy/random/tests/test_regression.pyt   test_logseries_convergence#   s    

c         C` s[   t  j j d  t  j j d  } t  j j d  t  j j t d   } t | |  d  S(   NiŇ  i   (   R   R   R    t   permutationR	   R   (   R   t   at   b(    (    sA   /tmp/pip-build-2Vcwy8/numpy/numpy/random/tests/test_regression.pyt   test_permutation_longs3   s
    c         C` sL   t  j d  j } t  j d  j } y t j | |  Wn t  n Xd  S(   Nt   l(   R   t   iinfot   maxt   minR   t   randintt   AssertionError(   R   t   lmaxt   lmin(    (    sA   /tmp/pip-build-2Vcwy8/numpy/numpy/random/tests/test_regression.pyt   test_randint_range:   s    c         C` sŁ   x d d d d  g d d d d  g d d	 d
 d  g d d d d  g g D]X } t j j d  t |  } t j |  t | | d | d | d | d g  qC Wd  S(   Ni   i   i   i90  i    (   i   i   (   i   i   (   i   i   (   i   i   (   i   i   (   i   i   (   t   NoneR   R   R    t   listt   shuffleR   (   R   t   tt   shuffled(    (    sA   /tmp/pip-build-2Vcwy8/numpy/numpy/random/tests/test_regression.pyt   test_shuffle_mixed_dimensionC   s    c         C` sŁ   t  j j   } t  j d d d d d d d d d d g
  } x` t d  D]R } t  j j |  | j d	  t | j d
 d d
 d t  j d
  d |  qI Wd  S(   Ni    i   i   i   i   i	   i   i   iá  i
   R   t   pg      $@(	   R   R   t   RandomStatet   arrayt   rangeR    R   t   choicet   ones(   R   t   mt   rest   i(    (    sA   /tmp/pip-build-2Vcwy8/numpy/numpy/random/tests/test_regression.pyt   test_call_within_randomstateN   s    -c         C` s|   t  j j d g d g g d d t  j j d g d g g d t  j d  t  j j d g d g g d t  j d  d  S(   Ni    R   i   (   R   R   t   multivariate_normalt   int_t   int64(   R   (    (    sA   /tmp/pip-build-2Vcwy8/numpy/numpy/random/tests/test_regression.pyt#   test_multivariate_normal_size_typesX   s    "+c         C` sO   t  j j d  t  j j d d d d } t t  j t  j |   d  d  S(   NiŇIg-Cëâ6?R   id   s   Nans in np.random.beta(   R   R   R    t   betaR   t   anyt   isnan(   R   t   x(    (    sA   /tmp/pip-build-2Vcwy8/numpy/numpy/random/tests/test_regression.pyt   test_beta_small_parameters`   s    c         C` sź   t  j j d  d d d g } d d d g } x t  j t  j t  j f D]m } t  j | d | t |  } t  j j | d | } t	 | | k  t
 t t  j j | d | d qG Wd  S(	   NiŇ  i   i   i   i   t   dtypeR<   gÍĚĚĚĚĚě?(   R   R   R    t   float16t   float32t   float64R>   R"   R@   R   R   t
   ValueError(   R   R*   t   countst   dtt   probst   c(    (    sA   /tmp/pip-build-2Vcwy8/numpy/numpy/random/tests/test_regression.pyt"   test_choice_sum_of_probs_toleranceg   s    c         C` sj   t  j j d  t  j d d d g  } x$ t d  D] } t  j j |  q6 Wd d  l } | j   d  S(   NiŇ  R*   ič  id   i    (   R   R   R    R>   R?   R8   t   gct   collect(   R   R*   t   _RY   (    (    sA   /tmp/pip-build-2Vcwy8/numpy/numpy/random/tests/test_regression.pyt1   test_shuffle_of_array_of_different_length_stringst   s    c         C` sx   t  j j d  t  j t  j d  t  j d  g  } x$ t d  D] } t  j j |  qD Wd d  l } | j   d  S(   NiŇ  i   i   ič  i    (	   R   R   R    R>   t   arangeR?   R8   RY   RZ   (   R   R*   R[   RY   (    (    sA   /tmp/pip-build-2Vcwy8/numpy/numpy/random/tests/test_regression.pyt    test_shuffle_of_array_of_objects   s    '(   t   __name__t
   __module__R   R   R(   R,   R5   R;   RE   RI   RN   RX   R\   R^   (    (    (    sA   /tmp/pip-build-2Vcwy8/numpy/numpy/random/tests/test_regression.pyR
      s   								
				t   __main__(   t
   __future__R    R   R   R   t   numpy.testingR   R   R   R   R   t   numpyR   t   numpy.compatR	   R   R
   R_   (    (    (    sA   /tmp/pip-build-2Vcwy8/numpy/numpy/random/tests/test_regression.pyt   <module>   s   (