def f_inv(self, z, max_iterations=<NUM_LIT>, y=None):
z = z.copy()<EOL>y = np.ones_like(z)<EOL>it = <NUM_LIT:0><EOL>update = np.inf<EOL>while np.abs(update).sum() > <NUM_LIT> and it < max_iterations:<EOL><INDENT>fy = self.f(y)<EOL>fgrady = self.fgrad_y(y)<EOL>update = (fy - z) / fgrady<EOL>y -= self.rate * update<EOL>it += <NUM_LIT:1><EOL><DEDENT>return y<EOL>
Calculate the numerical inverse of f. This should be
overwritten for specific warping functions where the
inverse can be found in closed form.

:param max_iterations: maximum number of N.R. iterations