ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
logisticK.cpp
Go to the documentation of this file.
1 #include <admodel.h>
2 #include <df1b2fun.h>
3 #include <adrndeff.h>
4 
5 /*---------------------------------------------------------3rd variable is a scalar*/
6 /*---------------------------------------------2nd variable is a scalar*/
15 dvariable logisticK( const double& t, const prevariable& K, const prevariable& r, const prevariable& n0)
16 {
18  dvariable y;
19  y=K/(1.0+(K/n0-1.0)*exp(-r*t));
20 
22  return (y);
23 }
32 dvar_vector logisticK( const dvector& t, const prevariable& K, const prevariable& r, const prevariable& n0)
33 {
35  dvar_vector y;
36  y=K/(1.0+(K/n0-1.0)*exp(-r*t));
37 
39  return (y);
40 }
49 dvar_vector logisticK( const dvector& t, const dvar_vector& K, const prevariable& r, const prevariable& n0)
50 {
52  dvar_vector y;
53  y=elem_div(K, 1.0 + elem_prod(K/n0-1.0, exp(-r*t)));
54 
56  return (y);
57 }
58 /*---------------------------------------------2nd variable is a vector*/
67 dvar_vector logisticK( const dvector& t, const prevariable& K, const dvar_vector& r, const prevariable& n0)
68 {
70  dvar_vector y;
71  y=K/(1.0+(K/n0-1.0)*exp(-1.0*elem_prod(r,t)));
72 
74  return (y);
75 }
84 dvar_vector logisticK( const dvector& t, const dvar_vector& K, const dvar_vector& r, const prevariable& n0)
85 {
87  dvar_vector y;
88  y=elem_div(K, 1.0 + elem_prod(K/n0-1.0, exp(-1.0*elem_prod(r,t))));
89 
91  return (y);
92 }
93 /*---------------------------------------------------------3rd variable is a vector*/
94 /*---------------------------------------------2nd variable is a scalar*/
103 dvar_vector logisticK( const dvector& t, const prevariable& K, const prevariable& r, const dvar_vector& n0)
104 {
106  dvar_vector y;
107  y=K/(1.0+elem_prod((K/n0-1.0), exp(-r*t)));
108 
110  return (y);
111 }
120 dvar_vector logisticK( const dvector& t, const dvar_vector& K, const prevariable& r, const dvar_vector& n0)
121 {
123  dvar_vector y;
124  y=elem_div(K, 1.0 + elem_prod(elem_div(K, n0)-1.0, exp(-r*t)));
125 
127  return (y);
128 }
129 /*---------------------------------------------2nd variable is a vector*/
138 dvar_vector logisticK( const dvector& t, const prevariable& K, const dvar_vector& r, const dvar_vector& n0)
139 {
141  dvar_vector y;
142  y=K/(1.0+elem_prod(K/n0-1.0, exp(-1.0*elem_prod(r,t))));
143 
145  return (y);
146 }
155 dvar_vector logisticK( const dvector& t, const dvar_vector& K, const dvar_vector& r, const dvar_vector& n0)
156 {
158  dvar_vector y;
159  y=elem_div(K, 1.0 + elem_prod(elem_div(K, n0)-1.0, exp(-1.0*elem_prod(r,t))));
160 
162  return (y);
163 }
164 /*---------------------------------------------------------3rd variable is a scalar in a random effects model*/
165 /*---------------------------------------------2nd variable is a scalar in a random effects model*/
166 /*----------------------1st varible contains random effects*/
175 df1b2variable logisticK( const double& t, const df1b2variable& K, const df1b2variable& r, const df1b2variable& n0)
176 {
177  df1b2variable y;
178  y=K/(1.0+(K/n0-1.0)*exp(-r*t));
179 
180  return (y);
181 }
190 df1b2vector logisticK( const dvector& t, const df1b2variable& K, const df1b2variable& r, const df1b2variable& n0)
191 {
192  df1b2vector y;
193  y=K/(1.0+(K/n0-1.0)*exp(-r*t));
194 
195  return(y);
196 }
205 df1b2vector logisticK( const dvector& t, const df1b2vector& K, const df1b2variable& r, const df1b2variable& n0)
206 {
207  df1b2vector y;
208  y=elem_div(K, 1.0 + elem_prod(K/n0-1.0, exp(-r*t)));
209 
210  return(y);
211 }
212 
213 /*---------------------------------------------2nd variable is a vector in a random effects model*/
214 /*----------------------1st varible contains random effects*/
223 df1b2vector logisticK( const dvector& t, const df1b2variable& K, const df1b2vector& r, const df1b2variable& n0)
224 {
225  df1b2vector y;
226  y=K/(1.0+(K/n0-1.0)*exp(-1.0*elem_prod(r,t)));
227 
228  return(y);
229 }
238 df1b2vector logisticK( const dvector& t, const df1b2vector& K, const df1b2vector& r, const df1b2variable& n0)
239 {
240  df1b2vector y;
241  y=elem_div(K, 1.0 + elem_prod(K/n0-1.0, exp(-1.0*elem_prod(r,t))));
242 
243  return(y);
244 }
245 
246 
247 /*---------------------------------------------------------3rd variable is a vector in a random effects model*/
248 /*---------------------------------------------2nd variable is a scalar in a random effects model*/
249 /*----------------------1st varible contains random effects*/
258 df1b2vector logisticK( const dvector& t, const df1b2variable& K, const df1b2variable& r, const df1b2vector& n0)
259 {
260  df1b2vector y;
261  y=K/(1.0+elem_prod((K/n0-1.0), exp(-r*t)));
262 
263  return(y);
264 }
273 df1b2vector logisticK( const dvector& t, const df1b2vector& K, const df1b2variable& r, const df1b2vector& n0)
274 {
275  df1b2vector y;
276  y=elem_div(K, 1.0 + elem_prod(elem_div(K, n0)-1.0, exp(-r*t)));
277 
278  return(y);
279 }
280 
281 /*---------------------------------------------2nd variable is a vector in a random effects model*/
282 /*----------------------1st varible contains random effects*/
291 df1b2vector logisticK( const dvector& t, const df1b2variable& K, const df1b2vector& r, const df1b2vector& n0)
292 {
293  df1b2vector y;
294  y=K/(1.0+elem_prod(K/n0-1.0, exp(-1.0*elem_prod(r,t))));
295 
296  return(y);
297 }
306 df1b2vector logisticK( const dvector& t, const df1b2vector& K, const df1b2vector& r, const df1b2vector& n0)
307 {
308  df1b2vector y;
309  y=elem_div(K, 1.0 + elem_prod(elem_div(K, n0)-1.0, exp(-1.0*elem_prod(r,t))));
310 
311  return(y);
312 }
Base class for dvariable.
Definition: fvar.hpp:1315
d3_array elem_prod(const d3_array &a, const d3_array &b)
Returns d3_array results with computed elements product of a(i, j, k) * b(i, j, k).
Definition: d3arr2a.cpp:92
Description not yet available.
void RETURN_ARRAYS_DECREMENT(void)
Decrements gradient_structure::RETURN_ARRAYS_PTR.
Definition: gradstrc.cpp:507
Vector of double precision numbers.
Definition: dvector.h:50
Description not yet available.
Definition: df1b2fun.h:953
d3_array elem_div(const d3_array &a, const d3_array &b)
Returns d3_array results with computed elements division of a(i, j, k) / b(i, j, k).
Definition: d3arr2a.cpp:112
ADMB variable vector.
Definition: fvar.hpp:2172
Description not yet available.
Definition: df1b2fun.h:266
Description not yet available.
d3_array exp(const d3_array &arr3)
Returns d3_array results with computed exp from elements in arr3.
Definition: d3arr2a.cpp:28
dvariable logisticK(const double &t, const prevariable &K, const prevariable &r, const prevariable &n0)
ecologically parameterized logistic function with carrying capacity K; scalar
Definition: logisticK.cpp:15
Description not yet available.
void RETURN_ARRAYS_INCREMENT(void)
Increments gradient_structure::RETURN_ARRAYS_PTR.
Definition: gradstrc.cpp:474
Fundamental data type for reverse mode automatic differentiation.
Definition: fvar.hpp:1518