next up previous contents index
Next: Interface n_test_gradient Up: Module minimization_module Previous: Interface minim   Contents   Index

Interface test_gradient


\begin{boxedminipage}{\textwidth}
\begin{verbatim}t1 = test_gradient(xx,func,dfunc[,dir])\end{verbatim}
\end{boxedminipage}

Test a function against its gradient by evaluating the gradient from the function by finite differnces. We can only test the gradient if energy and force functions are pure in that they do not change the input vector (e.g. no capping of parameters). The interface for func(x) and dfunc(x) are the same as for minim above.

xx -- real(dp), intent(in), dimension(:)

Position

dir -- real(dp), intent(in), optional, target, dimension(:)

direction along which to test

Function func(x) -- real(dp)

x -- real(dp), dimension(:)

Function dfunc(x) -- real(dp), dimension(size(x))

x -- real(dp), dimension(:)

Return value -- logical
Returns true if the gradient test passes, or false if it fails
n_test_gradient interface

gabor 2009-06-30