function for computing the lyap residual efficiently, compresszzvd finally right