ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mceval.cpp
Go to the documentation of this file.
1 
8 #include <admodel.h>
9 
15 {
18  uistream* pifs_psave = NULL;
19 
21 
22  int nvar1=initial_params::nvarcalc(); // get the number of active parameters
23  int nvar = 0;
24 
25  pifs_psave= new
26  uistream((char*)(ad_comm::adprogram_name + adstring(".psv")));
27  if (!pifs_psave || !(*pifs_psave))
28  {
29  cerr << "Error opening file "
30  << (char*)(ad_comm::adprogram_name + adstring(".psv"))
31  << endl;
32  if (pifs_psave)
33  {
34  delete pifs_psave;
35  pifs_psave=NULL;
36  return;
37  }
38  }
39  else
40  {
41  (*pifs_psave) >> nvar;
42  if (nvar!=nvar1)
43  {
44  cout << "Incorrect value for nvar in file "
45  << "should be " << nvar1 << " but read " << nvar << endl;
46  if (pifs_psave)
47  {
48  delete pifs_psave;
49  pifs_psave=NULL;
50  }
51  return;
52  }
53  }
54 
55  independent_variables y(1,nvar);
56 
57  for (;;)
58  {
59  if (pifs_psave->eof())
60  {
61  break;
62  }
63  else
64  {
65  (*pifs_psave) >> y;
66  if (pifs_psave->eof())
67  {
68  break;
69  }
70  int ii=1;
73  /*double ll=-*/get_monte_carlo_value(nvar,y);
74  }
75  }
76 
77  if (pifs_psave)
78  {
79  delete pifs_psave;
80  pifs_psave=NULL;
81  }
82 }
static void restore_all_values(const dvector &x, const int &ii)
Definition: model3.cpp:105
static void set_NO_DERIVATIVES(void)
Disable accumulation of derivative information.
Definition: gradstrc.cpp:641
static void set_active_random_effects(void)
Definition: model.cpp:267
static adstring adprogram_name
Definition: fvar.hpp:8860
static int nvarcalc()
Definition: model.cpp:152
prnstream & endl(prnstream &)
Description not yet available.
Definition: fvar.hpp:1937
static int current_phase
Definition: admodel.h:842
static int max_number_phases
Definition: admodel.h:841
Description not yet available.
static void xinit(const dvector &x)
Definition: model.cpp:226
Description not yet available.
Definition: fvar.hpp:3516
void mcmc_eval(void)
Description not yet available.
Definition: mceval.cpp:14
double get_monte_carlo_value(int nvar, const independent_variables &x)
Definition: mod_mc2.cpp:11