Changeset 2919
 Timestamp:
 Oct 11, 2013 1:21:15 AM (6 years ago)
 Location:
 trunk/cppad/local
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/cppad/local/load_op.hpp
r2910 r2919 22 22 Setting a variable so that it corresponds to current value of a VecAD element. 23 23 */ 24 25 /*! 26 Prototype for zero order forward mode implementation of op = LdpOp or LdvOp. 27 28 The C++ source code corresponding to this operation is 29 \verbatim 30 z = y[x] 31 \endverbatim 32 where y is a VecAD<Base> vector and x is an AD<Base> index. 33 We define the index corresponding to y[x] by 34 \verbatim 35 i_y_x = combined[ arg[0] + i_vec ] 36 \endverbatim 37 where i_vec is defined under the heading \a arg[1] below: 38 39 \tparam Base 40 base type for the operator; i.e., this operation was recorded 41 using AD< \a Base > and computations by this routine are done using type 42 \a Base. 43 44 \param i_z 45 is the AD variable index corresponding to the variable z. 46 47 \param arg 48 \n 49 \a arg[0] 50 is the offset of this VecAD vector relative to the beginning 51 of the \a combined VecAD array. 52 \n 53 \n 54 \a arg[1] 55 \n 56 If this is the LdpOp operation 57 (the index x is a parameter), i_vec is defined by 58 \verbatim 59 i_vec = arg[1] 60 \endverbatim 61 If this is the LdvOp operation 62 (the index x is a variable), i_vec is defined by 63 \verbatim 64 i_vec = floor( taylor[ arg[1] * nc_taylor + 0 ] ) 65 \endverbatim 66 where floor(c) is the greatest integer less that or equal c. 67 \n 68 \a arg[2] 69 \b Input: The input value of \a arg[2] does not matter. 70 \n 71 \b Output: 72 If y[x] is a parameter, \a arg[2] is set to zero 73 (which is not a valid variable index). 74 If y[x] is a variable, 75 \a arg[2] is set to the variable index corresponding to y[x]; i.e. i_y_x. 76 77 \param num_par 78 is the number of parameters in \a parameter. 79 80 \param parameter 81 If y[x] is a parameter, \a parameter [ i_y_x ] is its value. 82 83 \param nc_taylor 84 number of columns in the matrix containing the Taylor coefficients. 85 86 \param taylor 87 \b Input: in LdvOp case, \a taylor[ arg[1] * nc_taylor + 0 ] 88 is used to compute the index in the definition of i_vec above 89 \n 90 \b Input: if y[x] is a variable, \a taylor[ i_y_x * nc_taylor + 0 ] 91 is the zero order Taylor coefficient for y[x]. 92 \n 93 \b Output: \a taylor[ i_z * nc_taylor + 0 ] 94 is the zero order Taylor coefficient for the variable z. 95 96 \param nc_combined 97 is the total number of elements in the combined VecAD array. 98 99 \param variable 100 If \a variable [ \a arg[0] + i_vec ] is true, 101 y[x] is a variable. Otherwise it is a parameter. 102 103 \param combined 104 \b Input: \a combined[ \a arg[0]  1 ] 105 is the number of elements in the VecAD vector containing this element. 106 \n 107 \b Input: \a combined[ \a arg[0] + i_vec ] 108 if y[x] is a variable, i_y_x 109 is its index in the Taylor coefficient array \a taylor. 110 Otherwise, i_y_x is its index in parameter array \a parameter. 111 112 \par Check User Errors 113 \li In the LdvOp case check that the index is with in range; i.e. 114 i_vec < combined[ \a arg[0]  1 ] 115 116 \par Checked Assertions 117 \li combined != CPPAD_NULL 118 \li variable != CPPAD_NULL 119 \li NumArg(LdpOp) == 3 120 \li NumRes(LdpOp) == 1 121 \li 0 < \a arg[0] 122 \li \a arg[0] + i_vec < nc_combined 123 \li i_vec < combined[ \a arg[0]  1 ] 124 \li if y[x] is a parameter, i_y_x < num_par 125 \li if y[x] is a variable, i_y_x < i_z 126 \li if x is a variable (LpvOp case), arg[1] < i_z 127 */ 128 template <class Base> 129 inline void forward_load_op_0( 130 size_t i_z , 131 addr_t* arg , 132 size_t num_par , 133 const Base* parameter , 134 size_t nc_taylor , 135 Base* taylor , 136 size_t nc_combined , 137 const bool* variable , 138 const size_t* combined ) 139 { 140 // This routine is only for documentaiton, it should not be used 141 CPPAD_ASSERT_UNKNOWN( false ); 142 } 143 /*! 144 Prototype sparsity operations corresponding to op = LdpOp or LdvOp. 145 146 <! define sparse_load_op > 147 The C++ source code corresponding to this operation is 148 \verbatim 149 z = v[x] 150 \endverbatim 151 where v is a VecAD<Base> vector and x is an AD<Base> index. 152 153 \tparam Vector_set 154 is the type used for vectors of sets. It can be either 155 \c sparse_pack, \c sparse_set, or \c sparse_list. 156 157 \param op 158 is the code corresponding to this operator; i.e., LdpOp or LdvOp 159 (only used for error checking). 160 161 \param i_z 162 is the AD variable index corresponding to the variable z; i.e., 163 the set with index \a i_z in \a var_sparsity is the sparsity pattern 164 correpsonding to z. 165 166 \param arg 167 \n 168 \a arg[0] 169 is the offset corresponding to this VecAD vector in the VecAD combined array. 170 171 \param num_combined 172 is the total number of elements in the VecAD combinded array. 173 174 \param combined 175 is the VecAD combined array. 176 \n 177 \n 178 \a combined[ \a arg[0]  1 ] 179 is the index of the set corresponding to the vector v in \a vecad_sparsity. 180 We use the notation i_v for this value; i.e., 181 \verbatim 182 i_v = combined[ \a arg[0]  1 ] 183 \endverbatim 184 185 \param var_sparsity 186 The set with index \a i_z in \a var_sparsity is the sparsity pattern for z. 187 This is an output for forward mode operations, 188 and an input for reverse mode operations. 189 190 \param vecad_sparsity 191 The set with index \a i_v is the sparsity pattern for the vector v. 192 This is an input for forward mode operations. 193 For reverse mode operations, 194 the sparsity pattern for z is added to the sparsity pattern for v. 195 196 \par Checked Assertions 197 \li NumArg(op) == 3 198 \li NumRes(op) == 1 199 \li 0 < \a arg[0] 200 \li \a arg[0] < \a num_combined 201 \li i_v < \a vecad_sparsity.n_set() 202 <! end sparse_load_op > 203 */ 204 template <class Vector_set> 205 inline void sparse_load_op( 206 OpCode op , 207 size_t i_z , 208 const addr_t* arg , 209 size_t num_combined , 210 const size_t* combined , 211 Vector_set& var_sparsity , 212 Vector_set& vecad_sparsity ) 213 { 214 // This routine is only for documentaiton, it should not be used 215 CPPAD_ASSERT_UNKNOWN( false ); 216 } 217 24 218 25 219 /*! … … 373 567 \endverbatim 374 568 375 \copydetails sparse_load_op 569 <! replace sparse_load_op > 570 The C++ source code corresponding to this operation is 571 \verbatim 572 z = v[x] 573 \endverbatim 574 where v is a VecAD<Base> vector and x is an AD<Base> index. 575 576 \tparam Vector_set 577 is the type used for vectors of sets. It can be either 578 \c sparse_pack, \c sparse_set, or \c sparse_list. 579 580 \param op 581 is the code corresponding to this operator; i.e., LdpOp or LdvOp 582 (only used for error checking). 583 584 \param i_z 585 is the AD variable index corresponding to the variable z; i.e., 586 the set with index \a i_z in \a var_sparsity is the sparsity pattern 587 correpsonding to z. 588 589 \param arg 590 \n 591 \a arg[0] 592 is the offset corresponding to this VecAD vector in the VecAD combined array. 593 594 \param num_combined 595 is the total number of elements in the VecAD combinded array. 596 597 \param combined 598 is the VecAD combined array. 599 \n 600 \n 601 \a combined[ \a arg[0]  1 ] 602 is the index of the set corresponding to the vector v in \a vecad_sparsity. 603 We use the notation i_v for this value; i.e., 604 \verbatim 605 i_v = combined[ \a arg[0]  1 ] 606 \endverbatim 607 608 \param var_sparsity 609 The set with index \a i_z in \a var_sparsity is the sparsity pattern for z. 610 This is an output for forward mode operations, 611 and an input for reverse mode operations. 612 613 \param vecad_sparsity 614 The set with index \a i_v is the sparsity pattern for the vector v. 615 This is an input for forward mode operations. 616 For reverse mode operations, 617 the sparsity pattern for z is added to the sparsity pattern for v. 618 619 \par Checked Assertions 620 \li NumArg(op) == 3 621 \li NumRes(op) == 1 622 \li 0 < \a arg[0] 623 \li \a arg[0] < \a num_combined 624 \li i_v < \a vecad_sparsity.n_set() 625 <! end sparse_load_op > 376 626 377 627 \param var_jacobian … … 415 665 416 666 417 418 667 /*! \} */ 419 668 } // END_CPPAD_NAMESPACE 
trunk/cppad/local/prototype_op.hpp
r2918 r2919 945 945 // ==================== VecAD Operations ============================== 946 946 /*! 947 Prototype for zero order forward mode implementation of op = LdpOp or LdvOp.948 949 The C++ source code corresponding to this operation is950 \verbatim951 z = y[x]952 \endverbatim953 where y is a VecAD<Base> vector and x is an AD<Base> index.954 We define the index corresponding to y[x] by955 \verbatim956 i_y_x = combined[ arg[0] + i_vec ]957 \endverbatim958 where i_vec is defined under the heading \a arg[1] below:959 960 \tparam Base961 base type for the operator; i.e., this operation was recorded962 using AD< \a Base > and computations by this routine are done using type963 \a Base.964 965 \param i_z966 is the AD variable index corresponding to the variable z.967 968 \param arg969 \n970 \a arg[0]971 is the offset of this VecAD vector relative to the beginning972 of the \a combined VecAD array.973 \n974 \n975 \a arg[1]976 \n977 If this is the LdpOp operation978 (the index x is a parameter), i_vec is defined by979 \verbatim980 i_vec = arg[1]981 \endverbatim982 If this is the LdvOp operation983 (the index x is a variable), i_vec is defined by984 \verbatim985 i_vec = floor( taylor[ arg[1] * nc_taylor + 0 ] )986 \endverbatim987 where floor(c) is the greatest integer less that or equal c.988 \n989 \a arg[2]990 \b Input: The input value of \a arg[2] does not matter.991 \n992 \b Output:993 If y[x] is a parameter, \a arg[2] is set to zero994 (which is not a valid variable index).995 If y[x] is a variable,996 \a arg[2] is set to the variable index corresponding to y[x]; i.e. i_y_x.997 998 \param num_par999 is the number of parameters in \a parameter.1000 1001 \param parameter1002 If y[x] is a parameter, \a parameter [ i_y_x ] is its value.1003 1004 \param nc_taylor1005 number of columns in the matrix containing the Taylor coefficients.1006 1007 \param taylor1008 \b Input: in LdvOp case, \a taylor[ arg[1] * nc_taylor + 0 ]1009 is used to compute the index in the definition of i_vec above1010 \n1011 \b Input: if y[x] is a variable, \a taylor[ i_y_x * nc_taylor + 0 ]1012 is the zero order Taylor coefficient for y[x].1013 \n1014 \b Output: \a taylor[ i_z * nc_taylor + 0 ]1015 is the zero order Taylor coefficient for the variable z.1016 1017 \param nc_combined1018 is the total number of elements in the combined VecAD array.1019 1020 \param variable1021 If \a variable [ \a arg[0] + i_vec ] is true,1022 y[x] is a variable. Otherwise it is a parameter.1023 1024 \param combined1025 \b Input: \a combined[ \a arg[0]  1 ]1026 is the number of elements in the VecAD vector containing this element.1027 \n1028 \b Input: \a combined[ \a arg[0] + i_vec ]1029 if y[x] is a variable, i_y_x1030 is its index in the Taylor coefficient array \a taylor.1031 Otherwise, i_y_x is its index in parameter array \a parameter.1032 1033 \par Check User Errors1034 \li In the LdvOp case check that the index is with in range; i.e.1035 i_vec < combined[ \a arg[0]  1 ]1036 1037 \par Checked Assertions1038 \li combined != CPPAD_NULL1039 \li variable != CPPAD_NULL1040 \li NumArg(LdpOp) == 31041 \li NumRes(LdpOp) == 11042 \li 0 < \a arg[0]1043 \li \a arg[0] + i_vec < nc_combined1044 \li i_vec < combined[ \a arg[0]  1 ]1045 \li if y[x] is a parameter, i_y_x < num_par1046 \li if y[x] is a variable, i_y_x < i_z1047 \li if x is a variable (LpvOp case), arg[1] < i_z1048 */1049 template <class Base>1050 inline void forward_load_op_0(1051 size_t i_z ,1052 addr_t* arg ,1053 size_t num_par ,1054 const Base* parameter ,1055 size_t nc_taylor ,1056 Base* taylor ,1057 size_t nc_combined ,1058 const bool* variable ,1059 const size_t* combined )1060 {1061 // This routine is only for documentaiton, it should not be used1062 CPPAD_ASSERT_UNKNOWN( false );1063 }1064 /*!1065 Prototype sparsity operations corresponding to op = LdpOp or LdvOp.1066 1067 The C++ source code corresponding to this operation is1068 \verbatim1069 z = v[x]1070 \endverbatim1071 where v is a VecAD<Base> vector and x is an AD<Base> index.1072 1073 \tparam Vector_set1074 is the type used for vectors of sets. It can be either1075 \c sparse_pack, \c sparse_set, or \c sparse_list.1076 1077 \param op1078 is the code corresponding to this operator; i.e., LdpOp or LdvOp1079 (only used for error checking).1080 1081 \param i_z1082 is the AD variable index corresponding to the variable z; i.e.,1083 the set with index \a i_z in \a var_sparsity is the sparsity pattern1084 correpsonding to z.1085 1086 \param arg1087 \n1088 \a arg[0]1089 is the offset corresponding to this VecAD vector in the VecAD combined array.1090 1091 \param num_combined1092 is the total number of elements in the VecAD combinded array.1093 1094 \param combined1095 is the VecAD combined array.1096 \n1097 \n1098 \a combined[ \a arg[0]  1 ]1099 is the index of the set corresponding to the vector v in \a vecad_sparsity.1100 We use the notation i_v for this value; i.e.,1101 \verbatim1102 i_v = combined[ \a arg[0]  1 ]1103 \endverbatim1104 1105 \param var_sparsity1106 The set with index \a i_z in \a var_sparsity is the sparsity pattern for z.1107 This is an output for forward mode operations,1108 and an input for reverse mode operations.1109 1110 \param vecad_sparsity1111 The set with index \a i_v is the sparsity pattern for the vector v.1112 This is an input for forward mode operations.1113 For reverse mode operations,1114 the sparsity pattern for z is added to the sparsity pattern for v.1115 1116 \par Checked Assertions1117 \li NumArg(op) == 31118 \li NumRes(op) == 11119 \li 0 < \a arg[0]1120 \li \a arg[0] < \a num_combined1121 \li i_v < \a vecad_sparsity.n_set()1122 */1123 template <class Vector_set>1124 inline void sparse_load_op(1125 OpCode op ,1126 size_t i_z ,1127 const addr_t* arg ,1128 size_t num_combined ,1129 const size_t* combined ,1130 Vector_set& var_sparsity ,1131 Vector_set& vecad_sparsity )1132 {1133 // This routine is only for documentaiton, it should not be used1134 CPPAD_ASSERT_UNKNOWN( false );1135 }1136 1137 /*!1138 947 Prototype zero order forward implementation of op is one the following: 1139 948 StppOp, StpvOp, StvpOp, or StvvOp.
Note: See TracChangeset
for help on using the changeset viewer.