def recarrayequalspairs(X,Y,weak=True):
if (weak and set(X.dtype.names) != set(Y.dtype.names)) or(not weak and X.dtype.names != Y.dtype.names):<EOL><INDENT>return [np.zeros((len(X),),int),np.zeros((len(X),),int),None]<EOL><DEDENT>else:<EOL><INDENT>if X.dtype.names != Y.dtype.names:<EOL><INDENT>Y = np.rec.fromarrays([Y[a] for a in X.dtype.names], <EOL>names= X.dtype.names)<EOL><DEDENT>NewX = np.array([str(l) for l in X])<EOL>NewY = np.array([str(l) for l in Y])<EOL>s = NewY.argsort()  ; NewY.sort()<EOL>[A,B] = equalspairs(NewX,NewY)<EOL>return [A,B,s]<EOL><DEDENT>
Indices of elements in a sorted numpy recarray (or ndarray with 
structured dtype) equal to those in another.

Record array version of func:`tabular.fast.equalspairs`, but slightly 
different because the concept of being sorted is less well-defined for a 
record array.

Given numpy recarray `X` and sorted numpy recarray `Y`, determine the 
indices in Y equal to indices in X.

Returns `[A,B,s]` where `s` is a permutation of `Y` such that for::

        Y = X[s]

we have::

        Y[A[i]:B[i]] = Y[Y == X[i]]

`A[i] = B[i] = 0` if `X[i]` is not in `Y`.

**Parameters**

        **X** :  numpy recarray

                Numpy recarray to compare to the sorted numpy recarray `Y`.

        **Y** :  numpy recarray

                Sorted numpy recarray.  Determine the indices of elements 
                of `Y` equal to those in numpy array `X`.

**Returns**

        **A** :  numpy array

                List of indices in `Y`, `len(A) = len(Y)`.

        **B** :  numpy array

                List of indices in `Y`, `len(B) = len(Y)`.

        **s** :  numpy array

                Permutation of `Y`.

**See Also:**

        :func:`tabular.fast.recarrayequalspairs`