CppAD: A C++ Algorithmic Differentiation Package  20130102
prototype_op.hpp
Go to the documentation of this file.
00001 /* $Id$ */
00002 # ifndef CPPAD_PROTOTYPE_OP_INCLUDED
00003 # define CPPAD_PROTOTYPE_OP_INCLUDED
00004 
00005 /* --------------------------------------------------------------------------
00006 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
00007 
00008 CppAD is distributed under multiple licenses. This distribution is under
00009 the terms of the 
00010                     Eclipse Public License Version 1.0.
00011 
00012 A copy of this license is included in the COPYING file of this distribution.
00013 Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
00014 -------------------------------------------------------------------------- */
00015 
00016 
00017 CPPAD_BEGIN_NAMESPACE
00018 /*!
00019 \defgroup prototype_op_hpp prototype_op.hpp
00020 \{
00021 \file prototype_op.hpp
00022 Documentation for generic cases (these generic cases are never used).
00023 */
00024 
00025 // ==================== Unary operators with one result ====================
00026 
00027 
00028 /*!
00029 Prototype for forward mode unary operator with one result (not used).
00030 
00031 \tparam Base
00032 base type for the operator; i.e., this operation was recorded
00033 using AD< \a Base > and computations by this routine are done using type 
00034 \a Base.
00035 
00036 \param j
00037 order of the Taylor coefficient that we are computing.
00038 
00039 \param i_z
00040 variable index corresponding to the result for this operation; 
00041 i.e. the row index in \a taylor corresponding to z. 
00042 
00043 \param i_x
00044 variable index corresponding to the argument for this operator;
00045 i.e. the row index in \a taylor corresponding to x.
00046 
00047 \param nc_taylor
00048 number of colums in the matrix containing all the Taylor coefficients.
00049 
00050 \param taylor
00051 \b Input: \a taylor [ \a i_x * \a nc_taylor + k ] 
00052 for k = 0 , ... , \a j
00053 is the k-th order Taylor coefficient corresponding to x.
00054 \n
00055 \b Input: \a taylor [ \a i_z * \a nc_taylor + k ] 
00056 for k = 0 , ... , \a j - 1
00057 is the k-th order Taylor coefficient corresponding to z.
00058 \n
00059 \b Output: \a taylor [ \a i_z * \a nc_taylor + j ] 
00060 is the j-th order Taylor coefficient corresponding to z. 
00061 
00062 \par Checked Assertions
00063 \li NumArg(op) == 1
00064 \li NumRes(op) == 1
00065 \li \a i_x < \a i_z 
00066 \li \a j < \a nc_taylor
00067 */
00068 template <class Base>
00069 inline void forward_unary1_op(
00070      size_t j           ,
00071      size_t i_z         ,
00072      size_t i_x         ,
00073      size_t nc_taylor   , 
00074      Base*  taylor      )
00075 {
00076      // This routine is only for documentaiton, it should not be used
00077      CPPAD_ASSERT_UNKNOWN( false );
00078 }
00079 
00080 /*!
00081 Prototype for zero order forward mode unary operator with one result (not used). 
00082 \tparam Base
00083 base type for the operator; i.e., this operation was recorded
00084 using AD< \a Base > and computations by this routine are done using type 
00085 \a Base .
00086 
00087 \param i_z
00088 variable index corresponding to the result for this operation; 
00089 i.e. the row index in \a taylor corresponding to z. 
00090 
00091 \param i_x
00092 variable index corresponding to the argument for this operator;
00093 i.e. the row index in \a taylor corresponding to x.
00094 
00095 \param nc_taylor
00096 number of colums in the matrix containing all the Taylor coefficients.
00097 
00098 \param taylor
00099 \b Input: \a taylor [ \a i_x * \a nc_taylor + 0 ] 
00100 is the zero order Taylor coefficient corresponding to x. 
00101 \n
00102 \b Output: \a taylor [ \a i_z * \a nc_taylor + 0 ] 
00103 is the zero order Taylor coefficient corresponding to z. 
00104 
00105 \par Checked Assertions 
00106 \li NumArg(op) == 1
00107 \li NumRes(op) == 1
00108 \li \a i_x < \a i_z 
00109 \li \a 0 < \a nc_taylor
00110 */
00111 template <class Base>
00112 inline void forward_unary1_op_0(
00113      size_t i_z         ,
00114      size_t i_x         ,
00115      size_t nc_taylor   , 
00116      Base*  taylor      )
00117 {
00118      // This routine is only for documentaiton, it should not be used
00119      CPPAD_ASSERT_UNKNOWN( false );
00120 }
00121 
00122 /*!
00123 Prototype for reverse mode unary operator with one result (not used).
00124 
00125 This routine is given the partial derivatives of a function 
00126 G(z , x , w, u ... )
00127 and it uses them to compute the partial derivatives of 
00128 \verbatim
00129      H( x , w , u , ... ) = G[ z(x) , x , w , u , ... ]
00130 \endverbatim
00131 
00132 \tparam Base
00133 base type for the operator; i.e., this operation was recorded
00134 using AD< \a Base > and computations by this routine are done using type 
00135 \a Base .
00136 
00137 \param d
00138 highest order Taylor coefficient that
00139 we are computing the partial derivatives with respect to.
00140 
00141 \param i_z
00142 variable index corresponding to the result for this operation; 
00143 i.e. the row index in \a taylor to z. 
00144 
00145 \param i_x
00146 variable index corresponding to the argument for this operation;
00147 i.e. the row index in \a taylor corresponding to x.
00148 
00149 \param nc_taylor
00150 number of colums in the matrix containing all the Taylor coefficients.
00151 
00152 \param taylor
00153 \a taylor [ \a i_x * \a nc_taylor + k ] 
00154 for k = 0 , ... , \a d
00155 is the k-th order Taylor coefficient corresponding to x.
00156 \n
00157 \a taylor [ \a i_z * \a nc_taylor + k ] 
00158 for k = 0 , ... , \a d
00159 is the k-th order Taylor coefficient corresponding to z.
00160 
00161 \param nc_partial
00162 number of colums in the matrix containing all the partial derivatives.
00163 
00164 \param partial
00165 \b Input: \a partial [ \a i_x * \a nc_partial + k ] 
00166 for k = 0 , ... , \a d
00167 is the partial derivative of G( z , x , w , u , ... ) with respect to 
00168 the k-th order Taylor coefficient for x.
00169 \n
00170 \b Input: \a partial [ \a i_z * \a nc_partial + k ] 
00171 for k = 0 , ... , \a d
00172 is the partial derivative of G( z , x , w , u , ... ) with respect to 
00173 the k-th order Taylor coefficient for z.
00174 \n
00175 \b Output: \a partial [ \a i_x * \a nc_partial + k ]
00176 for k = 0 , ... , \a d
00177 is the partial derivative of H( x , w , u , ... ) with respect to 
00178 the k-th order Taylor coefficient for x.
00179 \n
00180 \b Output: \a partial [ \a i_z * \a nc_partial + k ]
00181 for k = 0 , ... , \a d 
00182 may be used as work space; i.e., may change in an unspecified manner.
00183 
00184 
00185 \par Checked Assumptions
00186 \li NumArg(op) == 1
00187 \li NumRes(op) == 1
00188 \li \a i_x < \a i_z 
00189 \li \a d < \a nc_taylor
00190 \li \a d < \a nc_partial
00191 */
00192 template <class Base>
00193 inline void reverse_unary1_op(
00194      size_t      d            ,
00195      size_t      i_z          ,
00196      size_t      i_x          ,
00197      size_t      nc_taylor    , 
00198      const Base* taylor       ,
00199      size_t      nc_partial   ,
00200      Base*       partial      )
00201 {
00202      // This routine is only for documentaiton, it should not be used
00203      CPPAD_ASSERT_UNKNOWN( false );
00204 }
00205 
00206 // ==================== Unary operators with two results ====================
00207 
00208 /*!
00209 Prototype for forward mode unary operator with two results (not used).
00210 
00211 \tparam Base
00212 base type for the operator; i.e., this operation was recorded
00213 using AD< \a Base > and computations by this routine are done using type 
00214 \a Base.
00215 
00216 \param j
00217 order of the Taylor coefficients that we are computing.
00218 
00219 \param i_z
00220 variable index corresponding to the last (primary) result for this operation; 
00221 i.e. the row index in \a taylor corresponding to z. 
00222 The auxillary result is called y has index \a i_z - 1.
00223 
00224 \param i_x
00225 variable index corresponding to the argument for this operator;
00226 i.e. the row index in \a taylor corresponding to x.
00227 
00228 \param nc_taylor
00229 number of colums in the matrix containing all the Taylor coefficients.
00230 
00231 \param taylor
00232 \b Input: \a taylor [ \a i_x * \a nc_taylor + k ] 
00233 for k = 0 , ... , \a j
00234 is the k-th order Taylor coefficient corresponding to x.
00235 \n
00236 \b Input: \a taylor [ \a i_z * \a nc_taylor + k ] 
00237 for k = 0 , ... , \a j - 1
00238 is the k-th order Taylor coefficient corresponding to z.
00239 \n
00240 \b Input: \a taylor [ ( \a i_z - 1) * \a nc_taylor + k ] 
00241 for k = 0 , ... , \a j - 1
00242 is the k-th order Taylor coefficient corresponding to the auxillary result y.
00243 \n
00244 \b Output: \a taylor [ \a i_z * \a nc_taylor + j ] 
00245 is the j-th order Taylor coefficient corresponding to z. 
00246 \n
00247 \b Output: \a taylor [ ( \a i_z - 1 ) * \a nc_taylor + j ] 
00248 is the j-th order Taylor coefficient corresponding to 
00249 the autillary result y.
00250 
00251 \par Checked Assertions 
00252 \li NumArg(op) == 1
00253 \li NumRes(op) == 2
00254 \li \a i_x + 1 < \a i_z 
00255 \li \a j < \a nc_taylor
00256 */
00257 template <class Base>
00258 inline void forward_unary2_op(
00259      size_t j           ,
00260      size_t i_z         ,
00261      size_t i_x         ,
00262      size_t nc_taylor   , 
00263      Base*  taylor      )
00264 {
00265      // This routine is only for documentaiton, it should not be used
00266      CPPAD_ASSERT_UNKNOWN( false );
00267 }
00268 
00269 /*!
00270 Prototype for zero order forward mode unary operator with two results (not used). 
00271 \tparam Base
00272 base type for the operator; i.e., this operation was recorded
00273 using AD< \a Base > and computations by this routine are done using type 
00274 \a Base .
00275 
00276 \param i_z
00277 variable index corresponding to the last (primary) result for this operation; 
00278 i.e. the row index in \a taylor corresponding to z. 
00279 The auxillary result is called y and has index \a i_z - 1.
00280 
00281 \param i_x
00282 variable index corresponding to the argument for this operator;
00283 i.e. the row index in \a taylor corresponding to x.
00284 
00285 \param nc_taylor
00286 number of colums in the matrix containing all the Taylor coefficients.
00287 
00288 \param taylor
00289 \b Input: \a taylor [ \a i_x * \a nc_taylor + 0 ] 
00290 is the zero order Taylor coefficient corresponding to x. 
00291 \n
00292 \b Output: \a taylor [ \a i_z * \a nc_taylor + 0 ] 
00293 is the zero order Taylor coefficient corresponding to z. 
00294 \n
00295 \b Output: \a taylor [ ( \a i_z - 1 ) * \a nc_taylor + j ] 
00296 is the j-th order Taylor coefficient corresponding to 
00297 the autillary result y. 
00298 
00299 \par Checked Assertions
00300 \li NumArg(op) == 1
00301 \li NumRes(op) == 2
00302 \li \a i_x + 1 < \a i_z 
00303 \li \a j < \a nc_taylor
00304 */
00305 template <class Base>
00306 inline void forward_unary2_op_0(
00307      size_t i_z         ,
00308      size_t i_x         ,
00309      size_t nc_taylor   , 
00310      Base*  taylor      )
00311 {
00312      // This routine is only for documentaiton, it should not be used
00313      CPPAD_ASSERT_UNKNOWN( false );
00314 }
00315 
00316 /*!
00317 Prototype for reverse mode unary operator with two results (not used).
00318 
00319 This routine is given the partial derivatives of a function 
00320 G( z , y , x , w , ... )
00321 and it uses them to compute the partial derivatives of 
00322 \verbatim
00323      H( x , w , u , ... ) = G[ z(x) , y(x), x , w , u , ... ]
00324 \endverbatim
00325 
00326 \tparam Base
00327 base type for the operator; i.e., this operation was recorded
00328 using AD< \a Base > and computations by this routine are done using type 
00329 \a Base .
00330 
00331 \param d
00332 highest order Taylor coefficient that
00333 we are computing the partial derivatives with respect to.
00334 
00335 \param i_z
00336 variable index corresponding to the last (primary) result for this operation; 
00337 i.e. the row index in \a taylor to z. 
00338 The auxillary result is called y and has index \a i_z - 1.
00339 
00340 \param i_x
00341 variable index corresponding to the argument for this operation;
00342 i.e. the row index in \a taylor corresponding to x.
00343 
00344 \param nc_taylor
00345 number of colums in the matrix containing all the Taylor coefficients.
00346 
00347 \param taylor
00348 \a taylor [ \a i_x * \a nc_taylor + k ] 
00349 for k = 0 , ... , \a d
00350 is the k-th order Taylor coefficient corresponding to x.
00351 \n
00352 \a taylor [ \a i_z * \a nc_taylor + k ] 
00353 for k = 0 , ... , \a d
00354 is the k-th order Taylor coefficient corresponding to z.
00355 \n
00356 \a taylor [ ( \a i_z - 1) * \a nc_taylor + k ] 
00357 for k = 0 , ... , \a d
00358 is the k-th order Taylor coefficient corresponding to 
00359 the auxillary variable y.
00360 
00361 \param nc_partial
00362 number of colums in the matrix containing all the partial derivatives.
00363 
00364 \param partial
00365 \b Input: \a partial [ \a i_x * \a nc_partial + k ] 
00366 for k = 0 , ... , \a d
00367 is the partial derivative of 
00368 G( z , y , x , w , u , ... ) 
00369 with respect to the k-th order Taylor coefficient for x.
00370 \n
00371 \b Input: \a partial [ \a i_z * \a nc_partial + k ] 
00372 for k = 0 , ... , \a d
00373 is the partial derivative of G( z , y , x , w , u , ... ) with respect to 
00374 the k-th order Taylor coefficient for z.
00375 \n
00376 \b Input: \a partial [ ( \a i_z - 1) * \a nc_partial + k ] 
00377 for k = 0 , ... , \a d
00378 is the partial derivative of G( z , x , w , u , ... ) with respect to 
00379 the k-th order Taylor coefficient for the auxillary variable y.
00380 \n
00381 \b Output: \a partial [ \a i_x * \a nc_partial + k ]
00382 for k = 0 , ... , \a d
00383 is the partial derivative of H( x , w , u , ... ) with respect to 
00384 the k-th order Taylor coefficient for x.
00385 \n
00386 \b Output: \a partial [ \a ( i_z - j ) * \a nc_partial + k ]
00387 for j = 0 , 1 , and for k = 0 , ... , \a d 
00388 may be used as work space; i.e., may change in an unspecified manner.
00389 
00390 
00391 \par Checked Assumptions
00392 \li NumArg(op) == 1
00393 \li NumRes(op) == 2
00394 \li \a i_x + 1 < \a i_z 
00395 \li \a d < \a nc_taylor
00396 \li \a d < \a nc_partial
00397 */
00398 template <class Base>
00399 inline void reverse_unary2_op(
00400      size_t      d            ,
00401      size_t      i_z          ,
00402      size_t      i_x          ,
00403      size_t      nc_taylor    , 
00404      const Base* taylor       ,
00405      size_t      nc_partial   ,
00406      Base*       partial      )
00407 {
00408      // This routine is only for documentaiton, it should not be used
00409      CPPAD_ASSERT_UNKNOWN( false );
00410 }
00411 // =================== Binary operators with one result ====================
00412 
00413 /*!
00414 Prototype forward mode x op y (not used)
00415 
00416 \tparam Base
00417 base type for the operator; i.e., this operation was recorded
00418 using AD< \a Base > and computations by this routine are done using type 
00419 \a Base.
00420 
00421 \param d
00422 order of the Taylor coefficient that we are computing.
00423 
00424 \param i_z
00425 variable index corresponding to the result for this operation; 
00426 i.e. the row index in \a taylor corresponding to z. 
00427 
00428 \param arg
00429 \a arg[0]
00430 index corresponding to the left operand for this operator;
00431 i.e. the index corresponding to x.
00432 \n
00433 \a arg[1]
00434 index corresponding to the right operand for this operator;
00435 i.e. the index corresponding to y.
00436 
00437 \param parameter
00438 If x is a parameter, \a parameter [ \a arg[0] ] 
00439 is the value corresponding to x.
00440 \n
00441 If y is a parameter, \a parameter [ \a arg[1] ] 
00442 is the value corresponding to y.
00443 
00444 \param nc_taylor
00445 number of colums in the matrix containing all the Taylor coefficients.
00446 
00447 \param taylor
00448 \b Input: If x is a variable, \a taylor [ \a arg[0] * \a nc_taylor + k ] 
00449 for k = 0 , ... , \a d
00450 is the k-th order Taylor coefficient corresponding to x.
00451 \n
00452 \b Input: If y is a variable, \a taylor [ \a arg[1] * \a nc_taylor + k ] 
00453 for k = 0 , ... , \a d
00454 is the k-th order Taylor coefficient corresponding to y.
00455 \n
00456 \b Input: \a taylor [ \a i_z * \a nc_taylor + k ] 
00457 for k = 0 , ... , \a d - 1
00458 is the k-th order Taylor coefficient corresponding to z.
00459 \n
00460 \b Output: \a taylor [ \a i_z * \a nc_taylor + \a d ] 
00461 is the \a d-th order Taylor coefficient corresponding to z. 
00462 
00463 \par Checked Assertions
00464 \li NumArg(op) == 2
00465 \li NumRes(op) == 1
00466 \li If x is a variable, \a arg[0] < \a i_z 
00467 \li If y is a variable, \a arg[1] < \a i_z 
00468 \li \a d < \a nc_taylor
00469 */
00470 template <class Base>
00471 inline void forward_binary_op(
00472      size_t         d         ,
00473      size_t        i_z        ,
00474      const addr_t* arg        ,
00475      const Base*   parameter  ,
00476      size_t        nc_taylor  , 
00477      Base*         taylor     )
00478 {
00479      // This routine is only for documentaiton, it should not be used
00480      CPPAD_ASSERT_UNKNOWN( false );
00481 }
00482 
00483 
00484 /*!
00485 Prototype zero order forward mode x op y (not used)
00486 
00487 \tparam Base
00488 base type for the operator; i.e., this operation was recorded
00489 using AD< \a Base > and computations by this routine are done using type 
00490 \a Base.
00491 
00492 \param i_z
00493 variable index corresponding to the result for this operation; 
00494 i.e. the row index in \a taylor corresponding to z. 
00495 
00496 \param arg
00497 \a arg[0]
00498 index corresponding to the left operand for this operator;
00499 i.e. the index corresponding to x.
00500 \n
00501 \a arg[1]
00502 index corresponding to the right operand for this operator;
00503 i.e. the index corresponding to y.
00504 
00505 \param parameter
00506 If x is a parameter, \a parameter [ \a arg[0] ] 
00507 is the value corresponding to x.
00508 \n
00509 If y is a parameter, \a parameter [ \a arg[1] ] 
00510 is the value corresponding to y.
00511 
00512 \param nc_taylor
00513 number of colums in the matrix containing all the Taylor coefficients.
00514 
00515 \param taylor
00516 \b Input: If x is a variable, \a taylor [ \a arg[0] * \a nc_taylor + 0 ] 
00517 is the zero order Taylor coefficient corresponding to x.
00518 \n
00519 \b Input: If y is a variable, \a taylor [ \a arg[1] * \a nc_taylor + 0 ] 
00520 is the zero order Taylor coefficient corresponding to y.
00521 \n
00522 \b Output: \a taylor [ \a i_z * \a nc_taylor + 0 ] 
00523 is the zero order Taylor coefficient corresponding to z. 
00524 
00525 \par Checked Assertions
00526 \li NumArg(op) == 2
00527 \li NumRes(op) == 1
00528 \li If x is a variable, \a arg[0] < \a i_z 
00529 \li If y is a variable, \a arg[1] < \a i_z 
00530 */
00531 template <class Base>
00532 inline void forward_binary_op_0(
00533      size_t        i_z         ,
00534      const addr_t* arg         ,
00535      const Base*   parameter   ,
00536      size_t        nc_taylor   , 
00537      Base*         taylor      )
00538 {
00539      // This routine is only for documentaiton, it should not be used
00540      CPPAD_ASSERT_UNKNOWN( false );
00541 }
00542 
00543 /*!
00544 Prototype for reverse mode binary operator x op y (not used).
00545 
00546 This routine is given the partial derivatives of a function 
00547 G( z , y , x , w , ... )
00548 and it uses them to compute the partial derivatives of 
00549 \verbatim
00550      H( y , x , w , u , ... ) = G[ z(x , y) , y , x , w , u , ... ]
00551 \endverbatim
00552 
00553 \tparam Base
00554 base type for the operator; i.e., this operation was recorded
00555 using AD< \a Base > and computations by this routine are done using type 
00556 \a Base .
00557 
00558 \param d
00559 highest order Taylor coefficient that
00560 we are computing the partial derivatives with respect to.
00561 
00562 \param i_z
00563 variable index corresponding to the result for this operation; 
00564 i.e. the row index in \a taylor corresponding to z. 
00565 
00566 \param arg
00567 \a arg[0]
00568 index corresponding to the left operand for this operator;
00569 i.e. the index corresponding to x.
00570 \n
00571 \a arg[1]
00572 index corresponding to the right operand for this operator;
00573 i.e. the index corresponding to y.
00574 
00575 \param parameter
00576 If x is a parameter, \a parameter [ \a arg[0] ] 
00577 is the value corresponding to x.
00578 \n
00579 If y is a parameter, \a parameter [ \a arg[1] ] 
00580 is the value corresponding to y.
00581 
00582 \param nc_taylor
00583 number of colums in the matrix containing all the Taylor coefficients.
00584 
00585 \param taylor
00586 \a taylor [ \a i_z * \a nc_taylor + k ] 
00587 for k = 0 , ... , \a d
00588 is the k-th order Taylor coefficient corresponding to z.
00589 \n
00590 If x is a variable, \a taylor [ \a arg[0] * \a nc_taylor + k ] 
00591 for k = 0 , ... , \a d
00592 is the k-th order Taylor coefficient corresponding to x.
00593 \n
00594 If y is a variable, \a taylor [ \a arg[1] * \a nc_taylor + k ] 
00595 for k = 0 , ... , \a d
00596 is the k-th order Taylor coefficient corresponding to y.
00597 
00598 \param nc_partial
00599 number of colums in the matrix containing all the partial derivatives.
00600 
00601 \param partial
00602 \b Input: \a partial [ \a i_z * \a nc_partial + k ] 
00603 for k = 0 , ... , \a d
00604 is the partial derivative of 
00605 G( z , y , x , w , u , ... ) 
00606 with respect to the k-th order Taylor coefficient for z.
00607 \n
00608 \b Input: If x is a variable, \a partial [ \a arg[0] * \a nc_partial + k ] 
00609 for k = 0 , ... , \a d
00610 is the partial derivative of G( z , y , x , w , u , ... ) with respect to 
00611 the k-th order Taylor coefficient for x.
00612 \n
00613 \b Input: If y is a variable, \a partial [ \a arg[1] * \a nc_partial + k ] 
00614 for k = 0 , ... , \a d
00615 is the partial derivative of G( z , x , w , u , ... ) with respect to 
00616 the k-th order Taylor coefficient for the auxillary variable y.
00617 \n
00618 \b Output: If x is a variable, \a partial [ \a arg[0] * \a nc_partial + k ]
00619 for k = 0 , ... , \a d
00620 is the partial derivative of H( y , x , w , u , ... ) with respect to 
00621 the k-th order Taylor coefficient for x.
00622 \n
00623 \b Output: If y is a variable, \a partial [ \a arg[1] * \a nc_partial + k ]
00624 for k = 0 , ... , \a d 
00625 is the partial derivative of H( y , x , w , u , ... ) with respect to 
00626 the k-th order Taylor coefficient for y.
00627 \n
00628 \b Output: \a partial [ \a i_z * \a nc_partial + k ]
00629 for k = 0 , ... , \a d 
00630 may be used as work space; i.e., may change in an unspecified manner.
00631 
00632 \par Checked Assumptions
00633 \li NumArg(op) == 2
00634 \li NumRes(op) == 1
00635 \li \a If x is a variable, arg[0] < \a i_z 
00636 \li \a If y is a variable, arg[1] < \a i_z 
00637 \li \a d < \a nc_taylor
00638 \li \a d < \a nc_partial
00639 */
00640 template <class Base>
00641 inline void reverse_binary_op(
00642      size_t      d            ,
00643      size_t      i_z          ,
00644      addr_t*     arg          ,
00645      const Base* parameter    ,
00646      size_t      nc_taylor    , 
00647      const Base* taylor       ,
00648      size_t      nc_partial   ,
00649      Base*       partial      )
00650 {
00651      // This routine is only for documentaiton, it should not be used
00652      CPPAD_ASSERT_UNKNOWN( false );
00653 }
00654 // ======================= Pow Function ===================================
00655 /*!
00656 Prototype for forward mode z = pow(x, y) (not used).
00657 
00658 \tparam Base
00659 base type for the operator; i.e., this operation was recorded
00660 using AD< \a Base > and computations by this routine are done using type 
00661 \a Base.
00662 
00663 \param d
00664 order of the Taylor coefficient that we are computing.
00665 
00666 \param i_z
00667 variable index corresponding to the last (primary) result for this operation; 
00668 i.e. the row index in \a taylor corresponding to z. 
00669 Note that there are three results for this operation,
00670 below they are referred to as z_0, z_1, z_2 and correspond to
00671 \verbatim
00672      z_0 = log(x)
00673      z_1 = z0 * y
00674      z_2 = exp(z1)
00675 \endverbatim
00676 It follows that the final result is equal to z; i.e., z = z_2 = pow(x, y). 
00677 
00678 \param arg
00679 \a arg[0]
00680 index corresponding to the left operand for this operator;
00681 i.e. the index corresponding to x.
00682 \n
00683 \a arg[1]
00684 index corresponding to the right operand for this operator;
00685 i.e. the index corresponding to y.
00686 
00687 \param parameter
00688 If x is a parameter, \a parameter [ \a arg[0] ] 
00689 is the value corresponding to x.
00690 \n
00691 If y is a parameter, \a parameter [ \a arg[1] ] 
00692 is the value corresponding to y.
00693 
00694 \param nc_taylor
00695 number of colums in the matrix containing all the Taylor coefficients.
00696 
00697 \param taylor
00698 \b Input: If x is a variable, \a taylor [ \a arg[0] * \a nc_taylor + k ] 
00699 for k = 0 , ... , \a d
00700 is the k-th order Taylor coefficient corresponding to x.
00701 \n
00702 \b Input: If y is a variable, \a taylor [ \a arg[1] * \a nc_taylor + k ] 
00703 for k = 0 , ... , \a d
00704 is the k-th order Taylor coefficient corresponding to y.
00705 \n
00706 \b Input: \a taylor [ \a (i_z - 2 + j) * \a nc_taylor + k ] 
00707 for j = 0, 1, 2 , and for k = 0 , ... , \a d - 1
00708 is the k-th order Taylor coefficient corresponding to z_j.
00709 \n
00710 \b Output: \a taylor [ \a (i_z - 2 + j) * \a nc_taylor + \a d ] 
00711 is the \a d-th order Taylor coefficient corresponding to z_j.
00712 
00713 \par Checked Assertions
00714 \li NumArg(op) == 2
00715 \li NumRes(op) == 3
00716 \li If x is a variable, \a arg[0] < \a i_z - 2 
00717 \li If y is a variable, \a arg[1] < \a i_z - 2
00718 \li \a d < \a nc_taylor
00719 */
00720 template <class Base>
00721 inline void forward_pow_op(
00722      size_t        d          ,
00723      size_t        i_z        ,
00724      const addr_t* arg        ,
00725      const Base*   parameter  ,
00726      size_t        nc_taylor  , 
00727      Base*         taylor     )
00728 {
00729      // This routine is only for documentaiton, it should not be used
00730      CPPAD_ASSERT_UNKNOWN( false );
00731 }
00732 /*!
00733 Prototype for zero order forward mode z = pow(x, y) (not used).
00734 
00735 \tparam Base
00736 base type for the operator; i.e., this operation was recorded
00737 using AD< \a Base > and computations by this routine are done using type 
00738 \a Base.
00739 
00740 \param i_z
00741 variable index corresponding to the last (primary) result for this operation; 
00742 i.e. the row index in \a taylor corresponding to z. 
00743 Note that there are three results for this operation,
00744 below they are referred to as z_0, z_1, z_2 and correspond to
00745 \verbatim
00746      z_0 = log(x)
00747      z_1 = z0 * y
00748      z_2 = exp(z1)
00749 \endverbatim
00750 It follows that the final result is equal to z; i.e., z = z_2 = pow(x, y). 
00751 
00752 \param arg
00753 \a arg[0]
00754 index corresponding to the left operand for this operator;
00755 i.e. the index corresponding to x.
00756 \n
00757 \a arg[1]
00758 index corresponding to the right operand for this operator;
00759 i.e. the index corresponding to y.
00760 
00761 \param parameter
00762 If x is a parameter, \a parameter [ \a arg[0] ] 
00763 is the value corresponding to x.
00764 \n
00765 If y is a parameter, \a parameter [ \a arg[1] ] 
00766 is the value corresponding to y.
00767 
00768 \param nc_taylor
00769 number of colums in the matrix containing all the Taylor coefficients.
00770 
00771 \param taylor
00772 \b Input: If x is a variable, \a taylor [ \a arg[0] * \a nc_taylor + 0 ] 
00773 is the zero order Taylor coefficient corresponding to x.
00774 \n
00775 \b Input: If y is a variable, \a taylor [ \a arg[1] * \a nc_taylor + 0 ] 
00776 is the k-th order Taylor coefficient corresponding to y.
00777 \n
00778 \b Output: \a taylor [ \a (i_z - 2 + j) * \a nc_taylor + 0 ] 
00779 is the zero order Taylor coefficient corresponding to z_j.
00780 
00781 \par Checked Assertions
00782 \li NumArg(op) == 2
00783 \li NumRes(op) == 3
00784 \li If x is a variable, \a arg[0] < \a i_z - 2 
00785 \li If y is a variable, \a arg[1] < \a i_z - 2
00786 */
00787 template <class Base>
00788 inline void forward_pow_op_0(
00789      size_t        i_z        ,
00790      const addr_t* arg        ,
00791      const Base*   parameter  ,
00792      size_t        nc_taylor  , 
00793      Base*         taylor     )
00794 {
00795      // This routine is only for documentaiton, it should not be used
00796      CPPAD_ASSERT_UNKNOWN( false );
00797 }
00798 /*!
00799 Prototype for reverse mode z = pow(x, y) (not used).
00800 
00801 This routine is given the partial derivatives of a function 
00802 G( z , y , x , w , ... )
00803 and it uses them to compute the partial derivatives of 
00804 \verbatim
00805      H( y , x , w , u , ... ) = G[ pow(x , y) , y , x , w , u , ... ]
00806 \endverbatim
00807 
00808 \tparam Base
00809 base type for the operator; i.e., this operation was recorded
00810 using AD< \a Base > and computations by this routine are done using type 
00811 \a Base .
00812 
00813 \param d
00814 highest order Taylor coefficient that
00815 we are computing the partial derivatives with respect to.
00816 
00817 \param i_z
00818 variable index corresponding to the last (primary) result for this operation; 
00819 i.e. the row index in \a taylor corresponding to z. 
00820 Note that there are three results for this operation,
00821 below they are referred to as z_0, z_1, z_2 and correspond to
00822 \verbatim
00823      z_0 = log(x)
00824      z_1 = z0 * y
00825      z_2 = exp(z1)
00826 \endverbatim
00827 It follows that the final result is equal to z; i.e., z = z_2 = pow(x, y). 
00828 
00829 \param arg
00830 \a arg[0]
00831 index corresponding to the left operand for this operator;
00832 i.e. the index corresponding to x.
00833 \n
00834 \a arg[1]
00835 index corresponding to the right operand for this operator;
00836 i.e. the index corresponding to y.
00837 
00838 \param parameter
00839 If x is a parameter, \a parameter [ \a arg[0] ] 
00840 is the value corresponding to x.
00841 \n
00842 If y is a parameter, \a parameter [ \a arg[1] ] 
00843 is the value corresponding to y.
00844 
00845 \param nc_taylor
00846 number of colums in the matrix containing all the Taylor coefficients.
00847 
00848 \param taylor
00849 \a taylor [ \a (i_z - 2 + j) * \a nc_taylor + k ] 
00850 for j = 0, 1, 2 and k = 0 , ... , \a d
00851 is the k-th order Taylor coefficient corresponding to z_j.
00852 \n
00853 If x is a variable, \a taylor [ \a arg[0] * \a nc_taylor + k ] 
00854 for k = 0 , ... , \a d
00855 is the k-th order Taylor coefficient corresponding to x.
00856 \n
00857 If y is a variable, \a taylor [ \a arg[1] * \a nc_taylor + k ] 
00858 for k = 0 , ... , \a d
00859 is the k-th order Taylor coefficient corresponding to y.
00860 
00861 \param nc_partial
00862 number of colums in the matrix containing all the partial derivatives.
00863 
00864 \param partial
00865 \b Input: \a partial [ \a (i_z - 2 + j) * \a nc_partial + k ] 
00866 for j = 0, 1, 2, and k = 0 , ... , \a d
00867 is the partial derivative of 
00868 G( z , y , x , w , u , ... ) 
00869 with respect to the k-th order Taylor coefficient for z_j.
00870 \n
00871 \b Input: If x is a variable, \a partial [ \a arg[0] * \a nc_partial + k ] 
00872 for k = 0 , ... , \a d
00873 is the partial derivative of G( z , y , x , w , u , ... ) with respect to 
00874 the k-th order Taylor coefficient for x.
00875 \n
00876 \b Input: If y is a variable, \a partial [ \a arg[1] * \a nc_partial + k ] 
00877 for k = 0 , ... , \a d
00878 is the partial derivative of G( z , x , w , u , ... ) with respect to 
00879 the k-th order Taylor coefficient for the auxillary variable y.
00880 \n
00881 \b Output: If x is a variable, \a partial [ \a arg[0] * \a nc_partial + k ]
00882 for k = 0 , ... , \a d
00883 is the partial derivative of H( y , x , w , u , ... ) with respect to 
00884 the k-th order Taylor coefficient for x.
00885 \n
00886 \b Output: If y is a variable, \a partial [ \a arg[1] * \a nc_partial + k ]
00887 for k = 0 , ... , \a d 
00888 is the partial derivative of H( y , x , w , u , ... ) with respect to 
00889 the k-th order Taylor coefficient for y.
00890 \n
00891 \b Output: \a partial [ \a ( i_z - j ) * \a nc_partial + k ]
00892 for j = 0 , 1 , 2 and for k = 0 , ... , \a d 
00893 may be used as work space; i.e., may change in an unspecified manner.
00894 
00895 \par Checked Assumptions
00896 \li NumArg(op) == 2
00897 \li NumRes(op) == 3
00898 \li \a If x is a variable, arg[0] < \a i_z - 2
00899 \li \a If y is a variable, arg[1] < \a i_z - 2
00900 \li \a d < \a nc_taylor
00901 \li \a d < \a nc_partial
00902 */
00903 template <class Base>
00904 inline void reverse_pow_op(
00905      size_t      d            ,
00906      size_t      i_z          ,
00907      addr_t*     arg          ,
00908      const Base* parameter    ,
00909      size_t      nc_taylor    , 
00910      const Base* taylor       ,
00911      size_t      nc_partial   ,
00912      Base*       partial      )
00913 {
00914      // This routine is only for documentaiton, it should not be used
00915      CPPAD_ASSERT_UNKNOWN( false );
00916 }
00917 // ====================  VecAD Operations     ==============================
00918 /*!
00919 Prototype for zero order forward mode implementation of op = LdpOp or LdvOp.
00920 
00921 The C++ source code corresponding to this operation is
00922 \verbatim
00923      z = y[x]
00924 \endverbatim
00925 where y is a VecAD<Base> vector and x is an AD<Base> index. 
00926 We define the index corresponding to y[x] by
00927 \verbatim
00928      i_y_x = combined[ arg[0] + i_vec ]
00929 \endverbatim
00930 where i_vec is defined under the heading \a arg[1] below:
00931 
00932 \tparam Base
00933 base type for the operator; i.e., this operation was recorded
00934 using AD< \a Base > and computations by this routine are done using type 
00935 \a Base.
00936 
00937 \param i_z
00938 is the AD variable index corresponding to the variable z.
00939 
00940 \param arg
00941 \n
00942 \a arg[0]
00943 is the offset of this VecAD vector relative to the beginning 
00944 of the \a combined VecAD array.
00945 \n
00946 \n 
00947 \a arg[1] 
00948 \n
00949 If this is the LdpOp operation 
00950 (the index x is a parameter), i_vec is defined by
00951 \verbatim
00952      i_vec = arg[1]
00953 \endverbatim
00954 If this is the LdvOp operation 
00955 (the index x is a variable), i_vec is defined by
00956 \verbatim
00957      i_vec = floor( taylor[ arg[1] * nc_taylor + 0 ] )
00958 \endverbatim
00959 where floor(c) is the greatest integer less that or equal c.
00960 \n
00961 \a arg[2]
00962 \b Input: The input value of \a arg[2] does not matter.
00963 \n
00964 \b Output: 
00965 If y[x] is a parameter, \a arg[2] is set to zero 
00966 (which is not a valid variable index).
00967 If y[x] is a variable, 
00968 \a arg[2] is set to the variable index corresponding to y[x]; i.e.  i_y_x.
00969 
00970 \param num_par
00971 is the number of parameters in \a parameter.
00972 
00973 \param parameter
00974 If y[x] is a parameter, \a parameter [ i_y_x ] is its value.
00975 
00976 \param nc_taylor
00977 number of columns in the matrix containing the Taylor coefficients.
00978 
00979 \param taylor
00980 \b Input: in LdvOp case, \a taylor[ arg[1] * nc_taylor + 0 ]
00981 is used to compute the index in the definition of i_vec above
00982 \n
00983 \b Input: if y[x] is a variable, \a taylor[ i_y_x * nc_taylor + 0 ]
00984 is the zero order Taylor coefficient for y[x].
00985 \n
00986 \b Output: \a taylor[ i_z * nc_taylor + 0 ]
00987 is the zero order Taylor coefficient for the variable z.
00988 
00989 \param nc_combined
00990 is the total number of elements in the combined VecAD array.
00991 
00992 \param variable
00993 If \a variable [ \a arg[0] + i_vec ] is true,
00994 y[x] is a variable.  Otherwise it is a parameter.
00995 
00996 \param combined
00997 \b Input: \a combined[ \a arg[0] - 1 ] 
00998 is the number of elements in the VecAD vector containing this element.
00999 \n
01000 \b Input: \a combined[ \a arg[0] + i_vec ]
01001 if y[x] is a variable, i_y_x
01002 is its index in the Taylor coefficient array \a taylor.
01003 Otherwise, i_y_x is its index in parameter array \a parameter.
01004 
01005 \par Check User Errors
01006 \li In the LdvOp case check that the index is with in range; i.e.
01007 i_vec < combined[ \a arg[0] - 1 ] 
01008 
01009 \par Checked Assertions 
01010 \li combined != CPPAD_NULL
01011 \li variable != CPPAD_NULL
01012 \li NumArg(LdpOp) == 3
01013 \li NumRes(LdpOp) == 1
01014 \li 0 <  \a arg[0]
01015 \li \a arg[0] + i_vec < nc_combined
01016 \li i_vec < combined[ \a arg[0] - 1 ] 
01017 \li if y[x] is a parameter, i_y_x < num_par
01018 \li if y[x] is a variable, i_y_x < i_z
01019 \li if x is a variable (LpvOp case), arg[1] < i_z
01020 */
01021 template <class Base>
01022 inline void forward_load_op_0(
01023      size_t         i_z         ,
01024      addr_t*        arg         , 
01025      size_t         num_par     ,
01026      const Base*    parameter   ,
01027      size_t         nc_taylor   ,
01028      Base*          taylor      ,
01029      size_t         nc_combined ,
01030      const bool*    variable    ,
01031      const size_t*  combined    )
01032 {
01033      // This routine is only for documentaiton, it should not be used
01034      CPPAD_ASSERT_UNKNOWN( false );
01035 }
01036 /*!
01037 Prototype sparsity operations corresponding to op = LdpOp or LdvOp.
01038 
01039 The C++ source code corresponding to this operation is
01040 \verbatim
01041      z = v[x]
01042 \endverbatim
01043 where v is a VecAD<Base> vector and x is an AD<Base> index. 
01044 
01045 \tparam Vector_set
01046 is the type used for vectors of sets. It can be either
01047 \c sparse_pack, \c sparse_set, or \c sparse_list.
01048 
01049 \param op
01050 is the code corresponding to this operator; i.e., LdpOp or LdvOp
01051 (only used for error checking).
01052 
01053 \param i_z
01054 is the AD variable index corresponding to the variable z; i.e.,
01055 the set with index \a i_z in \a var_sparsity is the sparsity pattern
01056 correpsonding to z.
01057 
01058 \param arg
01059 \n
01060 \a arg[0]
01061 is the offset corresponding to this VecAD vector in the VecAD combined array.
01062 
01063 \param num_combined
01064 is the total number of elements in the VecAD combinded array.
01065 
01066 \param combined
01067 is the VecAD combined array.
01068 \n
01069 \n
01070 \a combined[ \a arg[0] - 1 ]
01071 is the index of the set corresponding to the vector v  in \a vecad_sparsity.
01072 We use the notation i_v for this value; i.e.,
01073 \verbatim
01074      i_v = combined[ \a arg[0] - 1 ]
01075 \endverbatim
01076 
01077 \param var_sparsity
01078 The set with index \a i_z in \a var_sparsity is the sparsity pattern for z.
01079 This is an output for forward mode operations,
01080 and an input for reverse mode operations.
01081 
01082 \param vecad_sparsity
01083 The set with index \a i_v is the sparsity pattern for the vector v.
01084 This is an input for forward mode operations.
01085 For reverse mode operations,
01086 the sparsity pattern for z is added to the sparsity pattern for v.
01087 
01088 \par Checked Assertions 
01089 \li NumArg(op) == 3
01090 \li NumRes(op) == 1
01091 \li 0         <  \a arg[0]
01092 \li \a arg[0] < \a num_combined
01093 \li i_v       < \a vecad_sparsity.n_set()
01094 */
01095 template <class Vector_set>
01096 inline void sparse_load_op(
01097      OpCode              op             ,
01098      size_t              i_z            ,
01099      const addr_t*        arg           , 
01100      size_t              num_combined   ,
01101      const size_t*       combined       ,
01102      Vector_set&         var_sparsity   ,
01103      Vector_set&         vecad_sparsity )
01104 {
01105      // This routine is only for documentaiton, it should not be used
01106      CPPAD_ASSERT_UNKNOWN( false );
01107 }
01108 
01109 /*!
01110 Prototype zero order forward implementation of op is one the following:
01111 StppOp, StpvOp, StvpOp, or StvvOp.
01112 
01113 The C++ source code corresponding to this operation is
01114 \verbatim
01115      v[x] = y
01116 \endverbatim
01117 where v is a VecAD<Base> vector, x is an AD<Base> object,
01118 and y is AD<Base> or Base objects. 
01119 We define the index corresponding to v[x] by
01120 \verbatim
01121      i_v_x = combined[ arg[0] + i_vec ]
01122 \endverbatim
01123 where i_vec is defined under the heading \a arg[1] below:
01124 
01125 \tparam Base
01126 base type for the operator; i.e., this operation was recorded
01127 using AD< \a Base > and computations by this routine are done using type 
01128 \a Base.
01129 
01130 \param i_z
01131 is the index corresponding to the previous variable on the tape
01132 (only used for error checking).
01133 
01134 \param arg
01135 \n
01136 \a arg[0]
01137 is the offset of this VecAD vector relative to the beginning 
01138 of the \a combined VecAD array.
01139 \n
01140 \n 
01141 \a arg[1] 
01142 \n
01143 If this is a StppOp or StpvOp operation 
01144 (the index x is a parameter), i_vec is defined by
01145 \verbatim
01146      i_vec = arg[1]
01147 \endverbatim
01148 If this is a StvpOp or StvvOp operation 
01149 (the index x is a variable), i_vec is defined by
01150 \verbatim
01151      i_vec = floor( taylor[ arg[1] * nc_taylor + 0 ] )
01152 \endverbatim
01153 where floor(c) is the greatest integer less that or equal c.
01154 \n
01155 \n
01156 \a arg[2]
01157 \n
01158 index corresponding to the third operand for this operator;
01159 i.e. the index corresponding to y.
01160 
01161 \param num_par
01162 is the total number of parameters on the tape
01163 (only used for error checking).
01164 
01165 \param nc_taylor
01166 number of columns in the matrix containing the Taylor coefficients.
01167 
01168 \param taylor
01169 \b Input: in StvpOp and StvvOp cases, \a taylor[ arg[1] * nc_taylor + 0 ]
01170 is used to compute the index in the definition of i_vec above
01171 
01172 \param nc_combined
01173 is the total number of elements in the combined VecAD array.
01174 
01175 \param variable
01176 \b Output: If y is a varable (StpvOp or StvvOp), 
01177 \a variable [ \a arg[0] + i_vec ] is set to true.
01178 Otherwise y is a paraemter (StppOp or StvpOp) and 
01179 \a variable [ \a arg[0] + i_vec ] is set to false.
01180 
01181 \param combined
01182 \b Output: \a combined [ \a arg[0] + i_vec ]
01183 is set equal to \a arg[2].
01184 
01185 \par Check User Errors
01186 \li Check that the index is with in range; i.e.
01187 i_vec < combined[ \a arg[0] - 1 ]
01188 Note that, if x is a parameter, is the corresponding vector index
01189 and it does not change.
01190 In this case, the error above should be detected during tape recording.
01191 
01192 \par Checked Assertions 
01193 \li combined != CPPAD_NULL
01194 \li variable != CPPAD_NULL
01195 \li NumArg(op) == 3
01196 \li NumRes(op) == 0
01197 \li 0 <  \a arg[0]
01198 \li \a arg[0] + i_vec < nc_combined
01199 \li if y is a parameter, arg[2] < num_par
01200 \li if x is a variable, arg[1] <= i_z
01201 \li if y is a variable, arg[2] <= i_z
01202 */
01203 template <class Base>
01204 inline void forward_store_op_0(
01205      size_t         i_z         ,
01206      const addr_t*  arg         , 
01207      size_t         num_par     ,
01208      size_t         nc_taylor   ,
01209      Base*          taylor      ,
01210      size_t         nc_combined ,
01211      bool*          variable    ,
01212      size_t*        combined    )
01213 {
01214      // This routine is only for documentaiton, it should not be used
01215      CPPAD_ASSERT_UNKNOWN( false );
01216 }
01217 /*!
01218 Prototype sparsity operations corresponding to op = StpvOp or StvvOp.
01219 
01220 The C++ source code corresponding to this operation is
01221 \verbatim
01222      v[x] = y
01223 \endverbatim
01224 where v is a VecAD<Base> vector, x is an AD<Base> object,
01225 and y is AD<Base> or Base objects. 
01226 We define the index corresponding to v[x] by
01227 \verbatim
01228      i_v_x = combined[ arg[0] + i_vec ]
01229 \endverbatim
01230 where i_vec is defined under the heading \a arg[1] below:
01231 
01232 \tparam Vector_set
01233 is the type used for vectors of sets. It can be either
01234 \c sparse_pack, \c sparse_set, or \c sparse_list.
01235 
01236 
01237 \param op
01238 is the code corresponding to this operator; i.e., StpvOp or StvvOp
01239 (only used for error checking).
01240 
01241 \param arg
01242 \n
01243 \a arg[0]
01244 is the offset corresponding to this VecAD vector in the combined array.
01245 \n
01246 \n 
01247 \a arg[2]
01248 \n
01249 The set with index \a arg[2] in \a var_sparsity 
01250 is the sparsity pattern corresponding to y.
01251 (Note that \a arg[2] > 0 because y is a variable.) 
01252 
01253 \param num_combined
01254 is the total number of elements in the VecAD address array.
01255 
01256 \param combined
01257 \a combined [ arg[0] - 1 ]
01258 is the index of the set in \a vecad_sparsity corresponding
01259 to the sparsity pattern for the vector v.
01260 We use the notation i_v below which is defined by
01261 \verbatim
01262      i_v = combined[ \a arg[0] - 1 ]
01263 \endverbatim
01264 
01265 \param var_sparsity
01266 The set  with index \a arg[2] in \a var_sparsity 
01267 is the sparsity pattern for y.
01268 This is an input for forward mode operations.
01269 For reverse mode operations:
01270 The sparsity pattern for v is added to the spartisy pattern for y.
01271 
01272 \param vecad_sparsity
01273 The set with index \a i_v in \a vecad_sparsity 
01274 is the sparsity pattern for v.
01275 This is an input for reverse mode operations.
01276 For forward mode operations, the sparsity pattern for y is added
01277 to the sparsity pattern for the vector v.
01278 
01279 \par Checked Assertions 
01280 \li NumArg(op) == 3
01281 \li NumRes(op) == 0
01282 \li 0 <  \a arg[0]
01283 \li \a arg[0] < \a num_combined
01284 \li \a arg[2] < \a var_sparsity.n_set()
01285 \li i_v       < \a vecad_sparsity.n_set()
01286 */
01287 inline void sparse_store_op(
01288      OpCode         op             ,
01289      const addr_t*  arg            , 
01290      size_t         num_combined   ,
01291      const size_t*  combined       ,
01292      Pack*          var_sparsity   ,
01293      Pack*          vecad_sparsity )
01294 {
01295      // This routine is only for documentaiton, it should not be used
01296      CPPAD_ASSERT_UNKNOWN( false );
01297 }
01298 
01299 
01300 // ==================== Sparsity Calculations ==============================
01301 /*!
01302 Prototype for reverse mode Hessian sparsity unary operators.
01303 
01304 This routine is given the forward mode Jacobian sparsity patterns for x.
01305 It is also given the reverse mode dependence of G on z.
01306 In addition, it is given the revese mode Hessian sparsity
01307 for the quanity of interest G(z , y , ... )
01308 and it uses them to compute the sparsity patterns for 
01309 \verbatim
01310      H( x , w , u , ... ) = G[ z(x) , x , w , u , ... ]
01311 \endverbatim
01312 
01313 \tparam Vector_set
01314 is the type used for vectors of sets. It can be either
01315 \c sparse_pack, \c sparse_set, or \c sparse_list.
01316 
01317 \param i_z
01318 variable index corresponding to the result for this operation; 
01319 i.e. the row index in sparsity corresponding to z. 
01320 
01321 \param i_x
01322 variable index corresponding to the argument for this operator;
01323 i.e. the row index in sparsity corresponding to x.
01324 
01325 \param rev_jacobian
01326 \a rev_jacobian[i_z] 
01327 is all false (true) if the Jacobian of G with respect to z must be zero 
01328 (may be non-zero).
01329 \n
01330 \n
01331 \a rev_jacobian[i_x] 
01332 is all false (true) if the Jacobian with respect to x must be zero 
01333 (may be non-zero).
01334 On input, it corresponds to the function G,
01335 and on output it corresponds to the function H.
01336 
01337 \param for_jac_sparsity
01338 The set with index \a i_x in for_jac_sparsity
01339 is the forward mode Jacobian sparsity pattern for the variable x. 
01340 
01341 \param rev_hes_sparsity
01342 The set with index \a i_z in in \a rev_hes_sparsity
01343 is the Hessian sparsity pattern for the fucntion G
01344 where one of the partials derivative is with respect to z.
01345 \n
01346 \n
01347 The set with index \a i_x in \a rev_hes_sparsity
01348 is the Hessian sparsity pattern 
01349 where one of the partials derivative is with respect to x.
01350 On input, it corresponds to the function G,
01351 and on output it corresponds to the function H.
01352 
01353 \par Checked Assertions:
01354 \li \a i_x < \a i_z 
01355 */
01356 
01357 template <class Vector_set>
01358 inline void reverse_sparse_hessian_unary_op(
01359      size_t              i_z               ,
01360      size_t              i_x               ,
01361      bool*               rev_jacobian      ,
01362      Vector_set&         for_jac_sparsity  ,
01363      Vector_set&         rev_hes_sparsity  )
01364 {    
01365      // This routine is only for documentaiton, it should not be used
01366      CPPAD_ASSERT_UNKNOWN( false );
01367 }
01368 
01369 /*!
01370 Prototype for reverse mode Hessian sparsity binary operators.
01371 
01372 This routine is given the sparsity patterns the Hessian 
01373 of a function G(z, y, x, ... )
01374 and it uses them to compute the sparsity patterns for the Hessian of  
01375 \verbatim
01376      H( y, x, w , u , ... ) = G[ z(x,y) , y , x , w , u , ... ]
01377 \endverbatim
01378 
01379 \tparam Vector_set
01380 is the type used for vectors of sets. It can be either
01381 \c sparse_pack, \c sparse_set, or \c sparse_list.
01382 
01383 \param i_z
01384 variable index corresponding to the result for this operation; 
01385 i.e. the row index in sparsity corresponding to z. 
01386 
01387 \param arg
01388 \a arg[0]
01389 variable index corresponding to the left operand for this operator;
01390 i.e. the set with index \a arg[0] in \a var_sparsity
01391 is the spasity pattern correspoding to x.
01392 \n
01393 \n arg[1]
01394 variable index corresponding to the right operand for this operator;
01395 i.e. the row index in sparsity patterns corresponding to y.
01396 
01397 \param jac_reverse
01398 \a jac_reverse[i_z] 
01399 is false (true) if the Jacobian of G with respect to z is always zero
01400 (may be non-zero).
01401 \n
01402 \n
01403 \a jac_reverse[ \a arg[0] ] 
01404 is false (true) if the Jacobian with respect to x is always zero 
01405 (may be non-zero).
01406 On input, it corresponds to the function G,
01407 and on output it corresponds to the function H.
01408 \n
01409 \n
01410 \a jac_reverse[ \a arg[1] ] 
01411 is false (true) if the Jacobian with respect to y is always zero 
01412 (may be non-zero).
01413 On input, it corresponds to the function G,
01414 and on output it corresponds to the function H.
01415 
01416 \param for_jac_sparsity
01417 The set with index \a arg[0] in \a for_jac_sparsity for the
01418 is the forward Jacobian sparsity pattern for x.
01419 \n
01420 \n
01421 The set with index \a arg[1] in \a for_jac_sparsity
01422 is the forward sparsity pattern for y.
01423 
01424 \param rev_hes_sparsity
01425 The set wiht index \a i_x in \a rev_hes_sparsity 
01426 is the Hessian sparsity pattern for the function G
01427 where one of the partial derivatives is with respect to z.
01428 \n
01429 \n
01430 The set with index \a arg[0] in  \a rev_hes_sparsity 
01431 is the Hessian sparsity pattern where one of the 
01432 partial derivatives is with respect to x.
01433 On input, it corresponds to the function G,
01434 and on output it correspondst to H.
01435 \n
01436 \n
01437 The set with index \a arg[1] in \a rev_hes_sparsity 
01438 is the Hessian sparsity pattern where one of the 
01439 partial derivatives is with respect to y.
01440 On input, it corresponds to the function G,
01441 and on output it correspondst to H.
01442 
01443 \par Checked Assertions:
01444 \li \a arg[0] < \a i_z 
01445 \li \a arg[1] < \a i_z 
01446 */
01447 template <class Vector_set>
01448 inline void reverse_sparse_hessian_binary_op(
01449      size_t            i_z                ,
01450      const addr_t*     arg                ,
01451      bool*             jac_reverse        ,
01452      Vector_set&       for_jac_sparsity   ,
01453      Vector_set&       rev_hes_sparsity   )
01454 {    
01455      // This routine is only for documentaiton, it should not be used
01456      CPPAD_ASSERT_UNKNOWN( false );
01457 }
01458 
01459 // ==================== Conditional Expressions ============================
01460 /*!
01461 Common documentation for conditional expressions forward and reverse mode.
01462 
01463 The C++ source code coresponding to this operation is
01464 \verbatim
01465      z = CondExpRel(y_0, y_1, y_2, y_3)
01466 \endverbatim
01467 where Rel is one of the following: Lt, Le, Eq, Ge, Gt. 
01468 
01469 \tparam Base
01470 base type for the operator; i.e., this operation was recorded
01471 using AD< \a Base > and computations by this routine are done using type 
01472 \a Base.
01473 
01474 \param i_z
01475 is the AD variable index corresponding to the variable z.
01476 
01477 \param arg
01478 \n
01479 \a arg[0]
01480 is static cast to size_t from the enum type
01481 \verbatim
01482      enum CompareOp {
01483           CompareLt, 
01484           CompareLe, 
01485           CompareEq, 
01486           CompareGe, 
01487           CompareGt, 
01488           CompareNe
01489      }
01490 \endverbatim
01491 for this operation.
01492 Note that arg[0] cannot be equal to CompareNe.
01493 \n
01494 \n
01495 \a arg[1] & 1
01496 \n
01497 If this is zero, y_0 is a parameter. Otherwise it is a variable.
01498 \n
01499 \n
01500 \a arg[1] & 2
01501 \n
01502 If this is zero, y_1 is a parameter. Otherwise it is a variable.
01503 \n
01504 \n
01505 \a arg[1] & 4
01506 \n
01507 If this is zero, y_2 is a parameter. Otherwise it is a variable.
01508 \n
01509 \n
01510 \a arg[1] & 8
01511 \n
01512 If this is zero, y_3 is a parameter. Otherwise it is a variable.
01513 \n
01514 \n
01515 \a arg[2 + j ] for j = 0, 1, 2, 3
01516 \n
01517 is the index corresponding to y_j.
01518 
01519 \param num_par
01520 is the total number of values in the vector \a parameter.
01521 
01522 \param parameter
01523 For j = 0, 1, 2, 3,
01524 if y_j is a parameter, \a parameter [ arg[2 + j] ] is its value.
01525 
01526 \param nc_taylor
01527 number of columns in the matrix containing the Taylor coefficients.
01528 
01529 \par Checked Assertions
01530 \li NumArg(CExpOp) == 6
01531 \li NumRes(CExpOp) == 1
01532 \li arg[0] < static_cast<size_t> ( CompareNe )
01533 \li arg[1] != 0; i.e., not all of y_0, y_1, y_2, y_3 are parameters.
01534 \li For j = 0, 1, 2, 3 if y_j is a parameter, arg[2+j] < num_par.
01535 \li For j = 0, 1, 2, 3 if y_j is a variable, arg[2+j] < iz.
01536 */
01537 template <class Base>
01538 inline void conditional_exp_op(
01539      size_t         i_z         ,
01540      const addr_t*  arg         , 
01541      size_t         num_par     ,
01542      const Base*    parameter   ,
01543      size_t         nc_taylor   )
01544 {    // This routine is only for documentation, it should never be used
01545      CPPAD_ASSERT_UNKNOWN( false );
01546 }
01547 
01548 /*!
01549 Common documentation for conditional expression sparse operations.
01550 
01551 The C++ source code coresponding to this operation is
01552 \verbatim
01553      z = CondExpRel(y_0, y_1, y_2, y_3)
01554 \endverbatim
01555 where Rel is one of the following: Lt, Le, Eq, Ge, Gt. 
01556 
01557 \tparam Vector_set
01558 is the type used for vectors of sets. It can be either
01559 \c sparse_pack, \c sparse_set, or \c sparse_list.
01560 
01561 \param i_z
01562 is the AD variable index corresponding to the variable z.
01563 
01564 \param arg
01565 \n
01566 \a arg[0]
01567 is static cast to size_t from the enum type
01568 \verbatim
01569      enum CompareOp {
01570           CompareLt, 
01571           CompareLe, 
01572           CompareEq, 
01573           CompareGe, 
01574           CompareGt, 
01575           CompareNe
01576      }
01577 \endverbatim
01578 for this operation.
01579 Note that arg[0] cannot be equal to CompareNe.
01580 \n
01581 \n
01582 \a arg[1] & 1
01583 \n
01584 If this is zero, y_0 is a parameter. Otherwise it is a variable.
01585 \n
01586 \n
01587 \a arg[1] & 2
01588 \n
01589 If this is zero, y_1 is a parameter. Otherwise it is a variable.
01590 \n
01591 \n
01592 \a arg[1] & 4
01593 \n
01594 If this is zero, y_2 is a parameter. Otherwise it is a variable.
01595 \n
01596 \n
01597 \a arg[1] & 8
01598 \n
01599 If this is zero, y_3 is a parameter. Otherwise it is a variable.
01600 \n
01601 \n
01602 \a arg[2 + j ] for j = 0, 1, 2, 3
01603 \n
01604 is the index corresponding to y_j.
01605 
01606 \param num_par
01607 is the total number of values in the vector \a parameter.
01608 
01609 \par Checked Assertions
01610 \li NumArg(CExpOp) == 6
01611 \li NumRes(CExpOp) == 1
01612 \li arg[0] < static_cast<size_t> ( CompareNe )
01613 \li arg[1] != 0; i.e., not all of y_0, y_1, y_2, y_3 are parameters.
01614 \li For j = 0, 1, 2, 3 if y_j is a parameter, arg[2+j] < num_par.
01615 \li For j = 0, 1, 2, 3 if y_j is a variable, arg[2+j] < iz.
01616 */
01617 template <class Vector_set>
01618 inline void sparse_conditional_exp_op(
01619      size_t         i_z           ,
01620      const addr_t*  arg           , 
01621      size_t         num_par       )
01622 {    // This routine is only for documentation, it should never be used
01623      CPPAD_ASSERT_UNKNOWN( false );
01624 }
01625 
01626 /*! \} */
01627 CPPAD_END_NAMESPACE
01628 # endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines