# Changeset 1474

Ignore:
Timestamp:
Aug 2, 2009 11:51:37 PM (11 years ago)
Message:

trunk: Compute reverse jacobian and Hessian along side each other.

sparse_vec_ad.cpp: better testing of sparsity pattern for Hessians.
rev_sparse_hes.cpp: better testing of sparsity pattern for Hessians.
prototype_op.hpp: change reverse jacobian to compute along side Hessian.
op_code.hpp: fix printing of load and store parameter indexing.
rev_sparse_hes.hpp: change reverse jacobian to compute along side Hessian.
cond_op.hpp: change reverse jacobian to compute along side Hessian.
rev_hes_sweep.hpp: change reverse jacobian to compute along side Hessian.
sparse_binary_op.hpp: change reverse jacobian to compute along side Hessian.
sparse_unary_op.hpp: change reverse jacobian to compute along side Hessian.

Location:
trunk
Files:
9 edited

### Legend:

Unmodified
Removed

 r1469 \copydetails sparse_conditional_exp_op \param z_jac is all true (ones complement of 0) if the scalar valued function we are computing the Hessian sparsity for has a non-zero partial with respect to the variable z (actually may have a non-zero partial with respect to z). Otherwise it zero. \param jac_reverse \a jac_reverse[i_z] is all zero (ones) if the Jacobian of G with respect to z is zero (non-zero). \n \n \a jac_reverse[ arg[4] ] If y_2 is a variable, \a jac_reverse[ arg[4] ] is all zero (ones) if the Jacobian with respect to y_2 is zero (non-zero). On input, it corresponds to the function G, and on output it corresponds to the function H. \n \n \a jac_reverse[ arg[5] ] If y_3 is a variable, \a jac_reverse[ arg[5] ] is all zero (ones) if the Jacobian with respect to y_3 is zero (non-zero). On input, it corresponds to the function G, and on output it corresponds to the function H. \param hes_sparsity \n \n If y_2 is a variable, For k = 0 , ... , nc_sparsity-1, \a sparsity [ \a arg[4] * nc_sparsity + k ] \n \n If y_3 is a variable, For k = 0 , ... , nc_sparsity-1, \a sparsity [ \a arg[5] * nc_sparsity + k ] const size_t*  arg           , size_t         num_par       , Pack           z_jac         , Pack*          jac_reverse   , size_t         nc_sparsity   , Pack*          hes_sparsity  ) while(k--) y_2_hes[k] |= z_hes[k]; jac_reverse[ arg[4] ] |= jac_reverse[i_z]; } if( arg[1] & 8 ) while(k--) y_3_hes[k] |= z_hes[k]; jac_reverse[ arg[5] ] |= jac_reverse[i_z]; } return;

 r1447 CPPAD_ASSERT_UNKNOWN( NumArg(op) == 3 ); printOpField(os, "off=", ind[0], ncol); printOpField(os, "  p=", *(Rec->GetPar(ind[1])), ncol); printOpField(os, "idx=", ind[1], ncol); break; CPPAD_ASSERT_UNKNOWN( NumArg(op) == 3 ); printOpField(os, "off=", ind[0], ncol); printOpField(os, " pl=", *(Rec->GetPar(ind[1])), ncol); printOpField(os, "idx=", ind[1], ncol); printOpField(os, " pr=", *(Rec->GetPar(ind[2])), ncol); break; CPPAD_ASSERT_UNKNOWN( NumArg(op) == 3 ); printOpField(os, "off=", ind[0], ncol); printOpField(os, " pl=", *(Rec->GetPar(ind[1])), ncol); printOpField(os, "idx=", ind[1], ncol); printOpField(os, " vr=", ind[2], ncol); break;

 r1468 i.e. the row index in sparsity corresponding to x. \param jac_z is all zero (ones) if the Jacobian of G with respect to z is zero (non-zero). \param jac_reverse \a jac_reverse[i_z] is all zero (ones) if the Jacobian of G with respect to z is zero (non-zero). \n \n \a jac_reverse[i_x] is all zero (ones) if the Jacobian with respect to x is zero (non-zero). On input, it corresponds to the function G, and on output it corresponds to the function H. \param nc_sparsity the number of columns in the sparsity pattern matrices. \param jac_sparsity \param jac_forward for k = 0 , ... , \a nc_sparsity - 1, jac_sparsity[ \a i_x * \a nc_sparsity + k ] jac_forward[ \a i_x * \a nc_sparsity + k ] is the forward mode Jacobian sparsity pattern for the variable x. \param hes_sparsity \b Input: hes_sparsity[ \a i_z * \a nc_sparsity + k ] hes_sparsity[ \a i_z * \a nc_sparsity + k ] for k = 0 , ... , \a nc_sparsity -1 is the Hessian sparsity pattern for the fucntion G where one of the partials derivative is with respect to z. \n \b Input: hes_sparsity[ \a i_x * \a nc_sparsity + k ] \n hes_sparsity[ \a i_x * \a nc_sparsity + k ] for k = 0 , ... , \a nc_sparsity -1 is the Hessian sparsity pattern for the fucntion G where one of the partials derivative is with respect to y. \n \b Output: hes_sparsity[ \a i_x * \a nc_sparsity + k ] for k = 0 , ... , \a nc_sparsity -1 is the Hessian sparsity pattern for the fucntion H where one of the partials derivative is with respect to y. is the Hessian sparsity pattern where one of the partials derivative is with respect to x. On input, it corresonds to the function G, and on output it corresponds to the function H. \par Checked Assertions: size_t      i_z           , size_t      i_x           , Pack        jac_z         , Pack*       jac_reverse   , size_t      nc_sparsity   , const Pack* jac_sparsity  , const Pack* jac_forward   , Pack*       hes_sparsity  ) { i.e. the row index in sparsity corresponding to y. \param z_jac is all true (ones complement of 0) if the scalar valued function we are computing the Hessian sparsity for has a non-zero partial with respect to the variable z (actually may have a non-zero partial with respect to z). Otherwise it zero. (not used by add and subtract operators). \param jac_reverse \a jac_reverse[i_z] is all zero (ones) if the Jacobian of G with respect to z is zero (non-zero). \n \n \a jac_reverse[ \a arg[0] ] is all zero (ones) if the Jacobian with respect to x is zero (non-zero). On input, it corresponds to the function G, and on output it corresponds to the function H. \n \n \a jac_reverse[ \a arg[1] ] is all zero (ones) if the Jacobian with respect to y is zero (non-zero). On input, it corresponds to the function G, and on output it corresponds to the function H. \param nc_sparsity the number of columns in the sparsity pattern matrix. \param jac_sparsity \param jac_forward For j = 0 , ... , \a nc_sparsity - 1, jac_sparsity[ \a arg[0] * \a nc_sparsity + j ] jac_forward[ \a arg[0] * \a nc_sparsity + j ] is the forward mode Jacobiain sparsity pattern for the variable x. \n \n For j = 0 , ... , \a nc_sparsity - 1, jac_sparsity[ \a arg[1] * \a nc_sparsity + j ] jac_forward[ \a arg[1] * \a nc_sparsity + j ] is the forward mode Jacobiain sparsity pattern for the variable y. (These values are not used by add and subtract operators) \param hes_sparsity \b Input: for j = 0 , ... , \a nc_sparsity - 1, For j = 0 , ... , \a nc_sparsity - 1, hes_sparsity [ \a i_z * \a nc_sparsity + j ] is the Hessian sparsity pattern for the function G where one of the partial derivatives is with respect to z. \n \b Input: for j = 0 , ... , \a nc_sparsity - 1, For j = 0 , ... , \a nc_sparsity - 1, hes_sparsity [ \a arg[0] * \a nc_sparsity + j ] is the Hessian sparsity pattern for the function G is the Hessian sparsity pattern where one of the partial derivatives is with respect to x. \n \b Input: for j = 0 , ... , \a nc_sparsity - 1, On input, it corresponds to the function G, and on output it correspondst to H. \n For j = 0 , ... , \a nc_sparsity - 1, hes_sparsity [ \a arg[1] * \a nc_sparsity + j ] is the Hessian sparsity pattern for the function G is the Hessian sparsity pattern where one of the partial derivatives is with respect to y. \n \b Output: for j = 0 , ... , \a nc_sparsity - 1, hes_sparsity [ \a arg[0] * \a nc_sparsity + j ] is the Hessian sparsity pattern for the function H where one of the partial derivatives is with respect to x. \n \b Output: for j = 0 , ... , \a nc_sparsity - 1, hes_sparsity [ \a arg[1] * \a nc_sparsity + j ] is the Hessian sparsity pattern for the function H where one of the partial derivatives is with respect to y. On input, it corresponds to the function G, and on output it correspondst to H. \par Checked Assertions: size_t            i_z           , const size_t*     arg           , Pack              z_jac         , Pack*             jac_reverse   , size_t            nc_sparsity   , const Pack*       jac_sparsity  , const Pack*       jac_forward   , Pack*             hes_sparsity  ) {

 r1401 } // comput the reverse mode Jacobian sparsity RevJacSweep(1, total_num_var_, &play_, taylor_col_dim_, taylor_, RevJac); // compute the Hessian sparsity patterns RevHesSweep(