Changeset 2919


Ignore:
Timestamp:
Oct 11, 2013 1:21:15 AM (6 years ago)
Author:
bradbell
Message:
  1. Fix one doxygen partial copydetails.
  2. Move prototypes from prototype_op.hpp to load_op.hpp.
Location:
trunk/cppad/local
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/cppad/local/load_op.hpp

    r2910 r2919  
    2222Setting a variable so that it corresponds to current value of a VecAD element.
    2323*/
     24
     25/*!
     26Prototype for zero order forward mode implementation of op = LdpOp or LdvOp.
     27
     28The C++ source code corresponding to this operation is
     29\verbatim
     30        z = y[x]
     31\endverbatim
     32where y is a VecAD<Base> vector and x is an AD<Base> index.
     33We define the index corresponding to y[x] by
     34\verbatim
     35        i_y_x = combined[ arg[0] + i_vec ]
     36\endverbatim
     37where i_vec is defined under the heading \a arg[1] below:
     38
     39\tparam Base
     40base type for the operator; i.e., this operation was recorded
     41using AD< \a Base > and computations by this routine are done using type
     42\a Base.
     43
     44\param i_z
     45is the AD variable index corresponding to the variable z.
     46
     47\param arg
     48\n
     49\a arg[0]
     50is the offset of this VecAD vector relative to the beginning
     51of the \a combined VecAD array.
     52\n
     53\n
     54\a arg[1]
     55\n
     56If 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
     61If 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
     66where 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:
     72If y[x] is a parameter, \a arg[2] is set to zero
     73(which is not a valid variable index).
     74If 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
     78is the number of parameters in \a parameter.
     79
     80\param parameter
     81If y[x] is a parameter, \a parameter [ i_y_x ] is its value.
     82
     83\param nc_taylor
     84number 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 ]
     88is 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 ]
     91is the zero order Taylor coefficient for y[x].
     92\n
     93\b Output: \a taylor[ i_z * nc_taylor + 0 ]
     94is the zero order Taylor coefficient for the variable z.
     95
     96\param nc_combined
     97is the total number of elements in the combined VecAD array.
     98
     99\param variable
     100If \a variable [ \a arg[0] + i_vec ] is true,
     101y[x] is a variable.  Otherwise it is a parameter.
     102
     103\param combined
     104\b Input: \a combined[ \a arg[0] - 1 ]
     105is the number of elements in the VecAD vector containing this element.
     106\n
     107\b Input: \a combined[ \a arg[0] + i_vec ]
     108if y[x] is a variable, i_y_x
     109is its index in the Taylor coefficient array \a taylor.
     110Otherwise, 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.
     114i_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*/
     128template <class Base>
     129inline 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/*!
     144Prototype sparsity operations corresponding to op = LdpOp or LdvOp.
     145
     146<!-- define sparse_load_op -->
     147The C++ source code corresponding to this operation is
     148\verbatim
     149        z = v[x]
     150\endverbatim
     151where v is a VecAD<Base> vector and x is an AD<Base> index.
     152
     153\tparam Vector_set
     154is 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
     158is the code corresponding to this operator; i.e., LdpOp or LdvOp
     159(only used for error checking).
     160
     161\param i_z
     162is the AD variable index corresponding to the variable z; i.e.,
     163the set with index \a i_z in \a var_sparsity is the sparsity pattern
     164correpsonding to z.
     165
     166\param arg
     167\n
     168\a arg[0]
     169is the offset corresponding to this VecAD vector in the VecAD combined array.
     170
     171\param num_combined
     172is the total number of elements in the VecAD combinded array.
     173
     174\param combined
     175is the VecAD combined array.
     176\n
     177\n
     178\a combined[ \a arg[0] - 1 ]
     179is the index of the set corresponding to the vector v  in \a vecad_sparsity.
     180We 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
     186The set with index \a i_z in \a var_sparsity is the sparsity pattern for z.
     187This is an output for forward mode operations,
     188and an input for reverse mode operations.
     189
     190\param vecad_sparsity
     191The set with index \a i_v is the sparsity pattern for the vector v.
     192This is an input for forward mode operations.
     193For reverse mode operations,
     194the 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*/
     204template <class Vector_set>
     205inline 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
    24218
    25219/*!
     
    373567\endverbatim
    374568
    375 \copydetails sparse_load_op
     569<!-- replace sparse_load_op -->
     570The C++ source code corresponding to this operation is
     571\verbatim
     572        z = v[x]
     573\endverbatim
     574where v is a VecAD<Base> vector and x is an AD<Base> index.
     575
     576\tparam Vector_set
     577is 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
     581is the code corresponding to this operator; i.e., LdpOp or LdvOp
     582(only used for error checking).
     583
     584\param i_z
     585is the AD variable index corresponding to the variable z; i.e.,
     586the set with index \a i_z in \a var_sparsity is the sparsity pattern
     587correpsonding to z.
     588
     589\param arg
     590\n
     591\a arg[0]
     592is the offset corresponding to this VecAD vector in the VecAD combined array.
     593
     594\param num_combined
     595is the total number of elements in the VecAD combinded array.
     596
     597\param combined
     598is the VecAD combined array.
     599\n
     600\n
     601\a combined[ \a arg[0] - 1 ]
     602is the index of the set corresponding to the vector v  in \a vecad_sparsity.
     603We 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
     609The set with index \a i_z in \a var_sparsity is the sparsity pattern for z.
     610This is an output for forward mode operations,
     611and an input for reverse mode operations.
     612
     613\param vecad_sparsity
     614The set with index \a i_v is the sparsity pattern for the vector v.
     615This is an input for forward mode operations.
     616For reverse mode operations,
     617the 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 -->
    376626
    377627\param var_jacobian
     
    415665
    416666
    417 
    418667/*! \} */
    419668} // END_CPPAD_NAMESPACE
  • trunk/cppad/local/prototype_op.hpp

    r2918 r2919  
    945945// ====================  VecAD Operations     ==============================
    946946/*!
    947 Prototype for zero order forward mode implementation of op = LdpOp or LdvOp.
    948 
    949 The C++ source code corresponding to this operation is
    950 \verbatim
    951         z = y[x]
    952 \endverbatim
    953 where y is a VecAD<Base> vector and x is an AD<Base> index.
    954 We define the index corresponding to y[x] by
    955 \verbatim
    956         i_y_x = combined[ arg[0] + i_vec ]
    957 \endverbatim
    958 where i_vec is defined under the heading \a arg[1] below:
    959 
    960 \tparam Base
    961 base type for the operator; i.e., this operation was recorded
    962 using AD< \a Base > and computations by this routine are done using type
    963 \a Base.
    964 
    965 \param i_z
    966 is the AD variable index corresponding to the variable z.
    967 
    968 \param arg
    969 \n
    970 \a arg[0]
    971 is the offset of this VecAD vector relative to the beginning
    972 of the \a combined VecAD array.
    973 \n
    974 \n
    975 \a arg[1]
    976 \n
    977 If this is the LdpOp operation
    978 (the index x is a parameter), i_vec is defined by
    979 \verbatim
    980         i_vec = arg[1]
    981 \endverbatim
    982 If this is the LdvOp operation
    983 (the index x is a variable), i_vec is defined by
    984 \verbatim
    985         i_vec = floor( taylor[ arg[1] * nc_taylor + 0 ] )
    986 \endverbatim
    987 where floor(c) is the greatest integer less that or equal c.
    988 \n
    989 \a arg[2]
    990 \b Input: The input value of \a arg[2] does not matter.
    991 \n
    992 \b Output:
    993 If y[x] is a parameter, \a arg[2] is set to zero
    994 (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_par
    999 is the number of parameters in \a parameter.
    1000 
    1001 \param parameter
    1002 If y[x] is a parameter, \a parameter [ i_y_x ] is its value.
    1003 
    1004 \param nc_taylor
    1005 number of columns in the matrix containing the Taylor coefficients.
    1006 
    1007 \param taylor
    1008 \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 above
    1010 \n
    1011 \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 \n
    1014 \b Output: \a taylor[ i_z * nc_taylor + 0 ]
    1015 is the zero order Taylor coefficient for the variable z.
    1016 
    1017 \param nc_combined
    1018 is the total number of elements in the combined VecAD array.
    1019 
    1020 \param variable
    1021 If \a variable [ \a arg[0] + i_vec ] is true,
    1022 y[x] is a variable.  Otherwise it is a parameter.
    1023 
    1024 \param combined
    1025 \b Input: \a combined[ \a arg[0] - 1 ]
    1026 is the number of elements in the VecAD vector containing this element.
    1027 \n
    1028 \b Input: \a combined[ \a arg[0] + i_vec ]
    1029 if y[x] is a variable, i_y_x
    1030 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 Errors
    1034 \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 Assertions
    1038 \li combined != CPPAD_NULL
    1039 \li variable != CPPAD_NULL
    1040 \li NumArg(LdpOp) == 3
    1041 \li NumRes(LdpOp) == 1
    1042 \li 0 <  \a arg[0]
    1043 \li \a arg[0] + i_vec < nc_combined
    1044 \li i_vec < combined[ \a arg[0] - 1 ]
    1045 \li if y[x] is a parameter, i_y_x < num_par
    1046 \li if y[x] is a variable, i_y_x < i_z
    1047 \li if x is a variable (LpvOp case), arg[1] < i_z
    1048 */
    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 used
    1062         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 is
    1068 \verbatim
    1069         z = v[x]
    1070 \endverbatim
    1071 where v is a VecAD<Base> vector and x is an AD<Base> index.
    1072 
    1073 \tparam Vector_set
    1074 is the type used for vectors of sets. It can be either
    1075 \c sparse_pack, \c sparse_set, or \c sparse_list.
    1076 
    1077 \param op
    1078 is the code corresponding to this operator; i.e., LdpOp or LdvOp
    1079 (only used for error checking).
    1080 
    1081 \param i_z
    1082 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 pattern
    1084 correpsonding to z.
    1085 
    1086 \param arg
    1087 \n
    1088 \a arg[0]
    1089 is the offset corresponding to this VecAD vector in the VecAD combined array.
    1090 
    1091 \param num_combined
    1092 is the total number of elements in the VecAD combinded array.
    1093 
    1094 \param combined
    1095 is the VecAD combined array.
    1096 \n
    1097 \n
    1098 \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 \verbatim
    1102         i_v = combined[ \a arg[0] - 1 ]
    1103 \endverbatim
    1104 
    1105 \param var_sparsity
    1106 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_sparsity
    1111 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 Assertions
    1117 \li NumArg(op) == 3
    1118 \li NumRes(op) == 1
    1119 \li 0         <  \a arg[0]
    1120 \li \a arg[0] < \a num_combined
    1121 \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 used
    1134         CPPAD_ASSERT_UNKNOWN( false );
    1135 }
    1136 
    1137 /*!
    1138947Prototype zero order forward implementation of op is one the following:
    1139948StppOp, StpvOp, StvpOp, or StvvOp.
Note: See TracChangeset for help on using the changeset viewer.