ADMB Documentation  11.1.2258
 All Classes Files Functions Variables Typedefs Friends Defines
fvar_a51.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: fvar_a51.cpp 1942 2014-04-28 22:22:45Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include "fvar.hpp"
00012 
00013 void DF_dvexp(void);
00014 
00019 dvar_vector mfexp(const dvar_vector& v1, const double d)
00020 {
00021   //dvector cv1=value(v1);
00022   dvar_vector vtmp(v1.indexmin(),v1.indexmax());
00023   for (int i=v1.indexmin();i<=v1.indexmax();i++)
00024   {
00025     if (v1.elem_value(i)<d)
00026     {
00027       vtmp.elem_value(i)=exp(v1.elem_value(i));
00028     }
00029     else
00030     {
00031       vtmp.elem_value(i)=exp(d);
00032       cout << "In mfexp d =" << d << " mfexp(x) = " << vtmp(i)  << endl;
00033     }
00034   }
00035 
00036   save_identifier_string("ddd");
00037   v1.save_dvar_vector_position();
00038   vtmp.save_dvar_vector_value();
00039   vtmp.save_dvar_vector_position();
00040   save_identifier_string("hee");
00041   gradient_structure::GRAD_STACK1->
00042             set_gradient_stack(DF_dvexp);
00043   return vtmp;
00044 }