Revision 1109 trunk/src/df1b2-separable/df1b2imp.cpp

df1b2imp.cpp (revision 1109)
2 2
 * $Id$
3 3
 *
4 4
 * Author: David Fournier
5
 * Copyright (c) 2008-2012 Regents of the University of California 
5
 * Copyright (c) 2008-2012 Regents of the University of California
6 6
 */
7 7
/**
8 8
 * \file
......
29 29
  gradient_structure::set_YES_DERIVATIVES();
30 30
  int nvar=x.size()+u0.size()+u0.size()*u0.size();
31 31
  independent_variables y(1,nvar);
32
  
32

  
33 33
  // need to set random effects active together with whatever
34 34
  // init parameters should be active in this phase
35
  initial_params::set_inactive_only_random_effects(); 
36
  initial_params::set_active_random_effects(); 
37
  /*int onvar=*/initial_params::nvarcalc(); 
35
  initial_params::set_inactive_only_random_effects();
36
  initial_params::set_active_random_effects();
37
  /*int onvar=*/initial_params::nvarcalc();
38 38
  initial_params::xinit(y);    // get the initial values into the
39 39
  // do we need this next line?
40 40
  y(1,xs)=x;
......
55 55
    for (j=1;j<=us;j++)
56 56
    y(ii++)=Hess(i,j);
57 57

  
58
  dvar_vector vy=dvar_vector(y); 
58
  dvar_vector vy=dvar_vector(y);
59 59
  initial_params::stddev_vscale(d,vy);
60 60
  dvar_matrix vHess(1,us,1,us);
61 61
  ii=xs+us+1;
......
85 85
   for (int is=1;is<=nsamp;is++)
86 86
   {
87 87
     dvar_vector tau=ch*pmin->lapprox->epsilon(is);
88
    
88

  
89 89
     vy(xs+1,xs+us).shift(1)+=tau;
90 90
     initial_params::reset(vy);    // get the values into the model
91 91
     vy(xs+1,xs+us).shift(1)-=tau;
......
112 112

  
113 113

  
114 114
   dvariable min_vf=min(sample_value);
115
   vf=min_vf-log(mean(exp(min_vf-sample_value))); 
116
   vf-=us*0.91893853320467241; 
117
   
115
   vf=min_vf-log(mean(exp(min_vf-sample_value)));
116
   vf-=us*0.91893853320467241;
117

  
118 118
   int sgn=0;
119 119
   dvariable ld;
120 120
   if (ad_comm::no_ln_det_choleski_flag)
......
132 132
   vy(xs+1,xs+us).shift(1)=u0;
133 133
   initial_params::reset(vy);    // get the values into the model
134 134
   gradient_structure::set_YES_DERIVATIVES();
135
  
135

  
136 136
  ii=1;
137 137
  for (i=1;i<=xs;i++)
138 138
    xadjoint(i)=g(ii++);

Also available in: Unified diff