added a segmented variant of the trialfactorizer as a preparation for the parellel version.