ADMB Documentation  11.1.2247
 All Classes Files Functions Variables Typedefs Friends Defines
f1b2lapqd.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: f1b2lapqd.cpp 1935 2014-04-26 02:02:58Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #  include <admodel.h>
00012 #  include <df1b2fun.h>
00013 #  include <adrndeff.h>
00014 
00015 //dvariable AD_uf_inner(const dvector& x,const dvar_vector& u);
00016 void get_second_ders(int xs,int us,const init_df1b2vector y,dmatrix& Hess,
00017   dmatrix& Dux, df1b2_gradlist * f1b2gradlist,function_minimizer * pfmin);
00018 double calculate_laplace_approximation(const dvector& x,const dvector& u0,
00019   const dmatrix& Hess,const dvector& _xadjoint,const dvector& _uadjoint,
00020   const dmatrix& _Hessadjoint,function_minimizer * pmin);
00021 
00026 dvector laplace_approximation_calculator::get_uhat_quasi_newton_qd
00027   (const dvector& x,function_minimizer * pfmin)
00028 {
00029   dvector g(1,usize);
00030   independent_variables u(1,usize);
00031   fmc1.itn=0;
00032   fmc1.crit=1.e-9;
00033   fmc1.ifn=0;
00034   fmc1.ireturn=0;
00035   initial_params::xinit(u);    // get the initial values into the
00036   u.initialize();
00037 
00038   ofstream * tmpfile= ad_comm::global_savefile;
00039   ad_comm::global_savefile=new ofstream("catageqd.ppp");
00040   if (ad_comm::global_savefile)
00041   {
00042     for (int i=0;i<initial_params::num_initial_params;i++)
00043     {
00044        (initial_params::varsptr[i])->save_value();
00045     }
00046     delete ad_comm::global_savefile;
00047     ad_comm::global_savefile=tmpfile;
00048   }
00049 
00050   system(" catageqd -nox -nohess -crit 1.e-10 -ainp catageqd.ppp ");
00051 
00052   uistream ifs("uval.dat");
00053 
00054   ifs >> u;
00055 
00056   return u;
00057 }
00058 
00059 /*
00060 For no laplace
00061 dvector laplace_approximation_calculator::get_uhat_quasi_newton_qd
00062   (const dvector& x,function_minimizer * pfmin)
00063 {
00064   dvector u(1,1)
00065   return u;
00066 }
00067 */