ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
f1b2lapqd.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id$
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 #include <cassert>
00015 
00016 //dvariable AD_uf_inner(const dvector& x,const dvar_vector& u);
00017 void get_second_ders(int xs,int us,const init_df1b2vector y,dmatrix& Hess,
00018   dmatrix& Dux, df1b2_gradlist * f1b2gradlist,function_minimizer * pfmin);
00019 double calculate_laplace_approximation(const dvector& x,const dvector& u0,
00020   const dmatrix& Hess,const dvector& _xadjoint,const dvector& _uadjoint,
00021   const dmatrix& _Hessadjoint,function_minimizer * pmin);
00022 
00027 dvector laplace_approximation_calculator::get_uhat_quasi_newton_qd
00028   (const dvector& x,function_minimizer * pfmin)
00029 {
00030   dvector g(1,usize);
00031   independent_variables u(1,usize);
00032   fmc1.itn=0;
00033   fmc1.crit=1.e-9;
00034   fmc1.ifn=0;
00035   fmc1.ireturn=0;
00036   initial_params::xinit(u);    // get the initial values into the
00037   u.initialize();
00038 
00039   ofstream ofs("catageqd.ppp");
00040   if (ofs.good())
00041   {
00042     for (int i=0;i<initial_params::num_initial_params;i++)
00043     {
00044       initial_params::varsptr[i]->save_value(ofs);
00045     }
00046   }
00047   ofs.close();
00048 
00049   int ret = system(" catageqd -nox -nohess -crit 1.e-10 -ainp catageqd.ppp ");
00050   assert(ret == 0);
00051 
00052   uistream ifs("uval.dat");
00053 
00054   ifs >> u;
00055 
00056   ifs.close();
00057 
00058   return u;
00059 }
00060 
00061 /*
00062 For no laplace
00063 dvector laplace_approximation_calculator::get_uhat_quasi_newton_qd
00064   (const dvector& x,function_minimizer * pfmin)
00065 {
00066   dvector u(1,1)
00067   return u;
00068 }
00069 */