def downcast_intp_index(arr):
 if (arr.dtype.itemsize > np.dtype(np.intp).itemsize):
  if (arr.size == 0):
   return arr.astype(np.intp)
  maxval = arr.max()
  minval = arr.min()
  if ((maxval > np.iinfo(np.intp).max) or (minval < np.iinfo(np.intp).min)):
   raise ValueError('Cannot deal with arrays with indices larger than the machine maximum address size (e.g. 64-bit indices on 32-bit machine).')
  return arr.astype(np.intp)
 return arr

def downcast_intp_index ( arr ) : if ( arr . dtype . itemsize > np . dtype ( np . intp ) . itemsize ) : if ( arr . size == 0 ) : return arr . astype ( np . intp ) maxval = arr . max ( ) minval = arr . min ( ) if ( ( maxval > np . iinfo ( np . intp ) . max ) or ( minval < np . iinfo ( np . intp ) . min ) ) : raise ValueError ( 'Cannot deal with arrays with indices larger than the machine maximum address size (e.g. 64-bit indices on 32-bit machine).' ) return arr . astype ( np . intp ) return arr
down-cast index array to np .