Add the new way of calculating the generalized modulary matrix