pysdic.Transformation.check_apply_dx#
- Transformation.check_apply_dx(x_i, *, eps=1e-06, rtol=1e-05, atol=1e-08, raise_error=False, **kwargs)[source]#
Check the Jacobian of the apply method with respect to the input points against central finite differences at the given input points \(\vec{x_i}\).
\[\frac{\partial T}{\partial x_{i,k}} \approx \frac{T(\vec{x_i} + h_k \vec{e_k}) - T(\vec{x_i} - h_k \vec{e_k})}{2 h_k}\]with \(h_k = \varepsilon \max(1, |x_{i,k}|)\).
Note
This check is only valid at the given points. It is recommended to perform it on points covering the domain of interest.
- Parameters:
x_i (ArrayLike) – Input points \(\vec{x_i}\) with shape \((\dots, n_i)\) at which to check the Jacobian.
eps (float, optional (default:
1e-6)) – The relative step \(\varepsilon\) of the finite differences.rtol (float, optional (default:
1e-5)) – The relative tolerance of the comparison (seenumpy.allclose).atol (float, optional (default:
1e-8)) – The absolute tolerance of the comparison (seenumpy.allclose).raise_error (bool, optional (default:
False)) – If True, raise anAssertionErrorwith the maximum error if the check fails.**kwargs – Additional arguments passed to the underlying
_applymethod.
- Returns:
True if the analytical Jacobian matches the finite differences, False otherwise.
- Return type: