27 #if defined(RAD_DEBUG_BLOCKKEEP) && !defined(HAVE_SACADO_UNINIT)
28 #undef RAD_DEBUG_BLOCKKEEP
31 #ifndef SACADO_NO_NAMESPACE
37 #ifndef RAD_NO_USING_STDCC
56 #endif //NO_USING_STDCC
91 void *new_ADmemblock(
size_t);
92 void new_ADvari_block();
95 void *Memalloc(
size_t len);
96 static void Gradcomp(
int);
98 static void Hvprod(
int,
ADvar**,
double*,
double*);
99 static void Weighted_Gradcomp(
int,
ADvar**,
double*);
101 if (Ainext >= Ailimit)
120 static const double One, negOne;
132 void *
operator new(size_t);
133 void operator delete(
void*) {}
172 extern ADvari&
ADf1(
double f,
double g,
double h,
const ADvari &
x);
173 extern ADvari&
ADf2(
double f,
double gx,
double gy,
double hxx,
174 double hxy,
double hyy,
const ADvari &
x,
const ADvari &
y);
175 extern ADvari&
ADfn(
double f,
int n,
const ADvar *
x,
const double *g,
const double *h);
188 void operator delete(
void*) {}
190 opclass(oc), Val(t), aval(0.), dO(0.)
193 opclass(oc), Val(t), aval(ta), dO(0.)
196 inline ADvari(): Val(0.), aval(0.), dO(0.) {}
199 #ifdef RAD_AUTO_AD_Const
207 static ADvari *First_ADvari, **Last_ADvari;
215 #define Ai const ADvari&
216 #define T1(r,f) F r f(Ai);
262 friend ADvari&
ADf1(
double f,
double g,
double h,
const ADvari &
x);
263 friend ADvari&
ADf2(
double f,
double gx,
double gy,
double hxx,
264 double hxy,
double hyy,
const ADvari &
x,
const ADvari &
y);
265 friend ADvari&
ADfn(
double f,
int n,
const ADvar *
x,
const double *g,
const double *h);
276 ADvari(oc,val1), d(a1,this,c1) {}
277 #ifdef RAD_AUTO_AD_Const
293 static void aval_reset(
void);
302 #ifdef RAD_AUTO_AD_Const
329 #ifdef RAD_AUTO_AD_Const
332 inline ~IndepADvar() {
348 inline operator ADvari&() {
return *cv; }
351 inline double val()
const {
return cv->
Val; }
352 inline double adj()
const {
return cv->
aval; }
357 static inline void Hvprod(
int n,
ADvar **vp,
double *v,
double *hv)
364 #define Ai const ADvari&
365 #define AI const IndepADvar&
372 #define T1(f) friend ADvari& f(AI);
374 #define F friend ADvari&
424 void ADvar_ctr(
double d);
427 inline ADvar(
double d) { ADvar_ctr(d); }
428 inline ADvar(
int i) { ADvar_ctr((
double)i); }
429 inline ADvar(
long i) { ADvar_ctr((
double)i); }
431 #ifdef RAD_AUTO_AD_Const
434 inline ADvar(ADvari &x) { cv = &
x; x.padv =
this; }
435 inline ADvar& operator=(
const IndepADvar &x) {
438 cv =
new ADvar1(
this,x);
441 inline ADvar& operator=(
const ADvari &x) {
444 cv =
new ADvar1(
this, x);
451 inline ADvar(
const IndepADvar &x) { cv = x.cv; }
452 inline ADvar(
const ADvari &x) { cv = (ADvari*)&x; }
453 inline ADvar& operator=(
const ADvari &x) { cv = (ADvari*)&x;
return *
this; }
454 inline ADvar& operator=(
const IndepADvar &x) { cv = (ADvari*)x.cv;
return *
this; }
463 ADvar& operator=(
double);
465 ADvar& operator+=(
double);
467 ADvar& operator-=(
double);
469 ADvar& operator*=(
double);
471 ADvar& operator/=(
double);
485 static inline void Hvprod(
int n,
ADvar **vp,
double *v,
double *hv)
505 void ConstADvar_ctr(
double);
511 #ifdef RAD_AUTO_AD_Const
515 #ifdef RAD_NO_CONST_UPDATE
564 ADvar2q(
double val1,
double Lp,
double Rp,
double LR,
double R2,
576 ADvar2g(
double val1,
double Lp,
double Rp,
double L2,
double LR,
double R2,
586 ADvarn(
double val1,
int n1,
const ADvar *x,
const double *g,
const double *h);
628 #define Ai const ADvari&
629 #define AI const IndepADvar&
632 T r f(Ai L, AI R) { return f(L, *A R.cv); }\
633 T r f(AI L, Ai R) { return f(*A L.cv, R); }\
634 T r f(AI L, AI R) { return f(*A L.cv, *A R.cv); }\
635 T r f(AI L, D R) { return f(*A L.cv, R); }\
636 T r f(D L, AI R) { return f(L, *A R.cv); }
657 T F f(AI x) { return f(*A x.cv); }
687 #ifndef SACADO_NO_NAMESPACE
690 #endif // SACADO_NAMESPACE
691 #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)
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)
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)
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)