Changeset 2970 for branches/opt_cond_exp/cppad/local/forward_sweep.hpp
 Timestamp:
 Oct 18, 2013 10:16:02 PM (7 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/opt_cond_exp/cppad/local/forward_sweep.hpp
r2910 r2970 120 120 index i on the tape. 121 121 122 \param cskip_var 123 Is a vector with size \c numvar, 124 125 \li <tt>q = 0</tt> 126 In this case, 127 the input value of the elements does not matter. 128 Upon return, if cskip_var[i] is true, the value of variable with index i 129 does not affect any of the dependent variable (given the value 130 of the independent variables). 131 132 \li <tt>q > 0</tt> 133 The vector is not modified and 134 if cskip_var[i] is true, the value of variable with index i 135 does not affect any of the dependent variable (given the value 136 of the independent variables). 137 122 138 \a return 123 139 If \a p is not zero, the return value is zero. … … 139 155 const size_t numvar, 140 156 player<Base> *Rec, 141 const size_t J, 142 Base *Taylor 157 const size_t J, 158 Base *Taylor, 159 CppAD::vector<bool>& cskip_var 143 160 ) 144 161 { CPPAD_ASSERT_UNKNOWN( J >= p + 1 ); … … 166 183 size_t compareCount = 0; 167 184 168 // if this is an order zero calculation, initialize vector indices169 185 pod_vector<size_t> VectorInd; // address for each element 170 186 pod_vector<bool> VectorVar; // is element a variable 171 i = Rec>num_rec_vecad_ind(); 172 if( i > 0 ) 173 { VectorInd.extend(i); 174 VectorVar.extend(i); 175 while(i) 176 { VectorInd[i] = Rec>GetVecInd(i); 177 VectorVar[i] = false; 187 if( q == 0 ) 188 { 189 // this includes order zero calculation, initialize vector indices 190 i = Rec>num_rec_vecad_ind(); 191 if( i > 0 ) 192 { VectorInd.extend(i); 193 VectorVar.extend(i); 194 while(i) 195 { VectorInd[i] = Rec>GetVecInd(i); 196 VectorVar[i] = false; 197 } 178 198 } 199 // includes zero order, so initialize conditional skip flags 200 for(i = 0; i < numvar; i++) 201 cskip_var[i] = false; 179 202 } 180 203 … … 233 256 CPPAD_ASSERT_UNKNOWN( (i_op <= n)  (op != InvOp) ); 234 257 258 // check if we are skipping this operation 259 CPPAD_ASSERT_UNKNOWN( NumRes(CSkipOp) == 0 ); 260 CPPAD_ASSERT_UNKNOWN( NumRes(EndOp) == 0 ); 261 while( cskip_var[i_var] && NumRes(op) > 0 ) 262 { Rec>next_forward(op, arg, i_op, i_var); 263 if( op == CSumOp ) 264 { // CSumOp has a variable number of arguments and 265 Rec>forward_csum(op, arg, i_op, i_var); 266 } 267 } 268 235 269 // action depends on the operator 236 270 switch( op ) … … 298 332 CPPAD_ASSERT_UNKNOWN( i_var < numvar ); 299 333 forward_cosh_op(q, p, i_var, arg[0], J, Taylor); 334 break; 335 //  336 337 case CSkipOp: 338 if( q == 0 ) 339 { // CSumOp has a variable number of arguments and 340 // next_forward thinks it one has one argument. 341 // we must inform next_forward of this special case. 342 Rec>forward_cskip(op, arg, i_op, i_var); 343 forward_cskip_op_0( 344 i_var, arg, num_par, parameter, J, Taylor, cskip_var 345 ); 346 } 300 347 break; 301 348 // 
Note: See TracChangeset
for help on using the changeset viewer.