ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dflogistic.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 <df1b2fun.h>
12 
17  df1b2variable logistic(double a,double b,const df1b2variable& x)
18  {
19  if (value(x)>-20.)
20  {
21  df1b2variable tmp=exp(-x);
22  return a+(b-a)*1.0/(1.0+tmp);
23  }
24  else
25  {
26  df1b2variable tmp=exp(x);
27  return a+(b-a)*tmp/(1.0+tmp);
28  }
29  }
30 
35  df1b2variable log_der_logistic(double a,double b,const df1b2variable& x)
36  {
37  if (value(x)>-20.)
38  {
39  df1b2variable tmp=exp(-x);
40  return log((b-a)*tmp/square(1.0+tmp));
41  }
42  else
43  {
44  df1b2variable tmp=exp(x);
45  return log((b-a)*tmp/square(1.0+tmp));
46  }
47  }
48 
53  df1b2variable dflogistic(double a,double b,const df1b2variable& x)
54  {
55  if (value(x)>-20.)
56  {
57  df1b2variable tmp=exp(-x);
58  return (b-a)*tmp/square(1.0+tmp);
59  }
60  else
61  {
62  df1b2variable tmp=exp(x);
63  return (b-a)*tmp/square(1.0+tmp);
64  }
65  }
#define x
Description not yet available.
Definition: df1b2fun.h:266
double dflogistic(double a, double b, const double &x)
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)
Description not yet available.
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
d3_array log(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr2a.cpp:13