PPM is 3-tuple of PGM.
Move outputting code of gradient to client.