Internal function that calculates the inverted cumsum
CumSumInv(ntsegm, nmaxclust, z)
An integer.
An integer matrix.