ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mfexp.cpp
Go to the documentation of this file.
1 /*
2 \file Robust exponential functions for variable scalar objects.
3 
4 Author: David Fournier
5 Copyright (c) 2008-2015 Regents of the University of California
6 */
7 #include <fvar.hpp>
8 
22 dvariable mfexp(const prevariable& x, double b)
23 {
24  if (x > b)
25  {
26  return exp(b)*(1.+2.*(x-b))/(1.+x-b);
27  }
28  else if (x < -b)
29  {
30  return exp(-b)*(1.-x-b)/(1.+2.*(-x-b));
31  }
32  return exp(x);
33 }
48 {
49  double b = 60;
50  return mfexp(x, b);
51 }
Base class for dvariable.
Definition: fvar.hpp:1315
#define x
d3_array mfexp(const d3_array &m)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr7.cpp:10
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
d3_array exp(const d3_array &arr3)
Returns d3_array results with computed exp from elements in arr3.
Definition: d3arr2a.cpp:28
Fundamental data type for reverse mode automatic differentiation.
Definition: fvar.hpp:1518