Revision 1110 trunk/src/df1b2-separable/f1b2fnl3.cpp

f1b2fnl3.cpp (revision 1110)
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
......
23 23
  df1b2_gradlist::set_no_derivatives();
24 24
  df1b2variable::passnumber=1;
25 25
  df1b2_gradcalc1();
26
   
26

  
27 27
  init_df1b2vector & locy= *funnel_init_var::py;
28 28
  imatrix& list=*funnel_init_var::plist;
29 29

  
......
33 33

  
34 34
  for (i=1;i<=funnel_init_var::num_active_parameters;i++)
35 35
  {
36
    if (list(i,1)>xsize) 
36
    if (list(i,1)>xsize)
37 37
    {
38 38
      lre_index(++us)=i;
39 39
    }
40
    else if (list(i,1)>0) 
40
    else if (list(i,1)>0)
41 41
    {
42 42
      lfe_index(++xs)=i;
43 43
    }
44 44
  }
45
  
45

  
46 46
  dvector local_xadjoint(1,xs);
47 47
  dvector local_uadjoint(1,us);
48 48
  for (i=1;i<=xs;i++)
......
58 58
  dvector tmp;
59 59
  if (us>0)
60 60
  {
61
    dmatrix local_Hess(1,us,1,us); 
62
    dvector local_grad(1,us); 
63
    dmatrix local_Dux(1,us,1,xs); 
61
    dmatrix local_Hess(1,us,1,us);
62
    dvector local_grad(1,us);
63
    dmatrix local_Dux(1,us,1,xs);
64 64
    local_Hess.initialize();
65 65
    for (i=1;i<=us;i++)
66 66
    {
......
114 114
  df1b2_gradlist::set_no_derivatives();
115 115
  df1b2variable::passnumber=1;
116 116
  df1b2_gradcalc1();				// Forward mode AD follow by a series of reverse sweeps
117
   
117

  
118 118
  init_df1b2vector & locy= *funnel_init_var::py; // Independent variables for separable function
119 119
  imatrix& list=*funnel_init_var::plist;	 // Index into "locy"
120 120

  
121
  int i; int j; int us=0; int xs=0;		 // us = #u's and xs = #x's 
121
  int i; int j; int us=0; int xs=0;		 // us = #u's and xs = #x's
122 122
  ivector lre_index(1,funnel_init_var::num_active_parameters);
123 123
  ivector lfe_index(1,funnel_init_var::num_active_parameters);
124 124

  
......
129 129
    {
130 130
      lre_index(++us)=i;
131 131
    }
132
    else if (list(i,1)>0) 
132
    else if (list(i,1)>0)
133 133
    {
134 134
      lfe_index(++xs)=i;
135 135
    }
136 136
  }
137
  
137

  
138 138
  dvector local_xadjoint(1,xs);  // First order derivative of ff wrt x
139 139
  for (j=1;j<=xs;j++)
140 140
  {
141 141
    int j2=list(lfe_index(j),2);
142 142
    local_xadjoint(j)=ff.u_dot[j2-1];  // u_dot is the result of forward AD
143 143
  }
144
  
144

  
145 145
  if (us>0)
146 146
  {
147
    // Find Hessian matrix needed for Laplace approximation	  
148
    dmatrix local_Hess(1,us,1,us); 
149
    dvector local_grad(1,us); 
150
    dmatrix local_Dux(1,us,1,xs); 
147
    // Find Hessian matrix needed for Laplace approximation
148
    dmatrix local_Hess(1,us,1,us);
149
    dvector local_grad(1,us);
150
    dmatrix local_Dux(1,us,1,xs);
151 151
    local_Hess.initialize();
152 152
    dvector local_uadjoint(1,us);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff