'Map initial complex root index to an index in a factor where
the root belongs.'

@classmethod
def _complexes_index(cls, complexes, index):

    (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 += len(_reals_cache[poly])
            return (poly, index)
        else:
            i += k
