47 #if defined(RAD_DEBUG_BLOCKKEEP) && !defined(HAVE_SACADO_UNINIT)
48 #undef RAD_DEBUG_BLOCKKEEP
51 #ifndef SACADO_NO_NAMESPACE
57 #ifndef RAD_NO_USING_STDCC
76 #endif //NO_USING_STDCC
111 void *new_ADmemblock(
size_t);
112 void new_ADvari_block();
115 void *Memalloc(
size_t len);
116 static void Gradcomp(
int);
118 static void Hvprod(
int,
ADvar**,
double*,
double*);
119 static void Weighted_Gradcomp(
int,
ADvar**,
double*);
121 if (Ainext >= Ailimit)
140 static const double One, negOne;
152 void *
operator new(size_t);
153 void operator delete(
void*) {}
192 extern ADvari&
ADf1(
double f,
double g,
double h,
const ADvari &x);
193 extern ADvari&
ADf2(
double f,
double gx,
double gy,
double hxx,
194 double hxy,
double hyy,
const ADvari &x,
const ADvari &y);
195 extern ADvari&
ADfn(
double f,
int n,
const ADvar *x,
const double *g,
const double *h);
208 void operator delete(
void*) {}
210 opclass(oc), Val(t), aval(0.), dO(0.)
213 opclass(oc), Val(t), aval(ta), dO(0.)
216 inline ADvari(): Val(0.), aval(0.), dO(0.) {}
219 #ifdef RAD_AUTO_AD_Const
227 static ADvari *First_ADvari, **Last_ADvari;
235 #define Ai const ADvari&
236 #define T1(r,f) F r f(Ai);
282 friend ADvari&
ADf1(
double f,
double g,
double h,
const ADvari &x);
283 friend ADvari&
ADf2(
double f,
double gx,
double gy,
double hxx,
284 double hxy,
double hyy,
const ADvari &x,
const ADvari &y);
285 friend ADvari&
ADfn(
double f,
int n,
const ADvar *x,
const double *g,
const double *h);
296 ADvari(oc,val1), d(a1,this,c1) {}
297 #ifdef RAD_AUTO_AD_Const
313 static void aval_reset(
void);
322 #ifdef RAD_AUTO_AD_Const
349 #ifdef RAD_AUTO_AD_Const
352 inline ~IndepADvar() {
368 inline operator ADvari&() {
return *cv; }
371 inline double val()
const {
return cv->
Val; }
372 inline double adj()
const {
return cv->
aval; }
377 static inline void Hvprod(
int n,
ADvar **vp,
double *v,
double *hv)
384 #define Ai const ADvari&
385 #define AI const IndepADvar&
392 #define T1(f) friend ADvari& f(AI);
394 #define F friend ADvari&
444 void ADvar_ctr(
double d);
447 inline ADvar(
double d) { ADvar_ctr(d); }
448 inline ADvar(
int i) { ADvar_ctr((
double)i); }
449 inline ADvar(
long i) { ADvar_ctr((
double)i); }
451 #ifdef RAD_AUTO_AD_Const
454 inline ADvar(ADvari &x) { cv = &x; x.padv =
this; }
455 inline ADvar& operator=(
const IndepADvar &x) {
458 cv =
new ADvar1(
this,x);
461 inline ADvar& operator=(
const ADvari &x) {
464 cv =
new ADvar1(
this, x);
471 inline ADvar(
const IndepADvar &x) { cv = x.cv; }
472 inline ADvar(
const ADvari &x) { cv = (ADvari*)&x; }
473 inline ADvar& operator=(
const ADvari &x) { cv = (ADvari*)&x;
return *
this; }
474 inline ADvar& operator=(
const IndepADvar &x) { cv = (ADvari*)x.cv;
return *
this; }
483 ADvar& operator=(
double);
485 ADvar& operator+=(
double);
487 ADvar& operator-=(
double);
489 ADvar& operator*=(
double);
491 ADvar& operator/=(
double);
505 static inline void Hvprod(
int n,
ADvar **vp,
double *v,
double *hv)
525 void ConstADvar_ctr(
double);
531 #ifdef RAD_AUTO_AD_Const
535 #ifdef RAD_NO_CONST_UPDATE
584 ADvar2q(
double val1,
double Lp,
double Rp,
double LR,
double R2,
596 ADvar2g(
double val1,
double Lp,
double Rp,
double L2,
double LR,
double R2,
606 ADvarn(
double val1,
int n1,
const ADvar *x,
const double *g,
const double *h);
648 #define Ai const ADvari&
649 #define AI const IndepADvar&
652 T r f(Ai L, AI R) { return f(L, *A R.cv); }\
653 T r f(AI L, Ai R) { return f(*A L.cv, R); }\
654 T r f(AI L, AI R) { return f(*A L.cv, *A R.cv); }\
655 T r f(AI L, D R) { return f(*A L.cv, R); }\
656 T r f(D L, AI R) { return f(L, *A R.cv); }
677 T F f(AI x) { return f(*A x.cv); }
707 #ifndef SACADO_NO_NAMESPACE
710 #endif // SACADO_NAMESPACE
711 #endif // SACADO_RAD2_H
ADvari & cos(const ADvari &v)
void * Memalloc(size_t len)
static bool setget_fpval_implies_const(bool newval)
static void aval_reset(void)
static void Hvprod(int n, ADvar **vp, double *v, double *hv)
static void Weighted_Gradcomp(int n, ADvar **v, double *w)
ADvari(Advari_Opclass oc, double t, double ta)
ADvar1s(double val1, double d1, const ADvari *c1)
int operator>(const ADvari &L, const ADvari &R)
ADvari & asinh(const ADvari &v)
IndepADvar & operator=(const IndepADvar &x)
static void AD_Const(const IndepADvar &)
ADvari & acosh(const ADvari &v)
static void Weighted_Gradcomp(int n, ADvar **v, double *w)
void AD_Const(const IndepADvar &v)
ADvari & operator+(ADvari &T)
ADvari & sinh(const ADvari &v)
ADvari & atanh(const ADvari &v)
KOKKOS_INLINE_FUNCTION mpl::enable_if_c< ExprLevel< Expr< T1 > >::value==ExprLevel< Expr< T2 > >::value, Expr< PowerOp< Expr< T1 >, Expr< T2 > > > >::type pow(const Expr< T1 > &expr1, const Expr< T2 > &expr2)
ADvari & min(const ADvari &L, const ADvari &R)
ADvari(Advari_Opclass oc, double t)
ADvari & exp(const ADvari &v)
static void Hvprod(int n, ADvar **vp, double *v, double *hv)
ADvar1g(double val1, double d1, double d2, const ADvari *c1)
ConstADvar & operator=(const IndepADvar &d)
static void Gradcomp(int wantgrad)
ADvari & fabs(const ADvari &v)
ADvari & log10(const ADvari &v)
expr expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c *expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr2 expr1 expr2 expr1 expr1 expr1 c
ADvari & asin(const ADvari &v)
ADvari & ADf2(double f, double gx, double gy, double hxx, double hxy, double hyy, const ADvari &x, const ADvari &y)
ConstADvar & operator=(double d)
ADvari & atan(const ADvari &v)
int operator>=(const ADvari &L, const ADvari &R)
ADvari & cosh(const ADvari &v)
int operator<(const ADvari &L, const ADvari &R)
ADvari & sin(const ADvari &v)
ADvari & tan(const ADvari &v)
atan2(expr1.val(), expr2.val())
static void Hvprod(int, ADvar **, double *, double *)
static void Gradcomp(int wantgrad)
int operator!=(const ADvari &L, const ADvari &R)
ADvari & abs(const ADvari &x)
ADvar & operator=(const IndepADvar &x)
ADvari & sqrt(const ADvari &v)
void * new_ADmemblock(size_t)
static void Weighted_Gradcomp(int, ADvar **, double *)
ADvari & max(const ADvari &L, const ADvari &R)
ADvar & ADvar_operatoreq(ADvar *This, const ADvari &x)
ADvari & pow(const ADvari &L, const ADvari &R)
static bool get_fpval_implies_const(void)
int operator<=(const ADvari &L, const ADvari &R)
ADvar1(Advari_Opclass oc, double val1, const double *a1, const ADvari *c1)
ADvari & log(const ADvari &v)
static void set_fpval_implies_const(bool newval)
ADvari & acos(const ADvari &v)
int operator==(const ADvari &L, const ADvari &R)
ADvar & operator=(const ADvari &x)
ADvari & copy(const IndepADvar &x)
ADvar2(Advari_Opclass oc, double val1, const ADvari *Lcv, const double *Lc, const ADvari *Rcv, const double *Rc)
ADvari & atan2(const ADvari &L, const ADvari &R)
ADvari & ADf1(double f, double g, double h, const ADvari &x)
ADvari & ADfn(double f, int n, const ADvar *x, const double *g, const double *h)
void ADvari_record(ADvari *x)
ADvari & tanh(const ADvari &v)
ADvar(const IndepADvar &x)