![]() |
Prev | Next |
# include <cppad/speed/quadratic_ok.hpp>
ok = quadratic_ok(
n,
i,
j,
x,
m,
fm)
f : \R^n \rightarrow \R
defined by
\[
f(x) = \sum_{k=1}^\ell \exp ( x_{i[k]} x_{j[k]} )
\]
This routine can be used to check a method for computing
f(x)
,
f^{(1)} (x)
, or
f^{(2)} (x)
.
quadratic_ok
is defined in the CppAD
namespace by including
the file cppad/speed/quadratic_ok.hpp
(relative to the CppAD distribution directory).
It is only intended for example and testing purposes,
so it is not automatically included by
cppad.hpp
.
size_t
n
and is the dimension of the argument space for the function
f
.
const CppAD::vector<size_t> &
i
and is a vector with size
\ell
.
It specifies one of the first
index of
x
for each quadratic term in
f(x)
.
All the elements of i must be between zero and
n-1
.
const CppAD::vector<size_t> &
j
and is a vector with size
\ell
.
It specifies one of the second
index of
x
for each quadratic term in
f(x)
.
All the elements of j must be between zero and
n-1
.
const CppAD::vector<double> &
x
and its size is n.
It contains he argument value for which the derivative is being checked.
Note that if m is zero,
the derivative does not depend on
x
and you can
use any value for its elements.
size_t
m
It specifies the order of the derivative of
f
that is being checked; i.e.,
f^{(m)} (x)
is checked.
const CppAD::vector<double> &
fm
and contains the value of
f^{(m)} (x)
that is being checked.
fm[0]
is the value of
f(x)
.
j = 0 , \ldots , n-1
\[
\D{f}{x[j]} = fm [ j ]
\]
n *
n and
for
k = 0 , \ldots , n-1
,
m = 0 , \ldots , n-1
\[
\DD{f}{x[k]}{x[m]} = fm [ k * n + m ]
\]
bool
ok
It is true, if hessian
passes the test and false otherwise.