def _tosubs(self, ixlist):
n = len(ixlist)<EOL>N = self.shape[self._distaxis]<EOL>ss = []<EOL>ms = []<EOL>if n == <NUM_LIT:0>:<EOL><INDENT>return ss, ms<EOL><DEDENT>j = <NUM_LIT:0> <EOL>ix = ixlist[j]<EOL>if ix >= N or ix < -N:<EOL><INDENT>raise IndexError(<EOL>'<STR_LIT>',<EOL>ix, self._distaxis, N)<EOL><DEDENT>if ix < <NUM_LIT:0>:<EOL><INDENT>ix += N<EOL><DEDENT>while j < n:<EOL><INDENT>for s in range(<NUM_LIT:0>, self._n):<EOL><INDENT>low = self._si[s]<EOL>high = self._si[s + <NUM_LIT:1>]<EOL>if ix >= low and ix < high:<EOL><INDENT>ss.append(s)<EOL>msj = [ix - low]<EOL>j += <NUM_LIT:1><EOL>while j < n:<EOL><INDENT>ix = ixlist[j]<EOL>if ix >= N or ix < -N:<EOL><INDENT>raise IndexError(<EOL>'<STR_LIT>',<EOL>ix, self._distaxis, N)<EOL><DEDENT>if ix < <NUM_LIT:0>:<EOL><INDENT>ix += N<EOL><DEDENT>if ix < low or ix >= high:<EOL><INDENT>break<EOL><DEDENT>msj.append(ix - low)<EOL>j += <NUM_LIT:1><EOL><DEDENT>ms.append(msj)<EOL><DEDENT>if ix < low:<EOL><INDENT>break<EOL><DEDENT><DEDENT><DEDENT>return ss, ms<EOL>
Maps a list of integer indices of the DistArray to subarray indices.
        ixlist can contain repeated indices and does not need to be sorted.
        Returns pair (ss, ms) where ss is a list of subarrays and ms is a
        list of lists of subindices m (one list for each subarray s in ss).