No description
src | ||
test | ||
Project.toml | ||
README.md |
TaylorTest
Simple package to check derivatives
Usage
check(f, Jf, x[, constant_components]; taylortestplot=false, taylortestdirection=nothing, f_kwargs...)
Returns true if Jf
approximates the derivative/gradient/Jacobian of f
at point x
(along a random direction unless specified using taylortestdirection
).
f_kwargs
are keywords arguments to be passed to f
and Jf
.
constant_components
is an optional Vector{Int}
corresponding to components of the direction which should be set to zero,
effectively ignoring the dependency of f
on these components.
If taylortestplot
is true
, a log-log plot of the error against the perturbation size will be shown.
check!(f!, Jf!, x, size_f_x, size_Jf_x, [, constant_components]; taylortestplot=false, taylortestdirection=nothing, f_kwargs...)
Like check
but handling non-allocating functions. Output size for both f!
and the Jacobian Jf!
must be provided (as Tuple
s) via size_f_x
and size_Jf_x
.
Examples (see test
directory for more)
import TaylorTest
f = x -> cos(x)
Jf = x -> -sin(x)
TaylorTest.check(f, Jf, rand())
# [ Info: Approximation order ~ 1.0
# true