42 #if defined(RAD_DEBUG_BLOCKKEEP) && !defined(HAVE_SACADO_UNINIT)
43 #undef RAD_DEBUG_BLOCKKEEP
50 #ifndef RAD_NO_USING_STDCC
97 void *new_ADmemblock(
size_t);
100 void *Memalloc(
size_t len);
101 static void Gradcomp(
int);
103 static void Weighted_Gradcomp(
int,
ADvar**,
double*);
119 static const double One, negOne;
131 void *
operator new(size_t);
132 void operator delete(
void*) {}
161 void operator delete(
void*) {}
162 inline ADvari(
double t): Val(t), aval(0.) {}
163 inline ADvari(
double t,
double ta): Val(t), aval(ta) {}
166 #ifdef RAD_AUTO_AD_Const
174 static ADvari *First_ADvari, **Last_ADvari;
182 #define Ai const ADvari&
183 #define T1(r,f) F r f(Ai);
229 friend ADvari&
ADf1(
double f,
double g,
const ADvari &x);
230 friend ADvari&
ADf2(
double f,
double gx,
double gy,
const ADvari &x,
const ADvari &y);
231 friend ADvari&
ADfn(
double f,
int n,
const ADvar *x,
const double *g);
243 ADvar1(
double val1,
const double *a1,
const ADvari *c1): d(a1,this,c1) { Val = val1; }
244 #ifdef RAD_AUTO_AD_Const
260 static void aval_reset(
void);
269 #ifdef RAD_AUTO_AD_Const
296 #ifdef RAD_AUTO_AD_Const
299 inline ~IndepADvar() {
315 inline operator ADvari&() {
return *cv; }
318 inline double val()
const {
return cv->
Val; }
319 inline double adj()
const {
return cv->
aval; }
329 #define Ai const ADvari&
330 #define AI const IndepADvar&
337 #define T1(f) friend ADvari& f(AI);
339 #define F friend ADvari&
389 void ADvar_ctr(
double d);
392 inline ADvar(
double d) { ADvar_ctr(d); }
393 inline ADvar(
int i) { ADvar_ctr((
double)i); }
394 inline ADvar(
long i) { ADvar_ctr((
double)i); }
396 #ifdef RAD_AUTO_AD_Const
399 inline ADvar(ADvari &x) { cv = &x; x.padv =
this; }
400 inline ADvar& operator=(
const IndepADvar &x) {
403 cv =
new ADvar1(
this,x);
406 inline ADvar& operator=(
const ADvari &x) {
409 cv =
new ADvar1(
this, x);
416 inline ADvar(
const IndepADvar &x) { cv = x.cv; }
417 inline ADvar(
const ADvari &x) { cv = (ADvari*)&x; }
418 inline ADvar& operator=(
const ADvari &x) { cv = (ADvari*)&x;
return *
this; }
419 inline ADvar& operator=(
const IndepADvar &x) { cv = (ADvari*)x.cv;
return *
this; }
427 ADvar& operator=(
double);
429 ADvar& operator+=(
double);
431 ADvar& operator-=(
double);
433 ADvar& operator*=(
double);
435 ADvar& operator/=(
double);
467 void ConstADvar_ctr(
double);
473 #ifdef RAD_AUTO_AD_Const
477 #ifdef RAD_NO_CONST_UPDATE
498 const double *Rc):
ADvari(val1) {
515 ADvar2(val1), a(Lp), b(Rp) {
533 ADvarn(
double val1,
int n1,
const ADvar *x,
const double *g);
575 #define Ai const ADvari&
576 #define AI const IndepADvar&
579 T r f(Ai L, AI R) { return f(L, *A R.cv); }\
580 T r f(AI L, Ai R) { return f(*A L.cv, R); }\
581 T r f(AI L, AI R) { return f(*A L.cv, *A R.cv); }\
582 T r f(AI L, D R) { return f(*A L.cv, R); }\
583 T r f(D L, AI R) { return f(L, *A R.cv); }
604 T F f(AI x) { return f(*A x.cv); }
ADvar1(double val1, const ADvari *c1)
ADvar & operator=(const IndepADvar &x)
ADvari & asin(const ADvari &v)
static void AD_Const(const IndepADvar &)
ADvari & sin(const ADvari &v)
static void Weighted_Gradcomp(int n, ADvar **v, double *w)
ConstADvar & operator=(const IndepADvar &d)
ADvari & max(const ADvari &L, const ADvari &R)
void * new_ADmemblock(size_t)
void * Memalloc(size_t len)
ADvari & acosh(const ADvari &v)
static bool setget_fpval_implies_const(bool newval)
ADvar & operator=(const ADvari &x)
ADvari & abs(const ADvari &x)
ADvari & log(const ADvari &v)
ADvar(const IndepADvar &x)
ADvari & log10(const ADvari &v)
ADvari & asinh(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 & atanh(const ADvari &v)
static void Weighted_Gradcomp(int, ADvar **, double *)
ADvar1s(double val1, double a1, const ADvari *c1)
static bool get_fpval_implies_const(void)
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 & fabs(const ADvari &v)
ADvari & atan(const ADvari &v)
ADvar2q(double val1, double Lp, double Rp, const ADvari *Lcv, const ADvari *Rcv)
ADvari & cosh(const ADvari &v)
ConstADvar & operator=(double d)
ADvari & tan(const ADvari &v)
static void aval_reset(void)
ADvari & tanh(const ADvari &v)
IndepADvar & operator=(const IndepADvar &x)
ADvari & operator+(ADvari &T)
atan2(expr1.val(), expr2.val())
ADvari & cos(const ADvari &v)
ADvari & ADfn(double f, int n, const ADvar *x, const double *g)
ADvari & sqrt(const ADvari &v)
int operator==(const ADvari &L, const ADvari &R)
ADvari & acos(const ADvari &v)
ADvar & ADvar_operatoreq(ADvar *This, const ADvari &x)
int operator!=(const ADvari &L, const ADvari &R)
int operator>(const ADvari &L, const ADvari &R)
static void Gradcomp(int wantgrad)
static void set_fpval_implies_const(bool newval)
void AD_Const(const IndepADvar &v)
ADvari & ADf1(double f, double g, const ADvari &x)
int operator<(const ADvari &L, const ADvari &R)
static void Weighted_Gradcomp(int n, ADvar **v, double *w)
int operator<=(const ADvari &L, const ADvari &R)
static void Gradcomp(int wantgrad)
int operator>=(const ADvari &L, const ADvari &R)
ADvar1(double val1, const double *a1, const ADvari *c1)
ADvari & exp(const ADvari &v)
ADvari(double t, double ta)
ADvari & copy(const IndepADvar &x)
ADvari & atan2(const ADvari &L, const ADvari &R)
ADvar2(double val1, const ADvari *Lcv, const double *Lc, const ADvari *Rcv, const double *Rc)
ADvari & pow(const ADvari &L, const ADvari &R)
ADvari & ADf2(double f, double gx, double gy, const ADvari &x, const ADvari &y)
ADvari & min(const ADvari &L, const ADvari &R)
ADvari & sinh(const ADvari &v)