pub fn check_gradient<T, F>(
f: &F,
analytical_grad: &ArrayView1<'_, T>,
x: &[T],
h: T,
tolerance: T,
) -> CoreResult<GradientCheckResult<T>>Expand description
Check an analytical gradient against a numerical gradient.
f– scalar function R^n -> R.analytical_grad– the gradient your code computes atx.x– the point at which the gradient was computed.h– finite difference step size (e.g. 1e-5).tolerance– maximum allowed relative error per component.
Returns a GradientCheckResult with element-wise details.