CppAD: A C++ Algorithmic Differentiation Package  20171217
parameter_op.hpp
Go to the documentation of this file.
1 // \$Id: parameter_op.hpp 3845 2016-11-19 01:50:47Z bradbell \$
4
5 /* --------------------------------------------------------------------------
7
9 the terms of the
10  Eclipse Public License Version 1.0.
11
12 A copy of this license is included in the COPYING file of this distribution.
14 -------------------------------------------------------------------------- */
15
16
18 /*!
19 \file parameter_op.hpp
20 Zero order forward mode for ParOp
21 */
22
23
24 /*!
25 Compute zero order forward mode Taylor coefficient for result of op = ParOp.
26
27 The C++ source code corresponding to this operation is one of the following
28 \verbatim
30  f.Dependent(x, y)
31 \endverbatim
32 where some of the components of the vector y are parameters.
33
34 \tparam Base
35 base type for the operator; i.e., this operation was recorded
36 using AD< \a Base > and computations by this routine are done using type
37 \a Base .
38
39 \param i_z
40 variable index corresponding to the result for this operation;
41 i.e. the row index in \a taylor corresponding to the component of y
42 that is a parameter.
43
44 \param arg
45 \a arg[0]
46 \n
47 index corresponding to the parameter value for this operator.
48
49 \param num_par
50 is the number of parameters in \a parameter.
51
52 \param parameter
53 \b Input: \a parameter[ \a arg[0] ] is the value of a component
54 of y that is a parameter.
55
56 \param cap_order
57 number of colums in the matrix containing all the Taylor coefficients.
58
59 \param taylor
60 \b Output: \a taylor [ \a i_z * \a cap_order + 0 ]
61 is the zero order Taylor coefficient corresponding to z.
62
63 \par Checked Assertions where op is the unary operator with one result:
64 \li NumArg(op) == 1
65 \li NumRes(op) == 1
66 \li \a size_t(arg[0]) < num_par
67 \li \a 0 < \a cap_order
68 */
69 template <class Base>
70 inline void forward_par_op_0(
71  size_t i_z ,
73  size_t num_par ,
74  const Base* parameter ,
75  size_t cap_order ,
76  Base* taylor )
77 {
78  // check assumptions
81  CPPAD_ASSERT_UNKNOWN( size_t(arg[0]) < num_par );
82  CPPAD_ASSERT_UNKNOWN( 0 < cap_order );
83
84  Base* z = taylor + i_z * cap_order;
85
86  z[0] = parameter[ arg[0] ];
87 }
88