<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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]