@classmethod
def _complexes_index(cls, complexes, index):
    """Map initial complex root index to an index in a factor where the root belongs."""
    index, i = index, 0
    for j, (_, factor, k) in enumerate(complexes):
        if index < i + k:
            poly, index = factor, 0
            for _, factor, _ in complexes[:j]:
                if factor == poly:
                    index += 1
            index += poly.count_roots()
            return poly, index
        else:
            i += k
