ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
linad99/bounder.cpp
Go to the documentation of this file.
1 
9 #include "fvar.hpp"
10 
15  double bounder(double x,double min,double max, double scale)
16  {
17  double y=x/scale;
18  double z;
19  if (y<20.0)
20  {
21  z=exp(y)/(1.0+exp(y));
22  }
23  else
24  {
25  z=1.0/(1+exp(-y));
26  }
27  return min+(max-min)*z;
28  }
29 
34  dvariable bounder(const prevariable& x,double min,double max, double scale)
35  {
36  dvariable y=x/scale;
37  dvariable z;
38  if (y<20.0)
39  {
40  z=exp(y)/(1.0+exp(y));
41  }
42  else
43  {
44  z=1.0/(1+exp(-y));
45  }
46  return min+(max-min)*z;
47  }
Base class for dvariable.
Definition: fvar.hpp:1315
#define x
double bounder(double x, double min, double max, double scale)
Description not yet available.
#define min(a, b)
Definition: cbivnorm.cpp:188
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
#define max(a, b)
Definition: cbivnorm.cpp:189
Fundamental data type for reverse mode automatic differentiation.
Definition: fvar.hpp:1518