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