
\K]c           @` s  d  d l  m Z m Z m Z d  d l Z d  d l Z d  d l Z d  d l m	 Z	 m
 Z
 m Z m Z m Z m Z d  d l m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z d  d l m Z d  d l m Z m  Z  d  d l! Z! d  d l" Z" d  d l# m$ Z$ d  d l% j& j' Z( d  d l) Z) d Z* d  Z+ e j, g Z- i  Z. d	 d
 d d g Z/ d d g Z0 d d d d d g Z1 d d d d d d d g Z2 d d d d d d  d! d" g Z3 e0 e1 e2 e3 d# d$ g Z4 e$ d%    Z5 e$ d&    Z6 d' e7 f d(     YZ8 d) e8 f d*     YZ9 d+ e9 f d,     YZ: d- e7 f d.     YZ; d/ e7 f d0     YZ< e= e j> j? j@    e jA g ZB e jC j? j@   ZD e jE j? j@   ZF g  e jG D] ZH eH jI ^ qZJ d S(1   i    (   t   print_functiont   divisiont   absolute_importN(   t   irt   analysist   typest   configt   cgutilst   typing(   t   mk_unique_vart   replace_vars_innert   find_topo_ordert   dprint_func_irt   get_global_func_typt   guardt   requiret   get_definitiont   find_callnamet   find_build_sequencet
   find_constt   is_namedtuple_classt   build_definitions(   t   compute_cfg_from_blocks(   t   npydeclt	   signature(   t	   intrinsicit   emptyt   zerost   onest   fullt   randt   randnt   ranft   random_samplet   samplet   randomt   standard_normalt	   chisquaret   weibullt   powert	   geometrict   exponentialt   poissont   rayleight   normalt   uniformt   betat   binomialt   ft   gammat	   lognormalt   laplacet   randintt
   triangularc         C` s:   | | k r t  d   n  d   } t | | |  | f S(   sV  
    Calculate index value "idx" relative to a size "size" value as
    (idx % size), where "size" is known to be positive.
    Note that we use the mod(%) operation here instead of
    (idx < 0 ? idx + size : idx) because we may have situations
    where idx > size due to the way indices are calculated
    during slice/range analysis.
    s(   Argument types for wrap_index must matchc         S` s   t  |  d k s t  | d } | d } | j | |  } t j j | j d  } | j d | |  } | j | |  }	 | j d |	 |  }
 | j	 | |	 | j	 |
 | |	   } | S(   Ni   i    i   t   <t   >(
   t   lent   AssertionErrort   sremt   llvmliteR   t   Constantt   typet   icmp_signedt   addt   select(   t   contextt   buildert   sigt   argst   idxt   sizet   remt   zerot   is_negativet   wrapped_remt   is_oversizet   mod(    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   codegenJ   s    

(   t
   ValueErrorR   (   t	   typingctxRE   RF   RM   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt
   wrap_index=   s    
	c         G` s   t  |  d k r' t j |  f } n  t  | d  d k sC t  t t d   | d d   si t  d   } t t j |  | f S(   s   
    A function that asserts the inputs are of equivalent size,
    and throws runtime error when they are not. The input is
    a vararg that contains an error message, followed by a set
    of objects of either array, tuple or integer.
    i   i    c         S` sF   t  |  t j  pE t  |  t j  pE t  |  t j  pE t  |  t j  S(   N(   t
   isinstanceR   t   ArrayCompatiblet	   BaseTuplet	   SliceTypet   Integer(   t   a(    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   <lambda>i   s   c   	      ` s   t  |  d k s t  t j   | d  } | j d } | j d d j     f d         f d   } xL t d t  |  d  D]1 } | | | | | | | d | | d  q W j   t j	 d   } | S(   Ni   i    c         ` sm   t  | t j  r@  j |     |   } t j   | j  St  | t j  rb t j   |   S|  g Sd  S(   N(   RQ   R   RR   t
   make_arrayR   t   unpack_tuplet   shapeRS   (   RV   t   atyt   ary(   RB   RA   (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   unpack_shapest   s    c         ` s    |  |  }  | |  } t  |  t  |  k s< t  x t | |  D]u \ } }   j t j | |  }   j |  @ \ }	 }
 |	  Wd  QX|
   j j   t  f  Wd  QXWd  QXqL Wd  S(   N(	   R8   R9   t   zipt   icmpt   lct   ICMP_EQt   if_elset	   call_convt   return_user_exc(   RV   R[   t   bt   btyt   ashapest   bshapest   mt   nt   m_eq_nt   thent   orelse(   RB   RA   t   msgR]   (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   pairwise}   s    	(   R8   R9   R   RY   RD   t   literal_valuet   ranget   get_constant_genericR   t   NoneTypet   None(	   RA   RB   RC   RD   t   tupt   tup_typeRo   t   it   r(    (   RB   RA   Rn   R]   s3   lib/python2.7/site-packages/numba/array_analysis.pyRM   n   s    	 /(   R8   R   t   TupleR9   t   allt   mapR   t   none(   RO   t   valRM   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   assert_equivY   s    	 t   EquivSetc           B` s   e  Z d  Z d d d d  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(   sP   EquivSet keeps track of equivalence relations between
    a set of objects.
    i    c         C` s7   | r | n i  |  _  | r! | n i  |  _ | |  _ d S(   sd   Create a new EquivSet object. Optional keyword arguments are for
        internal use only.
        N(   t
   obj_to_indt
   ind_to_objt   next_ind(   t   selfR   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   __init__   s    c         C` s   t    S(   s)   Return an empty EquivSet object.
        (   R   (   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR      s    c         C` s4   t  d t j |  j  d t j |  j  d |  j  S(   s   Return a new copy.
        R   R   t   next_id(   R   t   copyt   deepcopyR   R   R   (   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   clone   s    c         C` s   d j  |  j  S(   Ns   EquivSet({})(   t   formatR   (   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   __repr__   s    c         C` s   |  j  i  k S(   s=   Return true if the set is empty, or false otherwise.
        (   R   (   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   is_empty   s    c         C` s   |  j  j | d  S(   sk   Return the internal index (greater or equal to 0) of the given
        object, or -1 if not found.
        i(   R   t   get(   R   t   x(    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _get_ind   s    c         C` s;   | |  j  k r |  j  | } n |  j } |  j d 7_ | S(   sy   Return the internal index (greater or equal to 0) of the given
        object, or create a new one if not found.
        i   (   R   R   (   R   R   Rw   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _get_or_add_ind   s
    	c         ` s?  t  |  d k s t  t   f d   | D  } t |  } |   j k r_ g    j | <n  x t | |  D] \ } } | | k r |   j | k r7  j | j |  |   j | <q7qo |   j k rx6   j | D]' } |   j | <  j | j |  q W  j | =qo |   j | <  j | j |  qo Wd S(   sX   Base method that inserts a set of equivalent objects by modifying
        self.
        i   c         3` s   |  ] }   j  |  Vq d  S(   N(   R   (   t   .0R   (   R   (    s3   lib/python2.7/site-packages/numba/array_analysis.pys	   <genexpr>   s    N(   R8   R9   t   tuplet   minR   R^   t   appendR   (   R   t   objst   indst   indRw   t   objR   (    (   R   s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _insert   s"    c         ` s   g  | D] } |  j  |  ^ q } t |      d k rT t   f d   | D  St g  | D] } | | d k ^ q^  Sd S(   sf   Try to derive if given objects are equivalent, return true
        if so, or false otherwise.
        ic         3` s   |  ] } |   k Vq d  S(   N(    (   R   Rw   (   R   (    s3   lib/python2.7/site-packages/numba/array_analysis.pys	   <genexpr>   s    i    N(   R   t   maxRz   (   R   R   R   R   (    (   R   s3   lib/python2.7/site-packages/numba/array_analysis.pyt   is_equiv   s
    "c         C` sS   |  j  |  } | d k rO |  j | } x$ | D] } t | t  r/ | Sq/ Wn  d S(   sv   Check if obj is equivalent to some int constant, and return
        the constant if found, or None otherwise.
        i    N(   R   R   RQ   t   intRt   (   R   R   R   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   get_equiv_const   s    c         C` s3   |  j  |  } | d k r, t |  j |  St   S(   s.   Return the set of equivalent objects.
        i    (   R   t   setR   (   R   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   get_equiv_set   s    c         G` s   |  j  |  d S(   s   Insert a set of equivalent objects by modifying self. This
        method can be overloaded to transform object type before insertion.
        N(   R   (   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   insert_equiv  s    c   	      ` s     j    }   j | _ x | j j   D] } t   f d   | D  } i  } xY t | |  D]H \ } } | | k r | | j |  q` | d k r` | g | | <q` q` Wx6 | j   D]( } t |  d k r | j |  q q Wq( W| S(   s    Return the intersection of self and the given equiv_set,
        without modifying either of them. The result will also keep
        old equivalence indices unchanged.
        c         3` s   |  ] }   j  |  Vq d  S(   N(   R   (   R   R   (   R   (    s3   lib/python2.7/site-packages/numba/array_analysis.pys	   <genexpr>  s    i    i   (	   R   R   R   t   valuesR   R^   R   R8   R   (	   R   t	   equiv_sett   new_setR   R   R   Rw   R   t   v(    (   R   s3   lib/python2.7/site-packages/numba/array_analysis.pyt	   intersect  s    N(   t   __name__t
   __module__t   __doc__Rt   R   R   R   R   R   R   R   R   R   R   R   R   R   (    (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR      s   											t   ShapeEquivSetc           B` s   e  Z d  Z d d d d d d  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 d   Z d   Z d   Z d   Z d   Z RS(   sd  Just like EquivSet, except that it accepts only numba IR variables
    and constants as objects, guided by their types. Arrays are considered
    equivalent as long as their shapes are equivalent. Scalars are
    equivalent only when they are equal in value. Tuples are equivalent
    when they are of the same size, and their elements are equivalent.
    i    c         C` sS   | |  _  | r | n i  |  _ | r* | n i  |  _ t t |   j | | |  d S(   s   Create a new ShapeEquivSet object, where typemap is a dictionary
        that maps variable names to their types, and it will not be modified.
        Optional keyword arguments are for internal use only.
        N(   t   typemapt   defst
   ind_to_vart   superR   R   (   R   R   R   R   R   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR   .  s    	c         C` s   t  |  j i   S(   s'   Return an empty ShapeEquivSet.
        (   R   R   (   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR   @  s    c         C` s^   t  |  j d t j |  j  d t j |  j  d t j |  j  d t j |  j  d |  j S(   s   Return a new copy.
        R   R   R   R   R   (	   R   R   R   R   R   R   R   R   R   (   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR   E  s    	c         C` s   d j  |  j |  j  S(   Ns    ShapeEquivSet({}, ind_to_var={})(   R   R   R   (   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR   P  s    c         ` sd  t  | t j  s! t  | t  r t  | t  r6 | n | j    j   } t  | t j  sp t  | t j  r t  | t j  r | j	 n	 t
 |  } | d k r d St   f d   t |  D  Sq`  f Sn t  | t j  rt  | j t  r | j S| j f SnT t  | t  r5t  f d   | D  St  | t  rK| f St d j |    d S(   s   Return a set of names for the given obj, where array and tuples
        are broken down to their individual shapes or elements. This is
        safe because both Numba array shapes and Python tuples are immutable.
        i    c         3` s!   |  ] } d  j    |  Vq d S(   s   {}#{}N(   R   (   R   Rw   (   t   name(    s3   lib/python2.7/site-packages/numba/array_analysis.pys	   <genexpr>c  s    c         3` s"   |  ] }   j  |  d  Vq d S(   i    N(   t
   _get_names(   R   R   (   R   (    s3   lib/python2.7/site-packages/numba/array_analysis.pys	   <genexpr>l  s    s!   ShapeEquivSet does not support {}N(    (   RQ   R   t   Vart   strR   R   R   RS   RR   t   ndimR8   R   Rq   t   Constt   valueR   t   NotImplementedErrorR   (   R   R   t   typR   (    (   R   R   s3   lib/python2.7/site-packages/numba/array_analysis.pyR   T  s*    !#
c         ` s7  t  |  d k s t  g  | D] } |  j |  ^ q } g  | D] } | d k rA | ^ qA } t  |  d k ru t Sg  | D] } t  |  ^ q| } | d   t   f d   | D  s t j d k r t d j |   n  t SxM t	    D]? } g  | D] } | | ^ q } t
 t |   j |   s t Sq Wt S(   sW   Overload EquivSet.is_equiv to handle Numba IR variables and
        constants.
        i   i    c         3` s   |  ] }   | k Vq d  S(   N(    (   R   R   (   R   (    s3   lib/python2.7/site-packages/numba/array_analysis.pys	   <genexpr>~  s    s#   is_equiv: Dimension mismatch for {}(    (   R8   R9   R   t   FalseRz   R   t   DEBUG_ARRAY_OPTt   printR   Rq   R   R   R   t   True(   R   R   R   t	   obj_namest   namest   ndimsRw   t   obj_name(    (   R   s3   lib/python2.7/site-packages/numba/array_analysis.pyR   s  s     "%
c         C` s?   |  j  |  } t |  d k r% d St t |   j | d  S(   st   If the given object is equivalent to a constant scalar,
        return the scalar value, or None otherwise.
        i   i    N(   R   R8   Rt   R   R   R   (   R   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR     s    c         C` se   |  j  |  } t |  d k r% d S|  j | d  } |  j j | g   } | g  k ra | d Sd S(   st   If the given object is equivalent to some defined variable,
        return the variable, or None otherwise.
        i   i    N(   R   R8   Rt   R   R   R   (   R   R   R   R   t   vs(    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   get_equiv_var  s    c         C` s?   |  j  |  } t |  d k r% d St t |   j | d  S(   s.   Return the set of equivalent objects.
        i   i    N(   R   R8   Rt   R   R   R   (   R   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR     s    c   	      C` s  g  } x4 | D], } | |  j  k r | j |  j  |  q q Wg  } t   } x[ t |  D]M } xD |  j | D]5 } | j | k rm | j |  | j | j  qm qm WqY Wt t |   j	 |  |  j  | d } x t |  D] } |  j | =q W| |  j | <d S(   sC   Overload EquivSet._insert to manage ind_to_var dictionary.
        i    N(
   R   R   R   t   sortedR   R   R?   R   R   R   (	   R   R   R   R   t   varlistR   Rw   R   t   new_ind(    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR     s     	c         ` s[  t  |  d k s t  g  | D] } |  j |  ^ q } g  | D] } | d k rA | ^ qA } t  |  d k ru d St g  | D] } t |  ^ q g   } g  | D] } t  |  ^ q } | d   t   f d   | D  s t d j |    g  } x | D] } t | t  s%| f } n  xd | D]\ } t | t	 j
  r,| j | k r,| j |  j k rx| j d |  q| j |  q,q,WqWxz | D]r } | j }	 |	 | k r|	 |  j k r|	 g |  j |  j <|  j |  j |	 <| g |  j |  j <|  j d 7_ qqWxG t    D]9 }
 g  | D] } | |
 ^ q'} t t |   j |   qWd S(   s   Overload EquivSet.insert_equiv to handle Numba IR variables and
        constants. Input objs are either variable or constant, and at least
        one of them must be variable.
        i   Ni    c         3` s   |  ] }   | k Vq d  S(   N(    (   R   R   (   R   (    s3   lib/python2.7/site-packages/numba/array_analysis.pys	   <genexpr>  s    s   Dimension mismatch for {}(    (   R8   R9   R   t   sumt   listRz   R   RQ   R   R   R   R   R   t   insertR   R   R   R   R   Rq   R   R   R   (   R   R   R   R   R   R   R   R   t   varR   Rw   R   (    (   R   s3   lib/python2.7/site-packages/numba/array_analysis.pyR     s:    "%(
!	c         C` s   |  j  |  d k S(   sE   Return true if the shape of the given variable is available.
        N(   t	   get_shapeRt   (   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt	   has_shape  s    c         C` s   t  |  j |  S(   st   Return a tuple of variables that corresponds to the shape
        of the given array, or None if not found.
        (   R   t
   _get_shape(   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR     s    c         C` s   |  j  |  } t | d k  g  } xO | D]G } t | |  j k  |  j | } t | g  k  | j | d  q, Wt |  S(   s   Return a tuple of variables that corresponds to the shape
        of the given array, or raise GuardException if not found.
        i    (    (   t   get_shape_classesR   R   R   R   (   R   R   R   RZ   Rw   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR     s    c         ` s   t  | t j  r | j } n  |   j k r:   j | n d } t  | t j  ps t  | t j  ps t  | t j	  sz g  S  j
 |  } t   f d   | D  } | S(   s   Instead of the shape tuple, return tuple of int, where
        each int is the corresponding class index of the size object.
        Unknown shapes are given class index -1. Return empty tuple
        if the input name is a scalar variable.
        c         3` s   |  ] }   j  |  Vq d  S(   N(   R   (   R   R   (   R   (    s3   lib/python2.7/site-packages/numba/array_analysis.pys	   <genexpr>  s    N(   RQ   R   R   R   R   Rt   R   RS   RT   RR   R   R   (   R   R   R   R   R   (    (   R   s3   lib/python2.7/site-packages/numba/array_analysis.pyR     s    "c         C` sE  t  t |   j |  } i  } x| j j   D]\ } } t |  d k sR t  | d } | |  j k sq t  | | j k s t  |  j | } | j | } | |  j k s t  | | j k s t  g  }	 g  | j | D] }
 |
 j	 ^ q } x4 |  j | D]% }
 |
 j	 | k r|	 j
 |
  qqW|	 | | <q. W| | _ | S(   s<   Overload the intersect method to handle ind_to_var.
        i    (   R   R   R   R   t   itemsR8   R9   R   R   R   R   (   R   R   t   newsetR   Rw   R   R   t   jt   kR   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR     s&    
#	c         C` ss  t  | t j  r | j } n  | |  j k rb|  j | c d 7<| |  j k ro|  j | } |  j | =|  j | j |  |  j | g  k r |  j | =n  | |  j k s t	  g  |  j | D] } | j ^ q } | | k r_| j
 |  } |  j | | =|  j | g  k r\|  j | =| |  j k rYx |  j | D] } |  j | =q5W|  j | =qYq\q_qon d |  j | <d S(   s  Increment the internal count of how many times a variable is being
        defined. Most variables in Numba IR are SSA, i.e., defined only once,
        but not all of them. When a variable is being re-defined, it must
        be removed from the equivalence relation.
        i   N(   RQ   R   R   R   R   R   R   t   removeR   R9   t   index(   R   R   Rw   R   R   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   define  s,    
#
c         C` s=   x6 | j    D]( \ } } | d k r |  j |  q q Wd S(   s   Union with the given defs dictionary. This is meant to handle
        branch join-point, where a variable may have been defined in more
        than one branches.
        i    N(   R   R   (   R   R   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt
   union_defsA  s    N(   R   R   R   Rt   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   (    (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR   %  s(   											&						"t   SymbolicEquivSetc        	   B` s   e  Z d  Z d d d d d d d d d  Z d   Z d   Z d   Z d   Z d d  Z	 d d d  Z
 d	   Z d
   Z d   Z RS(   s/  Just like ShapeEquivSet, except that it also reasons about variable
    equivalence symbolically by using their arithmetic definitions.
    The goal is to automatically derive the equivalence of array ranges
    (slicing). For instance, a[1:m] and a[0:m-1] shall be considered
    size-equivalence.
    i    c
   
      C` sz   | r | n i  |  _  | r! | n i  |  _ | r6 | n i  |  _ i  |  _ i  |  _ t t |   j | | | | | |	  d S(   s   Create a new SymbolicEquivSet object, where typemap is a dictionary
        that maps variable names to their types, and it will not be modified.
        Optional keyword arguments are for internal use only.
        N(   t   def_byt   ref_byt
   ext_shapest   rel_mapt   wrap_mapR   R   R   (
   R   R   R   R   R   R   R   R   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR   S  s    
		c         C` s   t  |  j  S(   s*   Return an empty SymbolicEquivSet.
        (   R   R   (   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR   v  s    c         C` s(   d j  |  j |  j |  j |  j |  j  S(   NsH   SymbolicEquivSet({}, ind_to_var={}, def_by={}, ref_by={}, ext_shapes={})(   R   R   R   R   R   R   (   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR   {  s    c         C` s   t  |  j d t j |  j  d t j |  j  d t j |  j  d t j |  j  d t j |  j  d t j |  j	  d t j |  j
  d |  j S(	   s   Return a new copy.
        R   R   R   R   R   R   R   R   (   R   R   R   R   R   R   R   R   R   R   R   R   (   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR     s    	c         C` s   t  |  j |  S(   sj   Retrieve a definition pair for the given variable,
        or return None if it is not available.
        (   R   t   _get_or_set_rel(   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   get_rel  s    c         ` s  t  | t j  r | j } n  t  j j | d  d k  |  j k rW  j | St | d k  d       f d     t	 | |  } | d f } t  | t j
  r| j d k rzt | | d  j \ } } | d k r| d k rt  f d	   | j D  } d
 | k r#d S j j | g   } | j |  t |  d k rg j |  n  |  j | <qq1| j d k r1 j | j |  }	  j | j |  }
 | j t j k r |	 |
  } q| j t j k r  |	 |
  } qq1n0 t  | t j  r1t  | j t  r1| j } n  t | d k  |  j | <t  | t  st  | t  r| d | k s| d d k rt  | t  r| \ } } |  j k rg   j | <n   j | j | | f   j |  } | d k r j  | } g  } xW | D]O } |  j k r| g   j | D] \ } } | | k r<| ^ q<7} qqWt |  d k rt! t"   j |  qqqn  | Sd S(   s   Retrieve a definition pair for the given variable,
        and if it is not already available, try to look it up
        in the given func_ir, and remember it for future use.
        i    i   c         S` sw   t  |  t  } t  | t  } | rO | r2 |  | S| \ } } | |  | f Sn$ |  \ } } | ro | | | f Sd  Sd  S(   N(   RQ   R   Rt   (   R   t   yt
   x_is_constt
   y_is_constR   t   offset(    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   plus  s    c         ` sl   t  | t  r  |  |  St  |  t  rd t  | t  rd |  d | d k rd   |  d | d  Sd  Sd  S(   Ni    i   (   RQ   R   R   Rt   (   R   R   (   t   minusR   (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR     s    t   callR   RP   s   numba.array_analysisc         3` s'   |  ] }   j  j | j d   Vq d S(   iN(   R   R   R   (   R   R   (   R   (    s3   lib/python2.7/site-packages/numba/array_analysis.pys	   <genexpr>  s   it   binopN(#   RQ   R   R   R   R   R   R   R   Rt   R   t   Exprt   opR   R   R   RD   R   R   R8   R   R   t   lhst   rhst   fnt   operatorR?   t   subR   R   R   R   R   R   R   R   (   R   R   t   func_irt   exprR   t   fnamet   mod_nameR   R   R   R   R   R   R   R   R   R   Rw   (    (   R   R   R   s3   lib/python2.7/site-packages/numba/array_analysis.pyR     sj    	$ !"c         C` s7  t  | t j  r | j } n | } t t |   j |  | r3|  j j | d  d k r3t  | t	 j
  r3t |  j | |  } t  | t  r |  j | | g  n  t  | t j  r3|  j |  } | |  j k r | g |  j | <| |  j | <n  | |  j k r|  j | j |  q0| g |  j | <q3n  d S(   sf  Besides incrementing the definition count of the given variable
        name, it will also retrieve and simplify its definition from func_ir,
        and remember the result for later equivalence comparison. Supported
        operations are:
          1. arithmetic plus and minus with constants
          2. wrap_index (relative to some given size)
        i    i   N(   RQ   R   R   R   R   R   R   R   R   R   t   NumberR   R   R   R   R   R   R   R   R   (   R   R   R   R   R   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR     s"    !c         C` s  t    } t    } xb | D]Z } |  j |  } | d k rJ | j |  q | | k r | j |  | j |  q q Wt |  d k r d St |  } t t |   j |  |  j |  j | d  } i  } d   } x | D] } | |  j	 k r|  j	 | } t
 | t  r| \ }	 }
 | | |
  j |	  |	 |  j k rx9 |  j |	 D]' \ } } | | |
 |  j |  qPWqqn  | |  j k r x4 |  j | D]" \ }	 }
 | | |
  j |	  qWq q Wx! | j   D] } |  j |  qWd S(   sX   Overload _insert method to handle ind changes between relative
        objects.
        ii   Ni    c         S` s-   | |  k r |  | } n g  } | |  | <| S(   N(    (   t   dR   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt
   get_or_set  s
    
(   R   R   R?   R8   R   R   R   R   R   R   RQ   R   R   R   R   (   R   R   t   indsett   uniqsR   R   t   offset_dictR   R   R   R   R   Rw   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR     s<    			(!c         C` s;   t  | t j  s* t  | t j  s* t  | |  j | <d S(   s-   remember shapes of SetItem IR nodes.
        N(   RQ   R   t   StaticSetItemt   SetItemR9   R   (   R   R   RZ   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   set_shape_setitem0  s    *c         C` s   t  | t j  s$ t  | t j  rB t | |  j k  |  j | St  | t j  sZ t  |  j | j	 } t  | t
 j  r | f St t |   j |  Sd S(   sG   Overload _get_shape to retrieve the shape of SetItem IR nodes.
        N(   RQ   R   R   R   R   R   R   R9   R   R   R   RT   R   R   R   (   R   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR   6  s    $N(   R   R   R   Rt   R   R   R   R   R   R   R   R   R   R   (    (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR   J  s   		!				T	+	t   WrapIndexMetac           B` s   e  Z d  Z d   Z RS(   s  
      Array analysis should be able to analyze all the function
      calls that it adds to the IR.  That way, array analysis can
      be run as often as needed and you should get the same
      equivalencies.  One modification to the IR that array analysis
      makes is the insertion of wrap_index calls.  Thus, repeated
      array analysis passes should be able to analyze these wrap_index
      calls.  The difficulty of these calls is that the equivalence
      class of the left-hand side of the assignment is not present in
      the arguments to wrap_index in the right-hand side.  Instead,
      the equivalence class of the wrap_index output is a combination
      of the wrap_index args.  The important thing to
      note is that if the equivalence classes of the slice size
      and the dimension's size are the same for two wrap index
      calls then we can be assured of the answer being the same.
      So, we maintain the wrap_map dict that maps from a tuple
      of equivalence class ids for the slice and dimension size
      to some new equivalence class id for the output size.
      However, when we are analyzing the first such wrap_index
      call we don't have a variable there to associate to the
      size since we're in the process of analyzing the instruction
      that creates that mapping.  So, instead we return an object
      of this special class and analyze_inst will establish the
      connection between a tuple of the parts of this object
      below and the left-hand side variable.
    c         C` s   | |  _  | |  _ d  S(   N(   t
   slice_sizet   dim_size(   R   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR   `  s    	(   R   R   R   R   (    (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR   E  s   t   ArrayAnalysisc           B` s   e  Z d  Z d   Z d   Z dW dW d  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 d   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 d   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, d*   Z- d+   Z. d,   Z/ d-   Z0 d.   Z1 d/   Z2 d0   Z3 d1   Z4 d2   Z5 d3   Z6 d4   Z7 d5   Z8 d6   Z9 d7   Z: d8   Z; d9   Z< d:   Z= d;   Z> d<   Z? d=   Z@ d>   ZA d?   ZB d@   ZC dA   ZD dB   ZE dC   ZF dD   ZG dE   ZH dF   ZI dG   ZJ dH   ZK dI   ZL dJ   ZM dK   ZN dL   ZO dM   ZP dN   ZQ dO   ZR dP   ZS dQ   ZT dW dR  ZU dW dS  ZV dT   ZW dU   ZX dV   ZY RS(X   s#  Analyzes Numpy array computations for properties such as
    shape/size equivalence, and keeps track of them on a per-block
    basis. The analysis should only be run once because it modifies
    the incoming IR by inserting assertion statements that safeguard
    parfor optimizations.
    c         C` sL   | |  _  | |  _ | |  _ | |  _ i  |  _ i  |  _ i  |  _ i  |  _ d  S(   N(   RA   R   R   t	   calltypest
   equiv_setst   array_attr_callst   prependst   pruned_predecessors(   R   RA   R   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR   m  s    							c         C` s   |  j  | S(   sA   Return the equiv_set object of an block given its label.
        (   R   (   R   t   block_label(    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR   |  s    c         C` s  | d k r |  j j } n  t |  j j  |  j _ | d k rQ t |  j  } n | } t |  j d |  t j	 d k r t
 d t |  j j     t
 d |  j  n  t |  } t | d | } x| D]} | | } | j } g  }	 d } | j |  }
 | |  j k r |  j | } n g  } x |
 D] \ } } | | k rKq-n  | |  j k r-|  j | j   } | | f |  j k r|  j | | f } x' | D] } |  j | | | |  qWn  | d k r| } q| j |  } | j | j  q-q-W| d k r| } n  | |  j | <xx | j D]m } |  j | | | |  \ } } x | D] } |	 j |  qQW|	 j |  x | D] } |	 j |  q|Wq&W|	 | _ q Wt j	 d k r|  j   t
 d t |  j j     t
 d |  j  n  t |  j d |  d S(   s   run array shape analysis on the given IR blocks, resulting in
        modified IR and finalized EquivSet for each block.
        s   before array analysisi   s   variable types: s   call types: t   cfgs   after array analysisN(   Rt   R   t   blocksR   t   _definitionsR   R   R   R   R   R   R   R   R   R   R   t   scopet   predecessorsR   R   R   R   t   _analyze_instR   R   R   t   bodyR   t   dump(   R   R  R   t   init_equiv_setR  t
   topo_ordert   labelt   blockR  t   new_bodyt   predst   prunedt   pt   qt   from_sett   instrst   instt   pret   postt   instr(    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   run  sd    
			
c         C` s   t  d |  j  d S(   s@   dump per-block equivalence sets for debugging purposes.
        s   Array Analysis: N(   R   R   (   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR    s    c         C` s@   | |  j  | j <| g |  j j | j <| j | |  j |  d  S(   N(   R   R   R   R  R   (   R   R   R   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _define  s    c   &      ` s  g  } g  } t  | t j  r0| j } |  j | j } d  }	 t  | t j  rg | j	 d k rg d	 }	 n t  | j
 t j  r |  j | | | j
  }
 |
 r|
 d }	 |
 d } t |
  d k r |
 d } | | _
 q qn6 t  | j
 t j  st  | j
 t j  r| j
 }	 n  t  |	 t j  rt  |	 j
 t  ra|	 j   t   f d   |	 j
 D  }	 q+t  |	 j
 t  r|	 f }	 q+d  }	 n t  |	 t j  rt  |  j |	 j t j  r|	 f }	 ni t  |	 t  r+| j | |  j |  | j | j  } | d k r!| | j |	 j |	 j f <n  | | f St  | t j  r|	 d  k szt  |	 t  szt  |	 t j  r| j |	  r|  j | | | j	 |	  \ }	 } qnW t  | t j  r|	 rt  | j t j  r|  j | | t |  |	  \ }	 } qn  |	 d  k r| j | |	  n  | j | |  j |  nt  | t j   sTt  | t j!  rt  | t j!  ro| j" n | j# } t$ |  j% | | | j |  }
 |
 sg  g  f S|
 d d  k	 r|
 d | _# n  |
 d }
 |
 \ } } | j& | j
  } | d
 k r| j' | |  | g  f S| d  k r|  j | j j } t( t  | t j   | j	 } | | g } | j j | j
 j g } |  j) | | | j | |  \ }	 } t |	  } | | k st*  | j' | |	  | | g  f S| g  f Snt  | t j+  ry| j, } t$ t- |  j |  } | sE| j. |  } g  } x | D] } t  | t/  r| |  j k rt$ t- |  j | d t0 } t  | t j  r| j } n  | r| j1 |  qq5| j1 |  q5Wt2 t3 d   |   } t2 |  j4 |  } t |  d k rt5 |  d } qEt |  d k rEt$ t- |  j t5 |  d  } qEn  t  | t j  r| j6 d k rd  } | j7 t8 j9 k r| j: } | j; } d }  n- | j7 t8 j< k r| j; } | j: } d }  n  |  j | j= j }! |  j | j> j }" | d  k rvt  |! t j  rt  |" t j  s@t  |! t j?  rvt  |" t j?  rv| j   | j= | j> f }# |  j@ |   | |#  } | j1 t j t j |     |     | |  jA | | f <t j t j d |     |    g |  jA | | f <qvqt  | t j  r| j
 } n  t  | t  s%t  | tB  r| r4| j; n | j: }$ |$ |  jC k rc|  jC |$ j1 |  qv| g |  jC |$ <qnC tD |  tE k rtE tD |  }% |% | | |  j |   \ } } n  | | f S(   Ni    i   i   c         3` s!   |  ] } t  j |    Vq d  S(   N(   R   R   (   R   R   (   t   loc(    s3   lib/python2.7/site-packages/numba/array_analysis.pys	   <genexpr>  s    it   lhs_onlyc         S` s   t  |  t  S(   N(   RQ   R   (   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyRW   A  t    R   (    (    (F   RQ   R   t   Assignt   targetR   R   Rt   R   RR   R   R   R   t   _analyze_exprR8   R   R   R   R  R   RU   R   R   R   R   R   R   R   R   t   _gen_shape_callt   UniTuplet   dtypeR   R   R   R   t	   index_varR   t   _index_to_shapeR   R   R   t   _broadcast_assert_shapesR9   t   Brancht   condR   R   R   R   R   R   t   filtert
   differenceR   R   R   R   t   eqt   truebrt   falsebrt   neR   R   RS   t   _make_assert_equivR   t   boolR   R=   t   array_analysis_extensions(&   R   R  R  R   R  R  R  R   R   RZ   t   resultR   t   lhs_indR   t   target_shapet   value_shapet
   target_typt   target_ndimt   shapesR   t   assertsRj   t   cond_vart   cond_deft   equivsR   R   t   var_deft   defvarst	   defconstst   brt   otherbrt   cond_valt   lhs_typt   rhs_typRD   t	   pruned_brR0   (    (   R  s3   lib/python2.7/site-packages/numba/array_analysis.pyR    s
   	!	


	"	
$$	


			!							";!c         C` sM   d j  | j  } y t |  |  } Wn t k
 r9 d  SXt | | | |  S(   Ns   _analyze_op_{}(   R   R   t   getattrt   AttributeErrorRt   R   (   R   R  R   R   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR  t  s    c         C` so   | j  d k r@ |  j | j j  r@ |  j | | | j g i   S| j  d k rk | j | j  } | g  f Sd  S(   Nt   TRZ   (   t   attrt   _isarrayR   R   t    _analyze_op_call_numpy_transposeR   Rt   (   R   R  R   R   RZ   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_getattr|  s    $
c         C` s   | j  g  f S(   N(   R   (   R   R  R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_cast  s    c         C` se   | j  } |  j | j } t | t j  ra t t |  | j k  t | j	 |   | g  f Sd  S(   N(   R   R   R   RQ   R   RS   R   R8   t   countR   Rt   (   R   R  R   R   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_exhaust_iter  s    	
c
         C` s   t  j | t d  |  }
 t  j j t j | | d | } t | t  ra t	 j
 | |  } n	 t	 j } t | | |  |  j | <| j t  j d | d |
 d |   |  j |	 |
 | |  |
 | f S(   Nt   explicit_negR  R   R  (   R   R   R	   R   R   R   R?   RQ   R   R   t   IntegerLiteralt   intpR   R   R   R  R  (   R   t   argt   arg_relt   arg_typt   size_typR  R  t   dsizet   stmtsR   t   explicit_neg_vart   explicit_neg_valt   explicit_neg_typ(    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   gen_explicit_neg  s    !	%c   $      C` sc  | j  } t |  j |  } t |  j | d |  j \ } }	 t | d k oT |	 d" k  t t | j  d k  | j d }
 | j d } |  j | j } |  j |
 j } |  j | j } t	 j
 d k rt d d	 | d
 | d | d |
 d | d | d | d |  n  t | t j  rt j | t d  |  } t j d |  } | j t j d | d | d |   |  j | | t j d  |  | }
 t j d  } n  t | t j  r| } | } n  | j |
  } | j |  } t	 j
 d k rt d | d |  n  t j |  } t } t | t  r| d k  rt } |  j |
 | | | | | | | | 	 \ } } | | f | _ | j d }
 | } | j |
  } qn  t | t  r%| d k  r%t } |  j | | | | | | | | | 	 \ } } |
 | f | _ | j d } | } | j |  } q%n  | s4d# } n t j | t d  |  } t j t j f } |  j | j  j j! |  j" | i   } | |  j# | <| j t j d | d | d |   |  j | j |  j | j <t	 j
 d k rt d d | d |  n  | d k rEt | t$  rE| j% | | d  rE| d d k rE| d# f St j } t j | t d  |  } t j& j' t( j) | |
 d | } t* | | |  |  j# | <|  j | | | |  | j |  } t	 j
 d k rt d | d | d |  n  t | t  rt j | d | } t j | t d  |  } t j |  } |  j | | | |  t	 j
 d k rt d d | d |  qn  t | t$  rt	 j
 d k rt d | | j+ k  n  | | j+ k rt	 j
 d k rt d | j+ |  n  | j, | | j+ |  q| | j+ | <n  t j | t d  |  } t j- d  t. d | } t/ t.  }  |  j" j0 |  | | f i   }! |  j | | |  |  t j | t d!  |  }" t j& j1 | | | g i  |  }# |  j | |" | |#  |! |  j# |# <| j t j d | d | d |   | j t j d | d | d |   | j t j d |# d |" d |   |" | f S($   s  Reason about the size of a slice represented by the "index"
        variable, and return a variable that has this size data, or
        raise GuardException if it cannot reason about it.

        The computation takes care of negative values used in the slice
        with respect to the given dimensional size ("dsize").

        Extra statments required to produce the result are appended
        to parent function's stmts list.
        R   t   slicet   __builtin__t   builtinsi   i    i   R   R   RV  t	   index_defR   R   RU  RB  RC  RH   R   R  R  t   lhs_relt   rhs_relt   replacement_slices   after rewriting negativest   size_vart   size_valt   size_rels   inferred constant sizes   size_rel is tuples   establishing equivalence tot   wrapRP   R   (   R]  R^  N(2   R  R   R   R   R   R   R8   RD   R   R   R   R   RQ   R   Rs   R   R   R	   R   R   R  R  RP  R   R   R   R   R   R   R[  Rt   RQ  t   funct   get_call_typeRA   R   R   R   R   R   R   R   R   R   R   t   GlobalRP   R   t   resolve_function_typeR   ($   R   R   RV  R   R  RW  R  R_  R   R   R   R   RU  RB  RC  t   zero_varRH   R`  Ra  Rb  t   need_replacementRX  RZ  t   replacement_slice_vart   new_arg_typst   rs_calltypet	   slice_typRc  Rd  Re  t   wrap_vart   wrap_deft   fntyRC   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR     s    	%		$	$	%%
	!!%%%c      	   ` s   j  | j } t t | t j    j  | j }   j |  }   j |  } t | t j  rr | f }	 nZ t t | t j   t	  j
 |  \ }
 } t | d k  t  f d   |
 D  }	 t t |  t |	  k o t |  k n  g        f d   } g  } g  } t } xw t |	 | |  D]c \ } } } | | | |  \ } } | j |  | d k	 rt } | j |  qA| j |  qAW| rJt |  d k r=t j  t d  | d j  } t j j | | d j  }  j t j d | d | d	 | d j   |  j  | j <qP| d } n d } t |  } t t d
   | D   t d   | D  } | |  f f S(   s  For indexing like var[index] (either write or read), see if
        the index corresponds to a range/slice shape.
        Returns a 2-tuple where the first item is either None or a ir.Var
        to be used to replace the index variable in the outer getitem or
        setitem instruction.  The second item is also a tuple returning
        the shape and prepending instructions.
        t   build_tuplec         3` s   |  ] }   j  | j Vq d  S(   N(   R   R   (   R   R   (   R   (    s3   lib/python2.7/site-packages/numba/array_analysis.pys	   <genexpr>^  s    c         ` sO   t  |  t j  r+  j | |      St  |  t j  rA d St t  d  S(   N(   NN(   RQ   R   RT   R   R   Rt   R   R   (   R   R   RV  (   R   R  R   RW  (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   to_shapeb  s
    i   t   replacement_build_tuplei    R   R  R  c         s` s   |  ] } | d  k Vq d  S(   N(   Rt   (   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pys	   <genexpr>  s    c         s` s!   |  ] } | d  k r | Vq d  S(   N(   Rt   (   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pys	   <genexpr>  s    N(   R   R   R   RQ   R   RR   R   RT   RS   R   R   R   R8   R   R^   R   Rt   R   R   R   R	   R  R   Rt  R  Rz   (   R   R  R   R   t   ind_varR   t   ind_typt	   ind_shapet	   var_shapet   seq_typst   seqR   Ru  t
   shape_listt   index_var_listt   replace_indexRF   RV  t
   shape_partt   index_var_partt   replacement_build_tuple_vart   new_build_tupleRZ   (    (   R   R  R   RW  s3   lib/python2.7/site-packages/numba/array_analysis.pyR$  K  sP    2
"		c         C` sF   |  j  | | | j | j  } | d d  k	 r> | d | _ n  | d S(   Ni    i   (   R$  R   R   Rt   (   R   R  R   R   R1  (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_getitem  s    c         C` s   | j  } |  j | j } t | t j  sq |  j | | | j  | j  } | d d  k	 ri | d | _ n  | d S| j	 |  } t
 t | j t  o | j t |  k   | | j g  f S(   Ni    i   (   R   R   R   RQ   R   RS   R$  R#  Rt   R   R   R   R   R8   (   R   R  R   R   R   R   R1  RZ   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_static_getitem  s    	+c         C` sK   t  | j t k  |  j | j j  s: | j t j k rG | j g  f Sd  S(   N(	   R   R   t   UNARY_MAP_OPRI  R   R   R   R?   Rt   (   R   R  R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_unary  s    'c         C` s8   t  | j t k  |  j | | | j | j | j g  S(   N(   R   R   t   BINARY_MAP_OPt   _analyze_broadcastR  R   R   (   R   R  R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_binop  s    c         C` s8   t  | j t k  |  j | | | j | j | j g  S(   N(   R   R   t   INPLACE_BINARY_MAP_OPR  R  R   R   (   R   R  R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_inplace_binop  s    c         C` s   |  j  | | | j | j    S(   N(   R  R  t	   list_vars(   R   R  R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_arrayexpr  s    c         C` s   t  | j  g  f S(   N(   R   R   (   R   R  R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_build_tuple  s    c         C` s  d d l  m } | j } t |  j |  } t | t j t j f  rh t	 | j
  rh t | j  g  f St | t j t j f  r t | j
 |  r | j } |  j | | | j
 | j | t | j   St |  j | d |  j \ } }	 t }
 t |	 t j  r=t |  j |	 j t j  r=|	 g | j } d }	 t }
 n	 | j } d j |	 |  j d d  } | t k r|  j | | | j |  Sy t |  |  } Wn t k
 rd  SXt  | | | | t | j   } |
 r| d | _ n  | Sd  S(	   Ni    (   t   StencilFuncR   t   numpys   _analyze_op_call_{}_{}t   .t   _i   (!   t   numba.stencilR  Rg  R   R   RQ   R   Ri  t   FreeVarR   R   R   RD   t   _analyze_stencilR  t   dictt   kwsR   R   R   R   R   R   RR   R   R   t   replacet   UFUNC_MAP_OPR  RE  RF  Rt   R   (   R   R  R   R   R  t   calleet
   callee_defRD   R   R   t   added_mod_nameR   R1  (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_call  sB    				!c         C` s   |  j  | | | |  S(   N(   t   _analyze_op_call_builtins_len(   R   R  R   RD   R  (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt    _analyze_op_call___builtin___len  s    c         C` sj   t  t |  d k  | d } |  j | j } t  t | t j   | j |  } | d g  | d f S(   Ni   i    (   R   R8   R   R   RQ   R   RR   R   (   R   R  R   RD   R  R   R   RZ   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR    s    
c         C` s   | j  | d   d  S(   Ni   (   R   Rt   (   R   R  R   RD   R  (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt2   _analyze_op_call_numba_array_analysis_assert_equiv  s    c         C` s   t  t |  d k  | d j } | d j } | j |  } | j |  } | | f | j k r | j | | f }	 t  |	 | j k  | j |	 }
 t  |
 g  k  |
 d f g  f St | |  g  f Sd S(   sX    Analyze wrap_index calls added by a previous run of
            Array Analysis
        i   i    i   N(   R   R8   R   R   R   R   R   (   R   R  R   RD   R  R   R   t   slice_eqt   dim_eqt   wrap_indR   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt0   _analyze_op_call_numba_array_analysis_wrap_index  s    c         C` s^   d  } t |  d k r% | d } n d | k r> | d } n  | rN | g  f St d   d  S(   Ni    RZ   s'   Must specify a shape for array creation(   Rt   R8   R   (   R   R  R   RD   R  t	   shape_var(    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_numpy_create_array  s    
c         C` s   |  j  | | | |  S(   N(   R  (   R   R  R   RD   R  (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_call_numpy_empty%  s    c         C` s   |  j  | | | |  S(   N(   R  (   R   R  R   RD   R  (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt4   _analyze_op_call_numba_unsafe_ndarray_empty_inferred(  s    c         C` s   |  j  | | | |  S(   N(   R  (   R   R  R   RD   R  (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_call_numpy_zeros,  s    c         C` s   |  j  | | | |  S(   N(   R  (   R   R  R   RD   R  (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_call_numpy_ones/  s    c         C` ss   t  |  d k r | d } n% d | k r8 | d } n t d   d | k r] | d } n | } | | f g  f S(   Ni    t   Ns,   Expect one argument (or 'N') to eye functiont   M(   R8   R   (   R   R  R   RD   R  R  R  (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_call_numpy_eye2  s    	c         C` s2   t  |  d k s t  | d } | | f g  f S(   Ni    (   R8   R9   (   R   R  R   RD   R  R  (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_call_numpy_identity@  s    
c   
      C` s	  t  |  d k s t  | d } t | t j  s: t  |  j | j } t | t j  r| j	 d k r d | k r | d } | j
 | d  s d  Sn  | j |  \ } }	 | j
 | |	  r| f g  f Sq| j	 d k r| j |  \ } | | f g  f Sn  d  S(   Ni    i   R   i   (   R8   R9   RQ   R   R   R   R   R   RR   R   R   Rt   R   (
   R   R  R   RD   R  RV   t   atypR   Ri   Rj   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_call_numpy_diagE  s"    

c         C` s}   t  |  d k s t  | d } |  j | j } t | t j  rN d g  f St | t j  ry | j |  ry | g  f Sd  S(   Ni    i   (   i   (
   R8   R9   R   R   RQ   R   RU   RR   R   Rt   (   R   R  R   RD   R  R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_numpy_array_likeZ  s    


c         C` s   t  |  d k s t  | d } |  j | j } t | t j  sJ t  | j d k r | j |  r | j	 d k r | g  | f S| g  f Sn  d  S(   Ni   i    t   C(   R8   R9   R   R   RQ   R   RR   R   R   t   layoutRt   (   R   R  R   RD   R  R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_call_numpy_ravele  s    
c         G` s   |  j  |   S(   N(   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_call_numpy_copyu  s    c         G` s   |  j  |   S(   N(   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt!   _analyze_op_call_numpy_empty_likex  s    c         G` s   |  j  |   S(   N(   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt!   _analyze_op_call_numpy_zeros_like{  s    c         G` s   |  j  |   S(   N(   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt    _analyze_op_call_numpy_ones_like~  s    c         G` s   |  j  |   S(   N(   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt    _analyze_op_call_numpy_full_like  s    c         G` s   |  j  |   S(   N(   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt%   _analyze_op_call_numpy_asfortranarray  s    c         C` ss  t  |  } | d k s t  | d k ra |  j | d j } t | t j  ra | d g  f Sn  g  } d } x t d t  |   D] }	 | |	 }
 t t	 |  j
 |
  } t | t j  r | j d k  r| d k r |	 } q d t |
 j  } t |   qq q W| d k r_| d j } t j | t d  |  } t j |  j | j <t j t j j | d d |  | |  } | j |  x t d t  |   D] }	 |	 | k rqn  t j | t d  |  } t j |  j | j <t j j t j | | |	 |  } t j | | |  } t t j t j t j  |  j | <| j |  | } qW| | | <n  t | d  | f S(   Ni   i   ii    s:   The reshape API may only include one negative argument. %st   calc_size_varRF   (   R8   R9   R   R   RQ   R   RS   Rq   R   R   R   R   R   R   R   R  RN   R   R	   RQ  R  R   RE  R   R   R   t   floordivR   R   R   (   R   R  R   RD   R  Rj   R   RW  t   neg_one_indext	   arg_indext   reshape_argt   reshape_arg_defRn   R  R  t   init_calc_vart   div_calc_size_vart	   new_binopt   div_calc(    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_call_numpy_reshape  sH    	
	+""
c         C` s   | d } |  j  | j } t | t j  s8 t d   | j |  } t |  d k ro t t	 |   g  f Sg  | d D] } t
 t |  j |  ^ qz }	 t |	 d t  r t |	 d  }	 n  d  |	 k r d  Sg  |	 D] }
 | |
 ^ q } t |  g  f S(   Ni    s   Invalid np.transpose argumenti   (   R   R   RQ   R   RR   R9   R   R8   R   t   reversedR   R   R   R   Rt   (   R   R  R   RD   R  t   in_arrR   RZ   RV   t   axesRw   t   ret(    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyRJ    s    
	,c         C` s&   t  |  d k r" t |  g  f Sd  S(   Ni    (   R8   R   Rt   (   R   R  R   RD   R  (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt"   _analyze_op_call_numpy_random_rand  s    c         G` s   |  j  |   S(   N(   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt#   _analyze_op_call_numpy_random_randn  s    c         C` s>   d | k r | d g  f St  |  | k r: | | g  f Sd  S(   NRF   (   R8   Rt   (   R   t   posR  R   RD   R  (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt"   _analyze_op_numpy_random_with_size  s
    c         G` s   |  j  d |  S(   Ni    (   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt"   _analyze_op_call_numpy_random_ranf  s    c         G` s   |  j  d |  S(   Ni    (   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt+   _analyze_op_call_numpy_random_random_sample  s    c         G` s   |  j  d |  S(   Ni    (   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt$   _analyze_op_call_numpy_random_sample  s    c         G` s   |  j  d |  S(   Ni    (   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt$   _analyze_op_call_numpy_random_random  s    c         G` s   |  j  d |  S(   Ni    (   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt-   _analyze_op_call_numpy_random_standard_normal  s    c         G` s   |  j  d |  S(   Ni   (   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt'   _analyze_op_call_numpy_random_chisquare  s    c         G` s   |  j  d |  S(   Ni   (   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt%   _analyze_op_call_numpy_random_weibull  s    c         G` s   |  j  d |  S(   Ni   (   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt#   _analyze_op_call_numpy_random_power  s    c         G` s   |  j  d |  S(   Ni   (   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt'   _analyze_op_call_numpy_random_geometric  s    c         G` s   |  j  d |  S(   Ni   (   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt)   _analyze_op_call_numpy_random_exponential  s    c         G` s   |  j  d |  S(   Ni   (   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt%   _analyze_op_call_numpy_random_poisson  s    c         G` s   |  j  d |  S(   Ni   (   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt&   _analyze_op_call_numpy_random_rayleigh  s    c         G` s   |  j  d |  S(   Ni   (   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt$   _analyze_op_call_numpy_random_normal  s    c         G` s   |  j  d |  S(   Ni   (   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt%   _analyze_op_call_numpy_random_uniform  s    c         G` s   |  j  d |  S(   Ni   (   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt"   _analyze_op_call_numpy_random_beta  s    c         G` s   |  j  d |  S(   Ni   (   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt&   _analyze_op_call_numpy_random_binomial  s    c         G` s   |  j  d |  S(   Ni   (   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_call_numpy_random_f  s    c         G` s   |  j  d |  S(   Ni   (   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt#   _analyze_op_call_numpy_random_gamma  s    c         G` s   |  j  d |  S(   Ni   (   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt'   _analyze_op_call_numpy_random_lognormal  s    c         G` s   |  j  d |  S(   Ni   (   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt%   _analyze_op_call_numpy_random_laplace  s    c         G` s   |  j  d |  S(   Ni   (   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt%   _analyze_op_call_numpy_random_randint   s    c         G` s   |  j  d |  S(   Ni   (   R  (   R   RD   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt(   _analyze_op_call_numpy_random_triangular#  s    c         C` s  t  |  d k s t  | d j } t |  j | d  \ } } t  |  } t | d k  d }	 d | k r t | d t  r | d }	 q t |  j | d  }	 n+ t  |  d k r t |  j | d  }	 n  t t |	 t   t | d k  g  | D] }
 | j	 |
  ^ q } |	 d k  r;t  | d  |	 }	 n  t d |	 k o_t  | d  k  n  g  } g  } | d k r(| d } | j
 | d  } | j d  xn t t  |   D]Z } | |	 k r| j
 | |  } | r| r| | n d  } q|  j | | d  } qW| j |  n x t t  | d   D] } | |	 k r}|  j | g  | D] } | | ^ qa } nF g  | D] } | | ^ q} | j |  j | | | |   | d } | j |  q?Wt |  t | g   f S(   Ni    t   axisi   Rt  (   R8   R9   R  R   R   R   RQ   R   R   R   R   t   popRq   Rt   t	   _sum_sizeR   t   _call_assert_equivR   R   (   R   R  R   RD   R  R  R|  R   Rj   R  R   R7  R8  t	   new_shapeRZ   Rw   Ri   RF   t   sizes(    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt"   _analyze_op_call_numpy_concatenate&  sP    "*
&
c         C` s  t  |  d k s t  | d j } t |  j | d  \ } } t  |  } t | d k  d }	 d | k r t | d t  r | d }	 q t |  j | d  }	 n+ t  |  d k r t |  j | d  }	 n  t t |	 t   t | d k  g  | D] }
 | j	 |
  ^ q } |  j
 | | | |  } | d } |	 d k  r]t  |  |	 d }	 n  t d |	 k o}t  |  k n  t | d |	 ! | g t | |	  } t |  | f S(   Ni    R  i   Rt  (   R8   R9   R  R   R   R   RQ   R   R   R   R  R   R   (   R   R  R   RD   R  R  R|  R   Rj   R  R   R7  R8  RZ   R  (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_call_numpy_stackU  s,    "
&(c   	      C` s   t  |  d k s t  t |  j | d  \ } } t  |  } t | d k  |  j | d j } t t | t j	   | j
 d k  r |  j | | | |  Sd | d <|  j | | | |  Sd  S(   Ni   i    i   R  (   R8   R9   R   R   R   R   R   RQ   R   RR   R   R  R  (	   R   R  R   RD   R  R|  R   Rj   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_call_numpy_vstacko  s    
c   	      C` s   t  |  d k s t  t |  j | d  \ } } t  |  } t | d k  |  j | d j } t t | t j	   | j
 d k  r d | d <n
 d | d <|  j | | | |  S(   Ni   i    i   R  (   R8   R9   R   R   R   R   R   RQ   R   RR   R   R  (	   R   R  R   RD   R  R|  R   Rj   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_call_numpy_hstack|  s    
c         C` s7  t  |  d k s t  t |  j | d  \ } } t  |  } t | d k  |  j | d j } t t | t j	   | j
 d k r d | d <|  j | | | |  }	 t |	  |	 \ }
 } t d g t |
   }
 |
 | f S| j
 d k rd | d <|  j | | | |  Sd | d <|  j | | | |  Sd  S(   Ni   i    R  i   (   R8   R9   R   R   R   R   R   RQ   R   RR   R   R  R   R   R  (   R   R  R   RD   R  R|  R   Rj   R   R1  RZ   R  (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_call_numpy_dstack  s&    




c         C` s   d  S(   N(   Rt   (   R   R  R   RD   R  (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_call_numpy_cumsum  s    c         C` s   d  S(   N(   Rt   (   R   R  R   RD   R  (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_call_numpy_cumprod  s    c         C` sQ   t  |  } d } | d k r+ | d } n d | k rD | d } n  | f g  f S(   Ni2   i   t   num(   R8   (   R   R  R   RD   R  Rj   R  (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_call_numpy_linspace  s    c         C` s<  t  |  } | d k s t  | d j } t t g  | D] } |  j | j  ^ q8   g  | D] } |  j | j ^ qa } g  | D] }	 |	 j ^ q }
 t t d   |
 D   |
 d d k r |
 d d k r d  Sg  | D] } | j
 |  ^ q } |
 d d k r^|  j | | | | d d | d d g  } t | d d d !| d d  | f S|
 d d k r|  j | | | | d d | d d g  } t | d d d ! | f S|
 d d k r%|
 d d k r%|  j | | | | d d | d d g  } | d d | d d f | f S|
 d d k r8n  d  S(   Ni   i    c         s` s   |  ] } | d  k Vq d S(   i    N(    (   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pys	   <genexpr>  s    i   ii(   R8   R9   R  R   Rz   RI  R   R   R   Rt   R   R  R   (   R   R  R   RD   R  Rj   R  R   t   typst   tyt   dimsR7  R8  (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   _analyze_op_call_numpy_dot  s2    /# "('( ( c         C` s!  | j  j d d  } | j j } t | t  r< | f } n  g  }	 t |  d k rl t |  t |  k sr t  x[ t | |  D]J \ }
 } |  j	 | j
 } t | t j  r |
 | k r |	 j |  q q Wt |	  } t | d k  |  j | | | |	  } | j |	 d  } | | f S(   Nt   standard_indexingi    (    (   t   optionsR   t	   kernel_irt	   arg_namesRQ   R   R8   R9   R^   R   R   R   RR   R   R   R  R   (   R   R  R   t   stencil_funcR  RD   R  t   std_idx_arrst   kernel_arg_namest   rel_idx_arrsRR  R   R   Rj   R8  RZ   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR    s     0c         C` s-   t  t |  d k  | j | d  g  f S(   Ni   i    (   R   R8   R   (   R   R  R   RD   R  (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt!   _analyze_op_call_numpy_linalg_inv  s    c         ` s  t  t   f d   |   } t t |  d k  g  | D] } | j ^ q; } g  | D] }   j | j j ^ qW } t |  }	 t |	 d k  y& g  | D] } | j |  ^ q }
 Wn. t	 k
 r | d   j
 | | | |  f SX  j | | | |
 |  S(   s   Infer shape equivalence of arguments based on Numpy broadcast rules
        and return shape of output
        https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
        c         ` s     j  |  j  S(   N(   RI  R   (   RV   (   R   (    s3   lib/python2.7/site-packages/numba/array_analysis.pyRW     R  i    (   R   R(  R   R8   R   R   R   R   R   t   GuardExceptionR  R%  (   R   R  R   R  RD   t   arrsR   R   R  t   max_dimR7  (    (   R   s3   lib/python2.7/site-packages/numba/array_analysis.pyR    s    &&!c      	   C` su  g  } g  } t  g  | D] } t |  ^ q  }	 d }
 xt |	  D]} g  } g  } x t | |  D]w \ } } | t |  k  rf | t |  d | } | j |  } | d k r | }
 q | j |  | j |  qf qf W| g  k r|
 d k s t  | j |
  | j d  n  | j |  j | | | | d |  | j | d  qD Wt	 t
 |   t | g   f S(   s   Produce assert_equiv for sizes in each dimension, taking into account
        of dimension coercion and constant size of 1.
        i   t   1R   i    N(   R   R8   Rt   Rq   R^   R   R   R9   R  R   R  R   (   R   R  R   R  R7  R   R8  R  RZ   R  t   const_size_oneRw   R  t
   size_namesR   RF   t
   const_size(    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR%    s.    %	c         C` sD   |  j  | | | | d | } t |  d k r@ | j |   n  | S(   NR   i   (   R.  R8   R   (   R   R  R  R   RD   R   t   insts(    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR    s
    c      	   C` s  | d  k r+ g  | D] } | j ^ q } n  g  } g  } xs t | |  D]b \ }	 } t }
 x* | D]" } | j | |  r` t }
 Pq` q` W|
 sG | j |  | j |	  qG qG Wt |  d k  r g  Sd j d j	 |  |  } t
 j | |  } t j |  } t
 j | t d  |  } | |  j | j <t | g g  | D] } |  j | j ^ q: } t j j |  } t
 j | t d  |  } t
 j d t d | } t t  } |  j j | | f i   } |  j | | | |  t
 j | t d  |  } t
 j j | | g | i  d | } |  j | | t j |  | |  j | <t
 j d	 | d
 | d |  t
 j d	 | d
 | d |  t
 j d	 | d
 | d |  g S(   Ni   s   Sizes of {} do not match on {}s   , Rn   t   assertR~   R  R  R   R  (   Rt   R   R^   R   R   R   R   R8   R   t   joinR   R   R   t   StringLiteralR   R	   R   R   RS   t
   from_typesRi  R~   R   RA   Rj  R  R   R   R|   R   R  (   R   R  R  R   t   _argsR   R   RD   R  R   t   seenR   Rn   t   msg_valt   msg_typt   msg_vart   argtypst   tup_typt
   assert_vart
   assert_defRs  RC   R   R   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR.    sD    0%c         C` sH  g  } t  | t j  r* | j |  } n  t  | t j  rQ | } d  } d  } n` t j j | d | j  } t j | j t	 d j
 | j   | j  } t j j t j |  } g  }	 t }
 | r t |  } | | k  r | | | } q n  xt |  D]} t } | r>| | r>t  | | t j  r||  j | | j } t  | t j  sft  | t j  r;| | } t } q;q>t  | | t  rt j | | | j  } n
 | | } t  | t j  st  t j | j t	 d j
 | j |   | j  } | j t j | | | j   |  j | | t j |  t } n  | st j | j t	 d j
 | j |   | j  } t j j | | d  | j  } t }
 d  |  j | <| j t j | | | j   |  j | | t j |  n  |	 j |  q W|
 r8| r8| j d t j | | | j   |  j | | | |  n  t  |	  | f S(   NRZ   s   {}_shapes	   {}_size{}i    (!   RQ   R   R   R   Rt   R   RE  R  R  R	   R   R   R   t
   containersR!  RQ  R   R8   Rq   R   R   RT   R   R   R   R9   R   R  R  t   static_getitemR   R   R   (   R   R   R   R   RZ   t   outt   attr_vart   shape_attr_callt   shape_attr_typt	   size_varst   use_attr_vart   nshapesRw   t   skipR   Rc  Rd  t   getitem(    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR   H  s`    	

!	!"c         C` sE   |  j  | } t | t j j  oD t | t j j  oD | j d k S(   Ni    (   R   RQ   R   t   npytypest   Arrayt   SmartArrayTypeR   (   R   t   varnameR   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyRI    s    c         C` sD   d } x7 | D]/ } | j  |  } | d k r2 d S| | 7} q W| S(   sz   Return the sum of the given list of sizes if they are all equivalent
        to some constant, or None otherwise.
        i    N(   R   Rt   (   R   R   R  t   sRF   Rj   (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR    s    N(Z   R   R   R   R   R   Rt   R  R  R  R  R  RK  RL  RN  R[  R   R$  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  RJ  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R   R  R%  R  R.  R   RI  R  (    (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyR   d  s   		L												M								-						
																>																											/													0	:	(K   t
   __future__R    R   R   R   t   pytypesR  R   t   numbaR   R   R   R   R   t   numba.ir_utilsR	   R
   R   R   R   R   R   R   R   R   R   R   R   t   numba.analysisR   t   numba.typingR   R   t   collectionsR   t   numba.extendingR   t   llvmlite.llvmpy.coret   llvmpyt   coreR`   R;   t   UNKNOWN_CLASSt   CONST_CLASSt   ufunct	   MAP_TYPESR0  t   array_creationt   random_int_argst   random_1arg_sizet   random_2arg_sizelastt   random_3arg_sizelastt   random_callsRP   R~   t   objectR   R   R   R   R   R   t   NumpyRulesUnaryArrayOperatort   _op_mapt   keysR  R  t   NumpyRulesArrayOperatorR  t   NumpyRulesInplaceArrayOperatorR  t   supported_ufuncsR0   R   R  (    (    (    s3   lib/python2.7/site-packages/numba/array_analysis.pyt   <module>   s\   .X				8 &     7