32 #include <boost/type_traits/is_fundamental.hpp>
43 template<
typename Expr>
52 enum { nvar = Expr::nvar };
54 typedef Expr expression_type;
55 typedef typename expression_type::value_type value_type;
65 explicit ADExpr( expression_type
const & expr )
86 value_type value()
const
88 return __expression.value();
91 value_type grad(
int __ith )
const
93 return __expression.grad( __ith );
96 value_type hessian(
int __i,
int __j )
const
98 return __expression.hessian( __i, __j );
101 bool deps(
int i )
const
103 return __expression.deps( i );
106 operator bool()
const
108 return __expression.value() != value_type( 0 );
136 expression_type __expression;
148 typedef T value_type;
156 explicit ADCst(
const T& value ) : constant_( value )
161 value_type value()
const
165 value_type grad(
int __i )
const
169 value_type
hessian(
int __i,
int __j )
const
174 bool deps(
int )
const
187 enum { nvar = T::nvar };
188 typedef typename T::value_type value_type;
196 ADUnaryPlus(
const T& value ) : expr_( value )
201 value_type value()
const
203 return expr_.value();
205 value_type grad(
int __i )
const
207 return expr_.grad( __i );
209 value_type
hessian(
int __i,
int __j )
const
211 return expr_.hessian( __i, __j );
214 bool deps(
int i )
const
216 return expr_.deps( i );
219 template <
class T>
inline
220 ADExpr< ADUnaryPlus< ADExpr<T> > >
221 operator + (
const ADExpr<T>& expr )
223 typedef ADUnaryPlus< ADExpr<T> > expr_t;
225 return ADExpr< expr_t >( expr_t( expr ) );
234 enum { nvar = T::nvar };
235 typedef typename T::value_type value_type;
242 ADUnaryMinus(
const T& value ) : expr_( value )
247 value_type value()
const
249 return - expr_.value();
251 value_type grad(
int __i )
const
253 return - expr_.grad( __i );
255 value_type
hessian(
int __i,
int __j )
const
257 return - expr_.hessian( __i, __j );
260 bool deps(
int i )
const
262 return expr_.deps( i );
268 template <
class T>
inline
269 ADExpr< ADUnaryMinus< ADExpr<T> > >
270 operator - (
const ADExpr<T>& expr )
272 typedef ADUnaryMinus< ADExpr<T> > expr_t;
274 return ADExpr< expr_t >( expr_t( expr ) );
PolynomialSet< Poly, Tensor2 > hessian(PolynomialSet< Poly, Scalar > const &p)
compute the gradient of a vectorial polynomial set
Definition: operations.hpp:231
brief description
Definition: adexpr.hpp:44