ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
logit.cpp
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Author: David Fournier
5  * Copyright (c) 2008-2012 Regents of the University of California
6  */
11 #include "fvar.hpp"
12 
17  dvariable logistic(double a,double b,const prevariable& x)
18  {
19  if (value(x)>-20.)
20  {
21  dvariable tmp=exp(-x);
22  return a+(b-a)*1.0/(1.0+tmp);
23  }
24  else
25  {
26  dvariable tmp=exp(x);
27  return a+(b-a)*tmp/(1.0+tmp);
28  }
29  }
30 
35  dvariable log_der_logistic(double a,double b,const prevariable& x)
36  {
37  if (value(x)>-20.)
38  {
39  dvariable tmp=exp(-x);
40  return log((b-a)*tmp/square(1.0+tmp));
41  }
42  else
43  {
44  dvariable tmp=exp(x);
45  return log((b-a)*tmp/square(1.0+tmp));
46  }
47  }
48 
53  dvariable dflogistic(double a,double b,const prevariable& x)
54  {
55  if (value(x)>-20.)
56  {
57  dvariable tmp=exp(-x);
58  return (b-a)*tmp/square(1.0+tmp);
59  }
60  else
61  {
62  dvariable tmp=exp(x);
63  return (b-a)*tmp/square(1.0+tmp);
64  }
65  }
Base class for dvariable.
Definition: fvar.hpp:1315
#define x
double dflogistic(double a, double b, const double &x)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
dvariable log_der_logistic(double a, double b, const prevariable &x)
Description not yet available.
Definition: logit.cpp:35
d3_array exp(const d3_array &arr3)
Returns d3_array results with computed exp from elements in arr3.
Definition: d3arr2a.cpp:28
double logistic(double a, double b, const double &x)
dvector value(const df1_one_vector &v)
Definition: df11fun.cpp:69
double square(const double value)
Return square of value; constant object.
Definition: d3arr4.cpp:16
Fundamental data type for reverse mode automatic differentiation.
Definition: fvar.hpp:1518
d3_array log(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr2a.cpp:13