def evalGradientParameter(self,x, mg):
"""
Evaluate the gradient for the variational parameter equation at the point x=[u,a,p].
Parameters:
- x = [u,a,p] the point at which to evaluate the gradient.
- mg the variational gradient (g, atest) being atest a test function in the parameter space
(Output parameter)
Returns the norm of the gradient in the correct inner product g_norm = sqrt(g,g)
"""
self.prior.grad(x[PARAMETER], mg)
tmp = self.generate_vector(PARAMETER)
self.problem.eval_da(x, tmp)
mg.axpy(1., tmp)
self.misfit.grad(PARAMETER,x,tmp)
mg.axpy(1., tmp)
self.prior.Msolver.solve(tmp, mg)
#self.prior.Rsolver.solve(tmp, mg)
return math.sqrt(mg.inner(tmp))
评论列表
文章目录