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

df1b2lp4.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
......
18 18
double calculate_laplace_approximation(const dvector& x,const dvector& u0,
19 19
  const dmatrix& Hess,const dvector& _xadjoint,const dvector& _uadjoint,
20 20
  const dmatrix& _Hessadjoint,function_minimizer * pmin);
21
      
22 21

  
23 22
/**
24 23
 * Description not yet available.
......
38 37
  int num_der_blocks=lpc->num_der_blocks;
39 38
  int xsize=lpc->xsize;
40 39
  int usize=lpc->usize;
41
  
40

  
42 41
  for (int ip=1;ip<=num_der_blocks;ip++)
43 42
  {
44 43
    df1b2variable::minder=lpc->minder(ip);
......
55 54
      Hess.initialize();
56 55
      Dux.initialize();
57 56
    }
58
    
57

  
59 58
    //cout << "2D" << endl;
60 59
    pfmin->user_function();
61
    
60

  
62 61
    //pfmin->user_function(y,zz);
63 62
    (*re_objective_function_value::pobjfun)+=pen;
64 63
    (*re_objective_function_value::pobjfun)+=zz;
65
  
64

  
66 65
    if (!initial_df1b2params::separable_flag)
67 66
    {
68 67
      set_dependent_variable(*re_objective_function_value::pobjfun);
69 68
      df1b2_gradlist::set_no_derivatives();
70 69
      df1b2variable::passnumber=1;
71 70
      df1b2_gradcalc1();
72
    
71

  
73 72
      int mind=y(1).minder;
74 73
      int jmin=max(mind,xsize+1);
75 74
      int jmax=min(y(1).maxder,xsize+usize);
76 75
      for (i=1;i<=usize;i++)
77 76
        for (j=jmin;j<=jmax;j++)
78 77
          Hess(i,j-xsize)=y(i+xsize).u_bar[j-mind];
79
  
78

  
80 79
      jmin=max(mind,1);
81 80
      jmax=min(y(1).maxder,xsize);
82 81
      for (i=1;i<=usize;i++)
......
91 90
    if (ad_comm::pvm_manager->timing_flag)
92 91
      ad_comm::pvm_manager->tm.get_elapsed_time_and_reset();
93 92
  }
94
  
93

  
95 94
  d3_array M1=get_dmatrix_from_slaves();
96 95

  
97 96
  if (ad_comm::pvm_manager)
......
129 128
    if (ad_comm::pvm_manager->timing_flag)
130 129
      ad_comm::pvm_manager->tm.get_elapsed_time_and_reset();
131 130
  }
132
  
131

  
133 132
  imatrix flags=get_int_from_slaves();
134 133
  d3_array Dux1=get_dmatrix_from_slaves(flags);
135 134
  if (ad_comm::pvm_manager)
......
144 143
      }
145 144
    }
146 145
  }
147
  
146

  
148 147
  mmin=Dux1.indexmin();
149 148
  mmax=Dux1.indexmax();
150 149
  for (k=mmin;k<=mmax;k++)
......
184 183
  int i,j;
185 184

  
186 185
  send_dvector_to_slaves(x);
187
  initial_params::set_inactive_only_random_effects(); 
186
  initial_params::set_inactive_only_random_effects();
188 187
  gradient_structure::set_NO_DERIVATIVES();
189 188
  initial_params::reset(x);    // get current x values into the model
190 189
  gradient_structure::set_YES_DERIVATIVES();
191 190

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff