22 #if defined(RAD_DEBUG_BLOCKKEEP) && !defined(HAVE_SACADO_UNINIT)
23 #undef RAD_DEBUG_BLOCKKEEP
30 #ifndef RAD_NO_USING_STDCC
77 void *new_ADmemblock(
size_t);
80 void *Memalloc(
size_t len);
81 static void Gradcomp(
int);
83 static void Weighted_Gradcomp(
int,
ADvar**,
double*);
99 static const double One, negOne;
111 void *
operator new(size_t);
112 void operator delete(
void*) {}
141 void operator delete(
void*) {}
142 inline ADvari(
double t): Val(t), aval(0.) {}
143 inline ADvari(
double t,
double ta): Val(t), aval(ta) {}
146 #ifdef RAD_AUTO_AD_Const
154 static ADvari *First_ADvari, **Last_ADvari;
162 #define Ai const ADvari&
163 #define T1(r,f) F r f(Ai);
209 friend ADvari&
ADf1(
double f,
double g,
const ADvari &x);
210 friend ADvari&
ADf2(
double f,
double gx,
double gy,
const ADvari &x,
const ADvari &y);
211 friend ADvari&
ADfn(
double f,
int n,
const ADvar *x,
const double *g);
223 ADvar1(
double val1,
const double *a1,
const ADvari *c1): d(a1,this,c1) { Val = val1; }
224 #ifdef RAD_AUTO_AD_Const
240 static void aval_reset(
void);
249 #ifdef RAD_AUTO_AD_Const
276 #ifdef RAD_AUTO_AD_Const
279 inline ~IndepADvar() {
295 inline operator ADvari&() {
return *cv; }
298 inline double val()
const {
return cv->
Val; }
299 inline double adj()
const {
return cv->
aval; }
309 #define Ai const ADvari&
310 #define AI const IndepADvar&
317 #define T1(f) friend ADvari& f(AI);
319 #define F friend ADvari&
369 void ADvar_ctr(
double d);
372 inline ADvar(
double d) { ADvar_ctr(d); }
373 inline ADvar(
int i) { ADvar_ctr((
double)i); }
374 inline ADvar(
long i) { ADvar_ctr((
double)i); }
376 #ifdef RAD_AUTO_AD_Const
379 inline ADvar(ADvari &x) { cv = &
x; x.padv =
this; }
380 inline ADvar& operator=(
const IndepADvar &x) {
383 cv =
new ADvar1(
this,x);
386 inline ADvar& operator=(
const ADvari &x) {
389 cv =
new ADvar1(
this, x);
396 inline ADvar(
const IndepADvar &x) { cv = x.cv; }
397 inline ADvar(
const ADvari &x) { cv = (ADvari*)&x; }
398 inline ADvar& operator=(
const ADvari &x) { cv = (ADvari*)&x;
return *
this; }
399 inline ADvar& operator=(
const IndepADvar &x) { cv = (ADvari*)x.cv;
return *
this; }
407 ADvar& operator=(
double);
409 ADvar& operator+=(
double);
411 ADvar& operator-=(
double);
413 ADvar& operator*=(
double);
415 ADvar& operator/=(
double);
447 void ConstADvar_ctr(
double);
453 #ifdef RAD_AUTO_AD_Const
457 #ifdef RAD_NO_CONST_UPDATE
478 const double *Rc):
ADvari(val1) {
495 ADvar2(val1), a(Lp), b(Rp) {
513 ADvarn(
double val1,
int n1,
const ADvar *x,
const double *g);
555 #define Ai const ADvari&
556 #define AI const IndepADvar&
559 T r f(Ai L, AI R) { return f(L, *A R.cv); }\
560 T r f(AI L, Ai R) { return f(*A L.cv, R); }\
561 T r f(AI L, AI R) { return f(*A L.cv, *A R.cv); }\
562 T r f(AI L, D R) { return f(*A L.cv, R); }\
563 T r f(D L, AI R) { return f(L, *A R.cv); }
584 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)
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)
SACADO_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)
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)