ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvar_a51.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 
13 void DF_dvexp(void);
14 
19 dvar_vector mfexp(const dvar_vector& v1, const double d)
20 {
21  //dvector cv1=value(v1);
22  dvar_vector vtmp(v1.indexmin(),v1.indexmax());
23  for (int i=v1.indexmin();i<=v1.indexmax();i++)
24  {
25  if (v1.elem_value(i)<d)
26  {
27  vtmp.elem_value(i)=exp(v1.elem_value(i));
28  }
29  else
30  {
31  vtmp.elem_value(i)=exp(d);
32  cout << "In mfexp d =" << d << " mfexp(x) = " << vtmp(i) << endl;
33  }
34  }
35 
39  fp->save_dvar_vector_value(vtmp);
40  fp->save_dvar_vector_position(vtmp);
43  return vtmp;
44 }
double & elem_value(int i)
Definition: fvar.hpp:2226
ADMB variable vector.
Definition: fvar.hpp:2172
void set_gradient_stack(void(*func)(void), double *dep_addr, double *ind_addr1=NULL, double mult1=0, double *ind_addr2=NULL, double mult2=0)
Description not yet available.
Definition: fvar.hpp:1045
d3_array mfexp(const d3_array &m)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr7.cpp:10
prnstream & endl(prnstream &)
void save_dvar_vector_value(const dvar_vector &v)
Definition: cmpdif4.cpp:106
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
int save_identifier_string(const char *)
Writes a gradient stack verification string.
Definition: cmpdif2.cpp:315
void DF_dvexp(void)
Description not yet available.
Definition: fvar_a29.cpp:148
int indexmin() const
Definition: fvar.hpp:2287
void save_dvar_vector_position(const dvar_vector &v)
Definition: cmpdif3.cpp:214
static _THREAD DF_FILE * fp
Stores the adjoint gradient data that will be processed by gradcalc.
static _THREAD grad_stack * GRAD_STACK1
int indexmax() const
Definition: fvar.hpp:2292