Changeset 2988
 Timestamp:
 Oct 21, 2013 11:50:46 AM (6 years ago)
 Location:
 branches/opt_cond_exp
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

branches/opt_cond_exp/cppad/local/rev_hes_sweep.hpp
r2981 r2988 275 275 case BeginOp: 276 276 CPPAD_ASSERT_NARG_NRES(op, 1, 1) 277 break; 278 //  279 280 case CSkipOp: 281 // CSkipOp has a variable number of arguments and 282 // next_reverse thinks it one has one argument. 283 // We must inform next_reverse of this special case. 284 play>reverse_cskip(op, arg, i_op, i_var); 277 285 break; 278 286 //  
branches/opt_cond_exp/test_more/optimize.cpp
r2987 r2988 882 882 return ok; 883 883 } 884 bool forward_sparse_jacobian _csum()884 bool forward_sparse_jacobian() 885 885 { bool ok = true; 886 886 using namespace CppAD; … … 964 964 return ok; 965 965 } 966 bool reverse_sparse_jacobian _csum()966 bool reverse_sparse_jacobian() 967 967 { bool ok = true; 968 968 using namespace CppAD; … … 1043 1043 return ok; 1044 1044 } 1045 bool reverse_sparse_hessian _csum(void)1045 bool reverse_sparse_hessian(void) 1046 1046 { bool ok = true; 1047 1047 using CppAD::AD; 1048 1048 size_t i, j; 1049 1049 1050 size_t n = 2;1050 size_t n = 3; 1051 1051 CppAD::vector< AD<double> > X(n); 1052 1052 X[0] = 1.; 1053 1053 X[1] = 2.; 1054 X[2] = 3.; 1054 1055 CppAD::Independent(X); 1055 1056 1056 1057 size_t m = 1; 1057 1058 CppAD::vector< AD<double> > Y(m); 1058 Y[0] = (2. + X[0] + X[1] + 3.) * X[0]; 1059 Y[0] = CondExpGe( X[0], X[1], 1060 X[0] + (2. + X[1] + 3.) * X[1], 1061 X[0] + (2. + X[2] + 3.) * X[1] 1062 ); 1059 1063 1060 1064 CppAD::vector<bool> check(n * n); 1061 check[0 * n + 0] = true; // partial w.r.t. x[0], x[0] 1062 check[0 * n + 1] = true; // x[0], x[1] 1063 check[1 * n + 0] = true; // x[1], x[0] 1064 check[1 * n + 1] = false; // x[1], x[1] 1065 check[0 * n + 0] = false; // partial w.r.t. x[0], x[0] 1066 check[0 * n + 1] = false; // x[0], x[1] 1067 check[0 * n + 2] = false; // x[0], x[2] 1068 1069 check[1 * n + 0] = false; // partial w.r.t. x[1], x[0] 1070 check[1 * n + 1] = true; // x[1], x[1] 1071 check[1 * n + 2] = true; // x[1], x[2] 1072 1073 check[2 * n + 0] = false; // partial w.r.t. x[2], x[0] 1074 check[2 * n + 1] = true; // x[2], x[1] 1075 check[2 * n + 2] = false; // x[2], x[2] 1065 1076 1066 1077 // create function object F : X > Y … … 1324 1335 ok &= forward_csum(); 1325 1336 ok &= reverse_csum(); 1326 ok &= forward_sparse_jacobian_csum(); 1327 ok &= reverse_sparse_jacobian_csum(); 1328 ok &= reverse_sparse_hessian_csum(); 1337 // sparsity patterns 1338 ok &= forward_sparse_jacobian(); 1339 ok &= reverse_sparse_jacobian(); 1340 ok &= reverse_sparse_hessian(); 1329 1341 // check that CondExp properly detects dependencies 1330 1342 ok &= cond_exp_depend();
Note: See TracChangeset
for help on using the changeset viewer.