nodes: 0, module; 1, function_definition; 2, function_name:arrayuniqify; 3, parameters; 4, block; 5, identifier:X; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, identifier:retainorder; 13, False; 14, comment:"""
      Very fast uniqify routine for numpy arrays.
  
      **Parameters**
  
              **X** :  numpy array
  
                      Determine the unique elements of this numpy array.
  
              **retainorder** :  Boolean, optional
  
                      Whether or not to return indices corresponding to unique 
                      values of `X` that also sort the values.  Default value is 
                      `False`, in which case `[D,s]` is returned.  This can be 
                      used to produce a uniqified version of `X` by simply 
                      taking::
  
                              X[s][D]
  
                      or::
  
                              X[s[D.nonzero()[0]]]
  
      **Returns**
  
              **D** :  numpy array
  
                      List of "first differences" in the sorted verion of `X`.  
                      Returned when `retainorder` is `False` (default).
  
              **s** :  numpy array
  
                      Permutation that will sort `X`.  Returned when 
                      `retainorder` is `False` (default).
  
              **ind** :  numpy array
  
                      List of indices that correspond to unique values of `X`, 
                      without sorting those values.  Returned when `retainorder` 
                      is `True`.
  
      **See Also:**
  
              :func:`tabular.fast.recarrayuniqify`
  
      """; 15, assignment; 16, assignment; 17, assignment; 18, identifier:retainorder; 19, block; 20, else_clause; 21, identifier:s; 22, call; 23, identifier:X; 24, subscript; 25, identifier:D; 26, call; 27, expression_statement; 28, expression_statement; 29, expression_statement; 30, return_statement; 31, block; 32, attribute; 33, argument_list; 34, identifier:X; 35, identifier:s; 36, attribute; 37, argument_list; 38, assignment; 39, assignment; 40, call; 41, identifier:ind; 42, return_statement; 43, identifier:X; 44, identifier:argsort; 45, identifier:np; 46, identifier:append; 47, list; 48, comparison_operator:X[1:] != X[:-1]; 49, identifier:DD; 50, call; 51, identifier:ind; 52, list_comprehension; 53, attribute; 54, argument_list; 55, list; 56, True; 57, subscript; 58, subscript; 59, attribute; 60, argument_list; 61, call; 62, for_in_clause; 63, identifier:ind; 64, identifier:sort; 65, identifier:D; 66, identifier:s; 67, identifier:X; 68, slice; 69, identifier:X; 70, slice; 71, identifier:np; 72, identifier:append; 73, subscript; 74, call; 75, identifier:min; 76, argument_list; 77, tuple_pattern; 78, call; 79, integer:1; 80, unary_operator; 81, call; 82, integer:0; 83, identifier:len; 84, argument_list; 85, subscript; 86, identifier:i; 87, identifier:x; 88, identifier:enumerate; 89, argument_list; 90, integer:1; 91, attribute; 92, argument_list; 93, identifier:X; 94, identifier:s; 95, slice; 96, subscript; 97, identifier:D; 98, identifier:nonzero; 99, identifier:x; 100, subscript; 101, identifier:DD; 102, slice; 103, identifier:DD; 104, binary_operator:i+1; 105, unary_operator; 106, identifier:i; 107, integer:1; 108, integer:1
code: def arrayuniqify(X, retainorder=False):
      """
      Very fast uniqify routine for numpy arrays.
  
      **Parameters**
  
              **X** :  numpy array
  
                      Determine the unique elements of this numpy array.
  
              **retainorder** :  Boolean, optional
  
                      Whether or not to return indices corresponding to unique 
                      values of `X` that also sort the values.  Default value is 
                      `False`, in which case `[D,s]` is returned.  This can be 
                      used to produce a uniqified version of `X` by simply 
                      taking::
  
                              X[s][D]
  
                      or::
  
                              X[s[D.nonzero()[0]]]
  
      **Returns**
  
              **D** :  numpy array
  
                      List of "first differences" in the sorted verion of `X`.  
                      Returned when `retainorder` is `False` (default).
  
              **s** :  numpy array
  
                      Permutation that will sort `X`.  Returned when 
                      `retainorder` is `False` (default).
  
              **ind** :  numpy array
  
                      List of indices that correspond to unique values of `X`, 
                      without sorting those values.  Returned when `retainorder` 
                      is `True`.
  
      **See Also:**
  
              :func:`tabular.fast.recarrayuniqify`
  
      """
      s = X.argsort()
      X = X[s]
      D = np.append([True],X[1:] != X[:-1])
      if retainorder:
          DD = np.append(D.nonzero()[0],len(X))
          ind = [min(s[x:DD[i+1]]) for (i,x) in enumerate(DD[:-1])]
          ind.sort()
          return ind
      else:
          return [D,s]