Sacado Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Sacado_radops.cpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Sacado Package
4 //
5 // Copyright 2006 NTESS and the Sacado contributors.
6 // SPDX-License-Identifier: LGPL-2.1-or-later
7 // *****************************************************************************
8 // @HEADER
9 
10 // Support routines for the RAD package (Reverse Automatic Differentiation) --
11 // a package specialized for function and gradient evaluations.
12 // Written in 2004 by David M. Gay at Sandia National Labs, Albuquerque, NM.
13 
14 #include "Sacado_rad.hpp"
15 
16 namespace Sacado {
17 namespace Radnt {
18 
19 #ifdef RAD_AUTO_AD_Const
20 ADvari *ADvari::First_ADvari, **ADvari::Last_ADvari = &ADvari::First_ADvari;
21 #undef RAD_DEBUG_BLOCKKEEP
22 #else
23 #ifdef RAD_DEBUG_BLOCKKEEP
24 #if !(RAD_DEBUG_BLOCKKEEP > 0)
25 #undef RAD_DEBUG_BLOCKKEEP
26 #else
27 extern "C" void _uninit_f2c(void *x, int type, long len);
28 #define TYDREAL 5
29 static ADmemblock *rad_Oldcurmb;
30 static int rad_busy_blocks;
31 #endif /*RAD_DEBUG_BLOCKKEEP > 0*/
32 #endif /*RAD_DEBUG_BLOCKKEEP*/
33 #endif /*RAD_AUTO_AD_Const*/
34 
35 Derp *Derp::LastDerp = 0;
36 ADcontext ADvari::adc;
37 CADcontext ConstADvari::cadc;
38 ConstADvari *ConstADvari::lastcad;
39 static int rad_need_reinit;
40 #ifdef RAD_DEBUG_BLOCKKEEP
41 static size_t rad_mleft_save;
42 #endif
43 
44 const double CADcontext::One = 1., CADcontext::negOne = -1.;
45 
47 {
48  First.next = 0;
49  Busy = &First;
50  Free = 0;
51  Mbase = (char*)First.memblk;
52  Mleft = sizeof(First.memblk);
53  }
54 
55  void*
57 {
58  ADmemblock *mb, *mb0, *mb1, *mbf, *x;
59 #ifdef RAD_AUTO_AD_Const
60  ADvari *a, *anext;
61  IndepADvar *v;
62 #endif /* RAD_AUTO_AD_Const */
63 
64  if (rad_need_reinit && this == &ADvari::adc) {
65  rad_need_reinit = 0;
66  Derp::LastDerp = 0;
67 #ifdef RAD_DEBUG_BLOCKKEEP
68  Mleft = rad_mleft_save;
69  if (Mleft < sizeof(First.memblk))
70  _uninit_f2c(Mbase + Mleft, TYDREAL,
71  (sizeof(First.memblk) - Mleft)/sizeof(double));
72  if ((mb = Busy->next)) {
73  if (!(mb0 = rad_Oldcurmb))
74  mb0 = &First;
75  for(;; mb = mb->next) {
76  _uninit_f2c(mb->memblk, TYDREAL,
77  sizeof(First.memblk)/sizeof(double));
78  if (mb == mb0)
79  break;
80  }
81  }
82  rad_Oldcurmb = Busy;
83  if (rad_busy_blocks >= RAD_DEBUG_BLOCKKEEP) {
84  rad_busy_blocks = 0;
85  rad_Oldcurmb = 0;
86  mb0 = &First;
87  mbf = Free;
88  for(mb = Busy; mb != mb0; mb = mb1) {
89  mb1 = mb->next;
90  mb->next = mbf;
91  mbf = mb;
92  }
93  Free = mbf;
94  Busy = mb;
95  Mbase = (char*)First.memblk;
96  Mleft = sizeof(First.memblk);
97  }
98 
99 #else /* !RAD_DEBUG_BLOCKKEEP */
100 
101  mb0 = &ADvari::adc.First;
102  mbf = ADvari::adc.Free;
103  for(mb = ADvari::adc.Busy; mb != mb0; mb = mb1) {
104  mb1 = mb->next;
105  mb->next = mbf;
106  mbf = mb;
107  }
108  ADvari::adc.Free = mbf;
109  ADvari::adc.Busy = mb;
112 #ifdef RAD_AUTO_AD_Const
113  *ADvari::Last_ADvari = 0;
114  ADvari::Last_ADvari = &ADvari::First_ADvari;
115  if ((anext = ADvari::First_ADvari)) {
116  while((a = anext)) {
117  anext = a->Next;
118  if ((v = a->padv))
119  v->cv = new ADvari(v, a->Val);
120  }
121  }
122 #endif /*RAD_AUTO_AD_Const*/
123 #endif /* RAD_DEBUG_BLOCKKEEP */
124  if (Mleft >= len)
125  return Mbase + (Mleft -= len);
126  }
127 
128  if ((x = Free))
129  Free = x->next;
130  else
131  x = new ADmemblock;
132 #ifdef RAD_DEBUG_BLOCKKEEP
133  rad_busy_blocks++;
134 #endif
135  x->next = Busy;
136  Busy = x;
137  return (Mbase = (char*)x->memblk) +
138  (Mleft = sizeof(First.memblk) - len);
139  }
140 
141  void
142 ADcontext::Gradcomp(int wantgrad)
143 {
144  Derp *d;
145 
146  if (rad_need_reinit && wantgrad) {
147  for(d = Derp::LastDerp; d; d = d->next)
148  d->c->aval = 0;
149  }
150  else {
151  rad_need_reinit = 1;
152 #ifdef RAD_DEBUG_BLOCKKEEP
153  rad_mleft_save = ADvari::adc.Mleft;
154 #endif
155  ADvari::adc.Mleft = 0;
156  }
157 
158  if ((d = Derp::LastDerp) && wantgrad) {
159  d->b->aval = 1;
160  do d->c->aval += *d->a * d->b->aval;
161  while((d = d->next));
162  }
163  }
164 
165  void
166 ADcontext::Weighted_Gradcomp(int n, ADvar **v, double *w)
167 {
168  Derp *d;
169  int i;
170 
171  if (rad_need_reinit) {
172  for(d = Derp::LastDerp; d; d = d->next)
173  d->c->aval = 0;
174  }
175  else {
176  rad_need_reinit = 1;
177 #ifdef RAD_DEBUG_BLOCKKEEP
178  rad_mleft_save = ADvari::adc.Mleft;
179 #endif
180  ADvari::adc.Mleft = 0;
181  }
182  if ((d = Derp::LastDerp)) {
183  for(i = 0; i < n; i++)
184  v[i]->cv->aval = w[i];
185  do d->c->aval += *d->a * d->b->aval;
186  while((d = d->next));
187  }
188  }
189 
190 #ifdef RAD_AUTO_AD_Const
191 
192 IndepADvar::IndepADvar(double d)
193 {
194  cv = new ADvari(this,d);
195  }
196 
198 {
199  cv = new ADvari(this,d);
200  }
201 
203 {
204  cv = new ADvari(this,d);
205  }
206 
207 #else
209 IndepADvar::IndepADvar(double d)
210 {
211  ADvari *x = new ADvari(d);
212  cv = x;
213  }
214 
216 {
217  ADvari *x = new ADvari((double)d);
218  cv = x;
219  }
220 
222 {
223  ADvari *x = new ADvari((double)d);
224  cv = x;
225  }
226 
227 #endif /*RAD_AUTO_AD_Const*/
228 
229  void
231 {
232 #ifdef RAD_AUTO_AD_Const
233  ADvari *x = new ADvari(this,d);
234 #else
236  ? new ConstADvari(d)
237  : new ADvari(d);
238 #endif
239  cv = x;
240  }
241 
243 {
244  ConstADvari *x = new ConstADvari(0.);
245  cv = x;
246  }
247 
248  void
250 {
251  ConstADvari *x = new ConstADvari(d);
252  cv = x;
253  }
255 {
256  ConstADvari *y = new ConstADvari(x.Val);
257  new Derp(&CADcontext::One, y, &x); /*for side effect; value not used */
258  cv = y;
259  }
260 
261  void
263 {
264  ConstADvari *ncv = new ConstADvari(v.val());
265 #ifdef RAD_AUTO_AD_Const
266  v.cv->padv = 0;
267 #endif
268  ((IndepADvar*)&v)->cv = ncv;
269  }
270 
271  void
273 {
275  while(x) {
276  x->aval = 0;
277  x = x->prevcad;
278  }
279  }
280 
281 #ifdef RAD_AUTO_AD_Const
282 
283 ADvari::ADvari(const IndepADvar *x, double d): Val(d), aval(0.)
284 {
285  *Last_ADvari = this;
286  Last_ADvari = &Next;
287  padv = (IndepADvar*)x;
288  }
289 
290 ADvar1::ADvar1(const IndepADvar *x, const IndepADvar &y):
291  ADvari(y.cv->Val), d(&CADcontext::One, this, y.cv)
292 {
293  *ADvari::Last_ADvari = this;
294  ADvari::Last_ADvari = &Next;
295  padv = (IndepADvar*)x;
296  }
297 
298 ADvar1::ADvar1(const IndepADvar *x, const ADvari &y):
299  ADvari(y.Val), d(&CADcontext::One, this, &y)
300 {
301  *ADvari::Last_ADvari = this;
302  ADvari::Last_ADvari = &Next;
303  padv = (IndepADvar*)x;
304  }
305 
306 #else
307 
308  ADvar&
310 { This->cv = new ADvar1(x.Val, &CADcontext::One, (ADvari*)&x); return *This; }
311 
312  IndepADvar&
314 { This->cv = new ADvar1(x.Val, &CADcontext::One, (ADvari*)&x); return *This; }
315 
316 #endif /*RAD_AUTO_AD_Const*/
317 
318  IndepADvar&
320 {
321 #ifdef RAD_AUTO_AD_Const
322  if (cv)
323  cv->padv = 0;
324  cv = new ADvari(this,d);
325 #else
326  cv = new ADvari(d);
327 #endif
328  return *this;
329  }
330 
331  ADvar&
333 {
334 #ifdef RAD_AUTO_AD_Const
335  if (cv)
336  cv->padv = 0;
337  cv = new ADvari(this,d);
338 #else
340  ? new ConstADvari(d)
341  : new ADvari(d);
342 #endif
343  return *this;
344  }
345 
346  ADvari&
347 operator-(const ADvari &T) {
348  return *(new ADvar1(-T.Val, &CADcontext::negOne, &T));
349  }
350 
351  ADvari&
352 operator+(const ADvari &L, const ADvari &R) {
353  return *(new ADvar2(L.Val + R.Val, &L, &CADcontext::One, &R, &CADcontext::One));
354  }
355 
356  ADvar&
358  ADvari *Lcv = cv;
359 #ifdef RAD_AUTO_AD_Const
360  Lcv->padv = 0;
361 #endif
362  cv = new ADvar2(Lcv->Val + R.Val, Lcv, &CADcontext::One, &R, &CADcontext::One);
363  return *this;
364  }
365 
366  ADvari&
367 operator+(const ADvari &L, double R) {
368  return *(new ADvar1(L.Val + R, &CADcontext::One, &L));
369  }
370 
371  ADvar&
373  ADvari *tcv = cv;
374 #ifdef RAD_AUTO_AD_Const
375  tcv->padv = 0;
376 #endif
377  cv = new ADvar1(tcv->Val + R, &CADcontext::One, tcv);
378  return *this;
379  }
380 
381  ADvari&
382 operator+(double L, const ADvari &R) {
383  return *(new ADvar1(L + R.Val, &CADcontext::One, &R));
384  }
385 
386  ADvari&
387 operator-(const ADvari &L, const ADvari &R) {
388  return *(new ADvar2(L.Val - R.Val, &L, &CADcontext::One, &R, &CADcontext::negOne));
389  }
390 
391  ADvar&
393  ADvari *Lcv = cv;
394 #ifdef RAD_AUTO_AD_Const
395  Lcv->padv = 0;
396 #endif
397  cv = new ADvar2(Lcv->Val - R.Val, Lcv, &CADcontext::One, &R, &CADcontext::negOne);
398  return *this;
399  }
400 
401  ADvari&
402 operator-(const ADvari &L, double R) {
403  return *(new ADvar1(L.Val - R, &CADcontext::One, &L));
404  }
405 
406  ADvar&
408  ADvari *tcv = cv;
409 #ifdef RAD_AUTO_AD_Const
410  tcv->padv = 0;
411 #endif
412  cv = new ADvar1(tcv->Val - R, &CADcontext::One, tcv);
413  return *this;
414  }
415 
416  ADvari&
417 operator-(double L, const ADvari &R) {
418  return *(new ADvar1(L - R.Val, &CADcontext::negOne, &R));
419  }
420 
421  ADvari&
422 operator*(const ADvari &L, const ADvari &R) {
423  return *(new ADvar2(L.Val * R.Val, &L, &R.Val, &R, &L.Val));
424  }
425 
426  ADvar&
428  ADvari *Lcv = cv;
429 #ifdef RAD_AUTO_AD_Const
430  Lcv->padv = 0;
431 #endif
432  cv = new ADvar2(Lcv->Val * R.Val, Lcv, &R.Val, &R, &Lcv->Val);
433  return *this;
434  }
435 
436  ADvari&
437 operator*(const ADvari &L, double R) {
438  return *(new ADvar1s(L.Val * R, R, &L));
439  }
440 
441  ADvar&
443  ADvari *Lcv = cv;
444 #ifdef RAD_AUTO_AD_Const
445  Lcv->padv = 0;
446 #endif
447  cv = new ADvar1s(Lcv->Val * R, R, Lcv);
448  return *this;
449  }
450 
451  ADvari&
452 operator*(double L, const ADvari &R) {
453  return *(new ADvar1s(L * R.Val, L, &R));
454  }
455 
456  ADvari&
457 operator/(const ADvari &L, const ADvari &R) {
458  double Lv = L.Val, Rv = R.Val, pL = 1. / Rv, q = Lv/Rv;
459  return *(new ADvar2q(q, pL, -q*pL, &L, &R));
460  }
461 
462  ADvar&
464  ADvari *Lcv = cv;
465 #ifdef RAD_AUTO_AD_Const
466  Lcv->padv = 0;
467 #endif
468  double Lv = Lcv->Val, Rv = R.Val, pL = 1. / Rv, q = Lv/Rv;
469  cv = new ADvar2q(q, pL, -q*pL, Lcv, &R);
470  return *this;
471  }
472 
473  ADvari&
474 operator/(const ADvari &L, double R) {
475  return *(new ADvar1s(L.Val / R, 1./R, &L));
476  }
477 
478  ADvari&
479 operator/(double L, const ADvari &R) {
480  double recip = 1. / R.Val;
481  double q = L * recip;
482  return *(new ADvar1s(q, -q*recip, &R));
483  }
484 
485  ADvar&
487  ADvari *Lcv = cv;
488 #ifdef RAD_AUTO_AD_Const
489  Lcv->padv = 0;
490 #endif
491  cv = new ADvar1s(Lcv->Val / R, 1./R, Lcv);
492  return *this;
493  }
494 
495  ADvari&
496 acos(const ADvari &v) {
497  double t = v.Val;
498  return *(new ADvar1s(acos(t), -1./sqrt(1. - t*t), &v));
499  }
500 
501  ADvari&
502 acosh(const ADvari &v) {
503  double t = v.Val, t1 = sqrt(t*t - 1.);
504  return *(new ADvar1s(log(t + t1), 1./t1, &v));
505  }
506 
507  ADvari&
508 asin(const ADvari &v) {
509  double t = v.Val;
510  return *(new ADvar1s(asin(t), 1./sqrt(1. - t*t), &v));
511  }
512 
513  ADvari&
514 asinh(const ADvari &v) {
515  double t = v.Val, td = 1., t1 = sqrt(t*t + 1.);
516  if (t < 0.) {
517  t = -t;
518  td = -1.;
519  }
520  return *(new ADvar1s(td*log(t + t1), 1./t1, &v));
521  }
522 
523  ADvari&
524 atan(const ADvari &v) {
525  double t = v.Val;
526  return *(new ADvar1s(atan(t), 1./(1. + t*t), &v));
527  }
528 
529  ADvari&
530 atanh(const ADvari &v) {
531  double t = v.Val;
532  return *(new ADvar1s(0.5*log((1.+t)/(1.-t)), 1./(1. - t*t), &v));
533  }
534 
535  ADvari&
536 max(const ADvari &L, const ADvari &R) {
537  const ADvari &x = L.Val >= R.Val ? L : R;
538  return *(new ADvar1(x.Val, &CADcontext::One, &x));
539  }
540 
541  ADvari&
542 max(double L, const ADvari &R) {
543  if (L >= R.Val)
544  return *(new ADvari(L));
545  return *(new ADvar1(R.Val, &CADcontext::One, &R));
546  }
547 
548  ADvari&
549 max(const ADvari &L, double R) {
550  if (L.Val >= R)
551  return *(new ADvar1(L.Val, &CADcontext::One, &L));
552  return *(new ADvari(R));
553  }
554 
555  ADvari&
556 min(const ADvari &L, const ADvari &R) {
557  const ADvari &x = L.Val <= R.Val ? L : R;
558  return *(new ADvar1(x.Val, &CADcontext::One, &x));
559  }
560 
561  ADvari&
562 min(double L, const ADvari &R) {
563  if (L <= R.Val)
564  return *(new ADvari(L));
565  return *(new ADvar1(R.Val, &CADcontext::One, &R));
566  }
567 
568  ADvari&
569 min(const ADvari &L, double R) {
570  if (L.Val <= R)
571  return *(new ADvar1(L.Val, &CADcontext::One, &L));
572  return *(new ADvari(R));
573  }
574 
575  ADvari&
576 atan2(const ADvari &L, const ADvari &R) {
577  double x = L.Val, y = R.Val, t = x*x + y*y;
578  return *(new ADvar2q(atan2(x,y), y/t, -x/t, &L, &R));
579  }
580 
581  ADvari&
582 atan2(double x, const ADvari &R) {
583  double y = R.Val, t = x*x + y*y;
584  return *(new ADvar1s(atan2(x,y), -x/t, &R));
585  }
586 
587  ADvari&
588 atan2(const ADvari &L, double y) {
589  double x = L.Val, t = x*x + y*y;
590  return *(new ADvar1s(atan2(x,y), y/t, &L));
591  }
592 
593  ADvari&
594 cos(const ADvari &v) {
595  return *(new ADvar1s(cos(v.Val), -sin(v.Val), &v));
596  }
597 
598  ADvari&
599 cosh(const ADvari &v) {
600  return *(new ADvar1s(cosh(v.Val), sinh(v.Val), &v));
601  }
602 
603  ADvari&
604 exp(const ADvari &v) {
605  ADvar1* rcv = new ADvar1(exp(v.Val), &v);
606  rcv->d.a = &rcv->Val;
607  rcv->d.b = rcv;
608  return *rcv;
609  }
610 
611  ADvari&
612 log(const ADvari &v) {
613  double x = v.Val;
614  return *(new ADvar1s(log(x), 1. / x, &v));
615  }
616 
617  ADvari&
618 log10(const ADvari &v) {
619  static double num = 1. / log(10.);
620  double x = v.Val;
621  return *(new ADvar1s(log10(x), num / x, &v));
622  }
623 
624  ADvari&
625 pow(const ADvari &L, const ADvari &R) {
626  double x = L.Val, y = R.Val, t = pow(x,y);
627  return *(new ADvar2q(t, y*t/x, t*log(x), &L, &R));
628  }
629 
630  ADvari&
631 pow(double x, const ADvari &R) {
632  double t = pow(x,R.Val);
633  return *(new ADvar1s(t, t*log(x), &R));
634  }
635 
636  ADvari&
637 pow(const ADvari &L, double y) {
638  double x = L.Val, t = pow(x,y);
639  return *(new ADvar1s(t, y*t/x, &L));
640  }
641 
642  ADvari&
643 sin(const ADvari &v) {
644  return *(new ADvar1s(sin(v.Val), cos(v.Val), &v));
645  }
646 
647  ADvari&
648 sinh(const ADvari &v) {
649  return *(new ADvar1s(sinh(v.Val), cosh(v.Val), &v));
650  }
651 
652  ADvari&
653 sqrt(const ADvari &v) {
654  double t = sqrt(v.Val);
655  return *(new ADvar1s(t, 0.5/t, &v));
656  }
657 
658  ADvari&
659 tan(const ADvari &v) {
660  double t = cos(v.Val);
661  return *(new ADvar1s(tan(v.Val), 1./(t*t), &v));
662  }
663 
664  ADvari&
665 tanh(const ADvari &v) {
666  double t = 1. / cosh(v.Val);
667  return *(new ADvar1s(tanh(v.Val), t*t, &v));
668  }
669 
670  ADvari&
671 fabs(const ADvari &v) { // "fabs" is not the best choice of name,
672  // but this name is used at Sandia.
673  double t, p;
674  p = 1;
675  if ((t = v.Val) < 0) {
676  t = -t;
677  p = -p;
678  }
679  return *(new ADvar1s(t, p, &v));
680  }
681 
682  ADvari&
683 ADf1(double f, double g, const ADvari &x) {
684  return *(new ADvar1s(f, g, &x));
685  }
686 
687  ADvari&
688 ADf2(double f, double gx, double gy, const ADvari &x, const ADvari &y) {
689  return *(new ADvar2q(f, gx, gy, &x, &y));
690  }
691 
692 ADvarn::ADvarn(double val1, int n1, const ADvar *x, const double *g): ADvari(val1), n(n1)
693 {
694  Derp *d1, *dlast;
695  double *a1;
696  int i;
697 
698  a1 = a = (double*)ADvari::adc.Memalloc(n*sizeof(*a));
699  d1 = Da = (Derp*)ADvari::adc.Memalloc(n*sizeof(Derp));
700  dlast = Derp::LastDerp;
701  for(i = 0; i < n1; i++, d1++) {
702  d1->next = dlast;
703  dlast = d1;
704  a1[i] = g[i];
705  d1->a = &a1[i];
706  d1->b = this;
707  d1->c = x[i].cv;
708  }
709  Derp::LastDerp = dlast;
710  }
711 
712  ADvari&
713 ADfn(double f, int n, const ADvar *x, const double *g) {
714  return *(new ADvarn(f, n, x, g));
715  }
716 
717 } // namespace Radnt
718 } // namespace Sacado
const char * p
ADvar & operator+=(const ADvari &)
ADvari & asin(const ADvari &v)
static void AD_Const(const IndepADvar &)
ADvari & sin(const ADvari &v)
ADvari & max(const ADvari &L, const ADvari &R)
#define TYDREAL
Definition: uninit.c:47
void * new_ADmemblock(size_t)
ADvari & acosh(const ADvari &v)
ADvar & operator-=(const ADvari &)
ADvar & operator=(const ADvari &x)
Definition: Sacado_rad.hpp:403
ADvari & operator*(const ADvari &L, const ADvari &R)
ADvari & log(const ADvari &v)
ADvari & operator-(const ADvari &T)
ADvari & log10(const ADvari &v)
const double * a
Definition: Sacado_rad.hpp:108
ADvari & asinh(const ADvari &v)
Sacado::Rad::ADvar< double > R
Definition: ad_example.cpp:22
ADvari & atanh(const ADvari &v)
static void Weighted_Gradcomp(int, ADvar **, double *)
#define T
Definition: Sacado_rad.hpp:553
ADvari & operator/(const ADvari &L, const ADvari &R)
ADvar & operator*=(const ADvari &)
ADvari & fabs(const ADvari &v)
ADvari & atan(const ADvari &v)
ADvarn(double val1, int n1, const ADvar *x, const double *g)
static ConstADvari * lastcad
Definition: Sacado_rad.hpp:234
static int rad_need_reinit
void ADvar_ctr(double d)
static const double One
Definition: Sacado_rad.hpp:99
const ADvari * b
Definition: Sacado_rad.hpp:109
ADvari & cosh(const ADvari &v)
ADvari & tan(const ADvari &v)
static void aval_reset(void)
ADvari & tanh(const ADvari &v)
IndepADvar & operator=(const IndepADvar &x)
Definition: Sacado_rad.hpp:247
ADvari & operator+(ADvari &T)
Definition: Sacado_rad.hpp:516
const ADvari * c
Definition: Sacado_rad.hpp:110
static const double negOne
Definition: Sacado_rad.hpp:99
ADvari & cos(const ADvari &v)
ADvari & ADfn(double f, int n, const ADvar *x, const double *g)
static void Gradcomp()
Definition: Sacado_rad.hpp:82
ADvari & sqrt(const ADvari &v)
static CADcontext cadc
Definition: Sacado_rad.hpp:237
ADvari & acos(const ADvari &v)
ADvar & ADvar_operatoreq(ADvar *This, const ADvari &x)
ADvar & operator/=(const ADvari &)
static Derp * LastDerp
Definition: Sacado_rad.hpp:106
ADvari & ADf1(double f, double g, const ADvari &x)
static ADcontext adc
Definition: Sacado_rad.hpp:145
ADvari & exp(const ADvari &v)
int n
ADvari & atan2(const ADvari &L, const ADvari &R)
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)
const double y
ADvari & sinh(const ADvari &v)