NumericalGradient.derivative¶
-
NumericalGradient.
derivative
(self, point)[source]¶ Return the derivative in
point
.The derivative of the gradient is often called the Hessian.
- Parameters
- point
domain
element-like
The point that the derivative should be taken in.
- point
- Returns
- derivative
NumericalDerivative
Numerical estimate of the derivative. Uses the same method as this operator does, but with half the number of significant digits in the step size in order to preserve numerical stability.
- derivative
Examples
Compute a numerical estimate of the derivative of the squared L2 norm:
>>> space = odl.rn(3) >>> func = odl.solvers.L2NormSquared(space) >>> grad = NumericalGradient(func) >>> hess = grad.derivative([1, 1, 1]) >>> hess([1, 0, 0]) rn(3).element([ 2., 0., 0.])
Find the Hessian matrix:
>>> hess_matrix = odl.matrix_representation(hess) >>> np.allclose(hess_matrix, 2 * np.eye(3)) True