1 # ifndef CPPAD_CORE_BENDER_QUAD_HPP
2 # define CPPAD_CORE_BENDER_QUAD_HPP
301 template <
class BAvector,
class Fun>
313 CheckSimpleVector<Base, BAvector>();
316 typedef CPPAD_TESTVECTOR(
AD<Base>) ADvector;
319 size_t n = size_t(x.size());
320 size_t m = size_t(y.size());
325 "BenderQuad: size of the vector g is not equal to 1"
328 size_t(gx.size()) == n,
329 "BenderQuad: size of the vector gx is not equal to n"
332 size_t(gxx.size()) == n * n,
333 "BenderQuad: size of the vector gxx is not equal to n * n"
341 for(j = 0; j < n; j++)
353 dy = fun.dy(x, y, h);
357 for(j = 0; j < m; j++)
358 vy[j] = y[j] + dy[j];
362 gtilde = fun.f(vx, vy);
375 for(j = 0; j < n; j++)
379 BAvector dg(1), w(1), ddw(2 * n);
384 for(j = 0; j < n; j++)
395 for(i = 0; i < n; i++)
396 gxx[ i * n + j ] = ddw[ i * 2 + 1 ];
#define CPPAD_ASSERT_KNOWN(exp, msg)
Check that exp is true, if not print msg and terminate execution.
Class used to hold function objects.
void Independent(VectorAD &x, size_t abort_op_index)
Declaration of independent variables.
void BenderQuad(const BAvector &x, const BAvector &y, Fun fun, BAvector &g, BAvector &gx, BAvector &gxx)
void Dependent(local::ADTape< Base > *tape, const ADvector &y)
change the operation sequence corresponding to this object
void optimize(const std::string &options="")
Optimize a player object operation sequence.
VectorBase Forward(size_t q, size_t r, const VectorBase &x)
forward mode user API, one order multiple directions.
VectorBase Reverse(size_t p, const VectorBase &v)
reverse mode sweep