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