CppAD: A C++ Algorithmic Differentiation Package  20171217
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
load_op.hpp
Go to the documentation of this file.
1 # ifndef CPPAD_LOCAL_LOAD_OP_HPP
2 # define CPPAD_LOCAL_LOAD_OP_HPP
3 
4 /* --------------------------------------------------------------------------
5 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-17 Bradley M. Bell
6 
7 CppAD is distributed under multiple licenses. This distribution is under
8 the terms of the
9  Eclipse Public License Version 1.0.
10 
11 A copy of this license is included in the COPYING file of this distribution.
12 Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
13 -------------------------------------------------------------------------- */
14 
15 
16 namespace CppAD { namespace local { // BEGIN_CPPAD_LOCAL_NAMESPACE
17 /*!
18 \file load_op.hpp
19 Setting a variable so that it corresponds to current value of a VecAD element.
20 */
21 /*
22 ==============================================================================
23 <!-- define preamble -->
24 The C++ source code corresponding to this operation is
25 \verbatim
26  v[x] = y
27 \endverbatim
28 where v is a VecAD<Base> vector, x is an AD<Base> object,
29 and y is AD<Base> or Base objects.
30 We define the index corresponding to v[x] by
31 \verbatim
32  i_v_x = index_by_ind[ arg[0] + i_vec ]
33 \endverbatim
34 where i_vec is defined under the heading arg[1] below:
35 <!-- end preamble -->
36 ==============================================================================
37 */
38 /*!
39 Shared documentation for zero order forward mode implementation of
40 op = LdpOp or LdvOp (not called).
41 
42 <!-- replace preamble -->
43 The C++ source code corresponding to this operation is
44 \verbatim
45  v[x] = y
46 \endverbatim
47 where v is a VecAD<Base> vector, x is an AD<Base> object,
48 and y is AD<Base> or Base objects.
49 We define the index corresponding to v[x] by
50 \verbatim
51  i_v_x = index_by_ind[ arg[0] + i_vec ]
52 \endverbatim
53 where i_vec is defined under the heading arg[1] below:
54 <!-- end preamble -->
55 
56 \tparam Base
57 base type for the operator; i.e., this operation was recorded
58 using AD<Base> and computations by this routine are done using type Base.
59 
60 \param play
61 is the tape that this operation appears in.
62 This is for error detection and not used when NDEBUG is defined.
63 
64 \param i_z
65 is the AD variable index corresponding to the variable z.
66 
67 \param arg
68 \n
69 arg[0]
70 is the offset of this VecAD vector relative to the beginning
71 of the isvar_by_ind and index_by_ind arrays.
72 \n
73 \n
74 arg[1]
75 \n
76 If this is the LdpOp operation (if x is a parameter),
77 i_vec is defined by
78 \verbatim
79  i_vec = arg[1]
80 \endverbatim
81 If this is the LdvOp operation (if x is a variable),
82 i_vec is defined by
83 \verbatim
84  i_vec = floor( taylor[ arg[1] * cap_order + 0 ] )
85 \endverbatim
86 where floor(c) is the greatest integer less that or equal c.
87 \n
88 \n
89 arg[2]
90 Is the index of this vecad load instruction in the
91 var_by_load_op array.
92 
93 \param parameter
94 If v[x] is a parameter, <code>parameter[ i_v_x ]</code> is its value.
95 This vector has size play->num_par_rec().
96 
97 \param cap_order
98 number of columns in the matrix containing the Taylor coefficients.
99 
100 \param taylor
101 \n
102 Input
103 \n
104 In LdvOp case, <code>taylor[ arg[1] * cap_order + 0 ]</code>
105 is used to compute the index in the definition of i_vec above.
106 If v[x] is a variable, <code>taylor[ i_v_x * cap_order + 0 ]</code>
107 is the zero order Taylor coefficient for v[x].
108 \n
109 \n
110 Output
111 \n
112 <code>taylor[ i_z * cap_order + 0 ]</code>
113 is set to the zero order Taylor coefficient for the variable z.
114 
115 \param isvar_by_ind
116 If <code>isvar_by_ind[ arg[0] + i_vec ] </code> is true,
117 v[x] is a variable. Otherwise it is a parameter.
118 This vector has size play->num_vec_ind_rec().
119 
120 \param index_by_ind
121 <code>index_by_ind[ arg[0] - 1 ]</code>
122 is the number of elements in the user vector containing this element.
123 <code>index_by_ind[ arg[0] + i_vec ]</code> is the variable or
124 parameter index for this element,
125 This array has size play->num_vec_ind_rec().
126 
127 \param var_by_load_op
128 is a vector with size play->num_load_op_rec().
129 The input value of its elements does not matter.
130 Upon return, it contains the variable index corresponding to each load
131 instruction.
132 In the case where the index is zero,
133 the instruction corresponds to a parameter (not variable).
134 This array has size play->num_load_op_rec().
135 
136 \par Check User Errors
137 \li In the LdvOp case check that the index is with in range; i.e.
138 <code>i_vec < index_by_ind[ arg[0] - 1 ]</code>.
139 Note that, if x is a parameter,
140 the corresponding vector index and it does not change.
141 In this case, the error above should be detected during tape recording.
142 */
143 template <class Base>
144 inline void forward_load_op_0(
145  const local::player<Base>* play,
146  size_t i_z ,
147  const addr_t* arg ,
148  const Base* parameter ,
149  size_t cap_order ,
150  Base* taylor ,
151  bool* isvar_by_ind ,
152  size_t* index_by_ind ,
153  addr_t* var_by_load_op )
154 {
155  // This routine is only for documentaiton, it should not be used
156  CPPAD_ASSERT_UNKNOWN( false );
157 }
158 /*!
159 Shared documentation for sparsity operations corresponding to
160 op = LdpOp or LdvOp (not called).
161 
162 <!-- replace preamble -->
163 The C++ source code corresponding to this operation is
164 \verbatim
165  v[x] = y
166 \endverbatim
167 where v is a VecAD<Base> vector, x is an AD<Base> object,
168 and y is AD<Base> or Base objects.
169 We define the index corresponding to v[x] by
170 \verbatim
171  i_v_x = index_by_ind[ arg[0] + i_vec ]
172 \endverbatim
173 where i_vec is defined under the heading arg[1] below:
174 <!-- end preamble -->
175 
176 \tparam Vector_set
177 is the type used for vectors of sets. It can be either
178 sparse_pack or sparse_list.
179 
180 \param op
181 is the code corresponding to this operator;
182 i.e., LdpOp or LdvOp.
183 
184 \param i_z
185 is the AD variable index corresponding to the variable z; i.e.,
186 the set with index \a i_z in \a var_sparsity is the sparsity pattern
187 correpsonding to z.
188 
189 \param arg
190 \n
191 \a arg[0]
192 is the offset corresponding to this VecAD vector in the VecAD combined array.
193 
194 \param num_combined
195 is the total number of elements in the VecAD combinded array.
196 
197 \param combined
198 is the VecAD combined array.
199 \n
200 \n
201 \a combined[ \a arg[0] - 1 ]
202 is the index of the set corresponding to the vector v in \a vecad_sparsity.
203 We use the notation i_v for this value; i.e.,
204 \verbatim
205  i_v = combined[ \a arg[0] - 1 ]
206 \endverbatim
207 
208 \param var_sparsity
209 The set with index \a i_z in \a var_sparsity is the sparsity pattern for z.
210 This is an output for forward mode operations,
211 and an input for reverse mode operations.
212 
213 \param vecad_sparsity
214 The set with index \a i_v is the sparsity pattern for the vector v.
215 This is an input for forward mode operations.
216 For reverse mode operations,
217 the sparsity pattern for z is added to the sparsity pattern for v.
218 
219 \par Checked Assertions
220 \li NumArg(op) == 3
221 \li NumRes(op) == 1
222 \li 0 < \a arg[0]
223 \li \a arg[0] < \a num_combined
224 \li i_v < \a vecad_sparsity.n_set()
225 */
226 template <class Vector_set>
227 inline void sparse_load_op(
228  OpCode op ,
229  size_t i_z ,
230  const addr_t* arg ,
231  size_t num_combined ,
232  const size_t* combined ,
233  Vector_set& var_sparsity ,
234  Vector_set& vecad_sparsity )
235 {
236  // This routine is only for documentaiton, it should not be used
237  CPPAD_ASSERT_UNKNOWN( false );
238 }
239 
240 
241 /*!
242 Zero order forward mode implementation of op = LdpOp.
243 
244 \copydetails CppAD::local::forward_load_op_0
245 */
246 template <class Base>
248  const local::player<Base>* play,
249  size_t i_z ,
250  const addr_t* arg ,
251  const Base* parameter ,
252  size_t cap_order ,
253  Base* taylor ,
254  bool* isvar_by_ind ,
255  size_t* index_by_ind ,
256  addr_t* var_by_load_op )
259  CPPAD_ASSERT_UNKNOWN( 0 < arg[0] );
260  CPPAD_ASSERT_UNKNOWN( size_t(arg[2]) < play->num_load_op_rec() );
261  CPPAD_ASSERT_UNKNOWN( std::numeric_limits<addr_t>::max() >= i_z );
262 
263  // Because the index is a parameter, this indexing error should have been
264  // caught and reported to the user when the tape is recording.
265  size_t i_vec = arg[1];
266  CPPAD_ASSERT_UNKNOWN( i_vec < index_by_ind[ arg[0] - 1 ] );
267  CPPAD_ASSERT_UNKNOWN( arg[0] + i_vec < play->num_vec_ind_rec() );
268 
269  size_t i_v_x = index_by_ind[ arg[0] + i_vec ];
270  Base* z = taylor + i_z * cap_order;
271  if( isvar_by_ind[ arg[0] + i_vec ] )
272  { CPPAD_ASSERT_UNKNOWN( i_v_x < i_z );
273  var_by_load_op[ arg[2] ] = addr_t( i_v_x );
274  Base* v_x = taylor + i_v_x * cap_order;
275  z[0] = v_x[0];
276  }
277  else
278  { CPPAD_ASSERT_UNKNOWN( i_v_x < play->num_par_rec() );
279  var_by_load_op[ arg[2] ] = 0;
280  Base v_x = parameter[i_v_x];
281  z[0] = v_x;
282  }
283 }
284 
285 /*!
286 Zero order forward mode implementation of op = LdvOp.
287 
288 \copydetails CppAD::local::forward_load_op_0
289 */
290 template <class Base>
292  const local::player<Base>* play,
293  size_t i_z ,
294  const addr_t* arg ,
295  const Base* parameter ,
296  size_t cap_order ,
297  Base* taylor ,
298  bool* isvar_by_ind ,
299  size_t* index_by_ind ,
300  addr_t* var_by_load_op )
303  CPPAD_ASSERT_UNKNOWN( 0 < arg[0] );
304  CPPAD_ASSERT_UNKNOWN( size_t(arg[2]) < play->num_load_op_rec() );
305  CPPAD_ASSERT_UNKNOWN( std::numeric_limits<addr_t>::max() >= i_z );
306 
307  size_t i_vec = Integer( taylor[ arg[1] * cap_order + 0 ] );
309  i_vec < index_by_ind[ arg[0] - 1 ] ,
310  "VecAD: index during zero order forward sweep is out of range"
311  );
312  CPPAD_ASSERT_UNKNOWN( arg[0] + i_vec < play->num_vec_ind_rec() );
313 
314  size_t i_v_x = index_by_ind[ arg[0] + i_vec ];
315  Base* z = taylor + i_z * cap_order;
316  if( isvar_by_ind[ arg[0] + i_vec ] )
317  { CPPAD_ASSERT_UNKNOWN( i_v_x < i_z );
318  var_by_load_op[ arg[2] ] = addr_t( i_v_x );
319  Base* v_x = taylor + i_v_x * cap_order;
320  z[0] = v_x[0];
321  }
322  else
323  { CPPAD_ASSERT_UNKNOWN( i_v_x < play->num_par_rec() );
324  var_by_load_op[ arg[2] ] = 0;
325  Base v_x = parameter[i_v_x];
326  z[0] = v_x;
327  }
328 }
329 
330 /*!
331 Forward mode, except for zero order, for op = LdpOp or op = LdvOp
332 
333 
334 <!-- replace preamble -->
335 The C++ source code corresponding to this operation is
336 \verbatim
337  v[x] = y
338 \endverbatim
339 where v is a VecAD<Base> vector, x is an AD<Base> object,
340 and y is AD<Base> or Base objects.
341 We define the index corresponding to v[x] by
342 \verbatim
343  i_v_x = index_by_ind[ arg[0] + i_vec ]
344 \endverbatim
345 where i_vec is defined under the heading arg[1] below:
346 <!-- end preamble -->
347 
348 \tparam Base
349 base type for the operator; i.e., this operation was recorded
350 using AD<Base> and computations by this routine are done using type Base.
351 
352 \param play
353 is the tape that this operation appears in.
354 This is for error detection and not used when NDEBUG is defined.
355 
356 \param op
357 is the code corresponding to this operator; i.e., LdpOp or LdvOp
358 (only used for error checking).
359 
360 \param p
361 is the lowest order of the Taylor coefficient that we are computing.
362 
363 \param q
364 is the highest order of the Taylor coefficient that we are computing.
365 
366 \param r
367 is the number of directions for the Taylor coefficients that we
368 are computing.
369 
370 \param cap_order
371 number of columns in the matrix containing the Taylor coefficients.
372 
373 \par tpv
374 We use the notation
375 <code>tpv = (cap_order-1) * r + 1</code>
376 which is the number of Taylor coefficients per variable
377 
378 \param i_z
379 is the AD variable index corresponding to the variable z.
380 
381 \param arg
382 arg[2]
383 Is the index of this vecad load instruction in the var_by_load_op array.
384 
385 \param var_by_load_op
386 is a vector with size play->num_load_op_rec().
387 It contains the variable index corresponding to each load instruction.
388 In the case where the index is zero,
389 the instruction corresponds to a parameter (not variable).
390 
391 \par i_var
392 We use the notation
393 \verbatim
394  i_var = size_t( var_by_load_op[ arg[2] ] )
395 \endverbatim
396 
397 \param taylor
398 \n
399 Input
400 \n
401 If <code>i_var > 0</code>, v[x] is a variable and
402 for k = 1 , ... , q
403 <code>taylor[ i_var * tpv + (k-1)*r+1+ell ]</code>
404 is the k-th order coefficient for v[x] in the ell-th direction,
405 \n
406 \n
407 Output
408 \n
409 for k = p , ... , q,
410 <code>taylor[ i_z * tpv + (k-1)*r+1+ell ]</code>
411 is set to the k-order Taylor coefficient for z in the ell-th direction.
412 */
413 template <class Base>
414 inline void forward_load_op(
415  const local::player<Base>* play,
416  OpCode op ,
417  size_t p ,
418  size_t q ,
419  size_t r ,
420  size_t cap_order ,
421  size_t i_z ,
422  const addr_t* arg ,
423  const addr_t* var_by_load_op ,
424  Base* taylor )
425 {
426  CPPAD_ASSERT_UNKNOWN( NumArg(op) == 3 );
427  CPPAD_ASSERT_UNKNOWN( NumRes(op) == 1 );
428  CPPAD_ASSERT_UNKNOWN( q < cap_order );
429  CPPAD_ASSERT_UNKNOWN( 0 < r);
430  CPPAD_ASSERT_UNKNOWN( 0 < p);
431  CPPAD_ASSERT_UNKNOWN( p <= q );
432  CPPAD_ASSERT_UNKNOWN( size_t(arg[2]) < play->num_load_op_rec() );
433 
434  size_t i_var = size_t( var_by_load_op[ arg[2] ] );
435  CPPAD_ASSERT_UNKNOWN( i_var < i_z );
436 
437  size_t num_taylor_per_var = (cap_order-1) * r + 1;
438  Base* z = taylor + i_z * num_taylor_per_var;
439  if( i_var > 0 )
440  { Base* v_x = taylor + i_var * num_taylor_per_var;
441  for(size_t ell = 0; ell < r; ell++)
442  { for(size_t k = p; k <= q; k++)
443  { size_t m = (k-1) * r + 1 + ell;
444  z[m] = v_x[m];
445  }
446  }
447  }
448  else
449  { for(size_t ell = 0; ell < r; ell++)
450  { for(size_t k = p; k <= q; k++)
451  { size_t m = (k-1) * r + 1 + ell;
452  z[m] = Base(0.0);
453  }
454  }
455  }
456 }
457 
458 /*!
459 Reverse mode for op = LdpOp or LdvOp.
460 
461 <!-- replace preamble -->
462 The C++ source code corresponding to this operation is
463 \verbatim
464  v[x] = y
465 \endverbatim
466 where v is a VecAD<Base> vector, x is an AD<Base> object,
467 and y is AD<Base> or Base objects.
468 We define the index corresponding to v[x] by
469 \verbatim
470  i_v_x = index_by_ind[ arg[0] + i_vec ]
471 \endverbatim
472 where i_vec is defined under the heading arg[1] below:
473 <!-- end preamble -->
474 
475 This routine is given the partial derivatives of a function
476 G(z , y[x] , w , u ... )
477 and it uses them to compute the partial derivatives of
478 \verbatim
479  H( y[x] , w , u , ... ) = G[ z( y[x] ) , y[x] , w , u , ... ]
480 \endverbatim
481 
482 \tparam Base
483 base type for the operator; i.e., this operation was recorded
484 using AD< \a Base > and computations by this routine are done using type
485 \a Base.
486 
487 \param op
488 is the code corresponding to this operator; i.e., LdpOp or LdvOp
489 (only used for error checking).
490 
491 \param d
492 highest order the Taylor coefficient that we are computing the partial
493 derivative with respect to.
494 
495 \param i_z
496 is the AD variable index corresponding to the variable z.
497 
498 \param arg
499 \a arg[2]
500 Is the index of this vecad load instruction in the
501 var_by_load_op array.
502 
503 \param cap_order
504 number of columns in the matrix containing the Taylor coefficients
505 (not used).
506 
507 \param taylor
508 matrix of Taylor coefficients (not used).
509 
510 \param nc_partial
511 number of colums in the matrix containing all the partial derivatives
512 (not used if \a arg[2] is zero).
513 
514 \param partial
515 If \a arg[2] is zero, y[x] is a parameter
516 and no values need to be modified; i.e., \a partial is not used.
517 Otherwise, y[x] is a variable and:
518 \n
519 \n
520 \a partial [ \a i_z * \a nc_partial + k ]
521 for k = 0 , ... , \a d
522 is the partial derivative of G
523 with respect to the k-th order Taylor coefficient for z.
524 \n
525 \n
526 If \a arg[2] is not zero,
527 \a partial [ \a arg[2] * \a nc_partial + k ]
528 for k = 0 , ... , \a d
529 is the partial derivative with respect to
530 the k-th order Taylor coefficient for x.
531 On input, it corresponds to the function G,
532 and on output it corresponds to the the function H.
533 
534 \param var_by_load_op
535 is a vector with size play->num_load_op_rec().
536 It contains the variable index corresponding to each load instruction.
537 In the case where the index is zero,
538 the instruction corresponds to a parameter (not variable).
539 
540 \par Checked Assertions
541 \li NumArg(op) == 3
542 \li NumRes(op) == 1
543 \li d < cap_order
544 \li size_t(arg[2]) < i_z
545 */
546 template <class Base>
547 inline void reverse_load_op(
548  OpCode op ,
549  size_t d ,
550  size_t i_z ,
551  const addr_t* arg ,
552  size_t cap_order ,
553  const Base* taylor ,
554  size_t nc_partial ,
555  Base* partial ,
556  const addr_t* var_by_load_op )
557 { size_t i_load = size_t( var_by_load_op[ arg[2] ] );
558 
559  CPPAD_ASSERT_UNKNOWN( NumArg(op) == 3 );
560  CPPAD_ASSERT_UNKNOWN( NumRes(op) == 1 );
561  CPPAD_ASSERT_UNKNOWN( d < cap_order );
562  CPPAD_ASSERT_UNKNOWN( i_load < i_z );
563 
564  if( i_load > 0 )
565  {
566  Base* pz = partial + i_z * nc_partial;
567  Base* py_x = partial + i_load * nc_partial;
568  size_t j = d + 1;
569  while(j--)
570  py_x[j] += pz[j];
571  }
572 }
573 
574 
575 /*!
576 Forward mode sparsity operations for LdpOp and LdvOp
577 
578 \param dependency
579 is this a dependency (or sparsity) calculation.
580 
581 \copydetails CppAD::local::sparse_load_op
582 */
583 template <class Vector_set>
585  bool dependency ,
586  OpCode op ,
587  size_t i_z ,
588  const addr_t* arg ,
589  size_t num_combined ,
590  const size_t* combined ,
591  Vector_set& var_sparsity ,
592  Vector_set& vecad_sparsity )
593 {
594  CPPAD_ASSERT_UNKNOWN( NumArg(op) == 3 );
595  CPPAD_ASSERT_UNKNOWN( NumRes(op) == 1 );
596  CPPAD_ASSERT_UNKNOWN( 0 < arg[0] );
597  CPPAD_ASSERT_UNKNOWN( size_t(arg[0]) < num_combined );
598  size_t i_v = combined[ arg[0] - 1 ];
599  CPPAD_ASSERT_UNKNOWN( i_v < vecad_sparsity.n_set() );
600 
601  var_sparsity.assignment(i_z, i_v, vecad_sparsity);
602  if( dependency & (op == LdvOp) )
603  var_sparsity.binary_union(i_z, i_z, arg[1], var_sparsity);
604 
605  return;
606 }
607 
608 
609 /*!
610 Reverse mode Jacobian sparsity operations for LdpOp and LdvOp
611 
612 \param dependency
613 is this a dependency (or sparsity) calculation.
614 
615 \copydetails CppAD::local::sparse_load_op
616 */
617 template <class Vector_set>
619  bool dependency ,
620  OpCode op ,
621  size_t i_z ,
622  const addr_t* arg ,
623  size_t num_combined ,
624  const size_t* combined ,
625  Vector_set& var_sparsity ,
626  Vector_set& vecad_sparsity )
627 {
628  CPPAD_ASSERT_UNKNOWN( NumArg(op) == 3 );
629  CPPAD_ASSERT_UNKNOWN( NumRes(op) == 1 );
630  CPPAD_ASSERT_UNKNOWN( 0 < arg[0] );
631  CPPAD_ASSERT_UNKNOWN( size_t(arg[0]) < num_combined );
632  size_t i_v = combined[ arg[0] - 1 ];
633  CPPAD_ASSERT_UNKNOWN( i_v < vecad_sparsity.n_set() );
634 
635  vecad_sparsity.binary_union(i_v, i_v, i_z, var_sparsity);
636  if( dependency & (op == LdvOp) )
637  var_sparsity.binary_union(arg[1], arg[1], i_z, var_sparsity);
638 
639  return;
640 }
641 
642 
643 /*!
644 Reverse mode Hessian sparsity operations for LdpOp and LdvOp
645 
646 \copydetails CppAD::local::sparse_load_op
647 
648 \param var_jacobian
649 \a var_jacobian[i_z]
650 is false (true) if the Jacobian of G with respect to z is always zero
651 (many be non-zero).
652 
653 \param vecad_jacobian
654 \a vecad_jacobian[i_v]
655 is false (true) if the Jacobian with respect to x is always zero
656 (may be non-zero).
657 On input, it corresponds to the function G,
658 and on output it corresponds to the function H.
659 
660 */
661 template <class Vector_set>
663  OpCode op ,
664  size_t i_z ,
665  const addr_t* arg ,
666  size_t num_combined ,
667  const size_t* combined ,
668  Vector_set& var_sparsity ,
669  Vector_set& vecad_sparsity ,
670  bool* var_jacobian ,
671  bool* vecad_jacobian )
672 {
673  CPPAD_ASSERT_UNKNOWN( NumArg(op) == 3 );
674  CPPAD_ASSERT_UNKNOWN( NumRes(op) == 1 );
675  CPPAD_ASSERT_UNKNOWN( 0 < arg[0] );
676  CPPAD_ASSERT_UNKNOWN( size_t(arg[0]) < num_combined );
677  size_t i_v = combined[ arg[0] - 1 ];
678  CPPAD_ASSERT_UNKNOWN( i_v < vecad_sparsity.n_set() );
679 
680  vecad_sparsity.binary_union(i_v, i_v, i_z, var_sparsity);
681 
682  vecad_jacobian[i_v] |= var_jacobian[i_z];
683 
684  return;
685 }
686 
687 
688 } } // END_CPPAD_LOCAL_NAMESPACE
689 # endif
void forward_load_op_0(const local::player< Base > *play, size_t i_z, const addr_t *arg, const Base *parameter, size_t cap_order, Base *taylor, bool *isvar_by_ind, size_t *index_by_ind, addr_t *var_by_load_op)
Shared documentation for zero order forward mode implementation of op = LdpOp or LdvOp (not called)...
Definition: load_op.hpp:144
#define CPPAD_ASSERT_KNOWN(exp, msg)
Check that exp is true, if not print msg and terminate execution.
CPPAD_TAPE_ADDR_TYPE addr_t
Definition: declare_ad.hpp:44
size_t num_load_op_rec(void) const
Fetch number of vecad load operations.
Definition: player.hpp:618
size_t NumArg(OpCode op)
Number of arguments for a specified operator.
Definition: op_code.hpp:175
Class used to store and play back an operation sequence recording.
Definition: declare_ad.hpp:27
void forward_sparse_load_op(bool dependency, OpCode op, size_t i_z, const addr_t *arg, size_t num_combined, const size_t *combined, Vector_set &var_sparsity, Vector_set &vecad_sparsity)
Forward mode sparsity operations for LdpOp and LdvOp.
Definition: load_op.hpp:584
size_t NumRes(OpCode op)
Number of variables resulting from the specified operation.
Definition: op_code.hpp:281
void forward_load_op(const local::player< Base > *play, OpCode op, size_t p, size_t q, size_t r, size_t cap_order, size_t i_z, const addr_t *arg, const addr_t *var_by_load_op, Base *taylor)
Forward mode, except for zero order, for op = LdpOp or op = LdvOp.
Definition: load_op.hpp:414
OpCode
Type used to distinguish different AD&lt; Base &gt; atomic operations.
Definition: op_code.hpp:49
void reverse_load_op(OpCode op, size_t d, size_t i_z, const addr_t *arg, size_t cap_order, const Base *taylor, size_t nc_partial, Base *partial, const addr_t *var_by_load_op)
Reverse mode for op = LdpOp or LdvOp.
Definition: load_op.hpp:547
void reverse_sparse_hessian_load_op(OpCode op, size_t i_z, const addr_t *arg, size_t num_combined, const size_t *combined, Vector_set &var_sparsity, Vector_set &vecad_sparsity, bool *var_jacobian, bool *vecad_jacobian)
Reverse mode Hessian sparsity operations for LdpOp and LdvOp.
Definition: load_op.hpp:662
void reverse_sparse_jacobian_load_op(bool dependency, OpCode op, size_t i_z, const addr_t *arg, size_t num_combined, const size_t *combined, Vector_set &var_sparsity, Vector_set &vecad_sparsity)
Reverse mode Jacobian sparsity operations for LdpOp and LdvOp.
Definition: load_op.hpp:618
#define CPPAD_ASSERT_UNKNOWN(exp)
Check that exp is true, if not terminate execution.
int Integer(const std::complex< double > &x)
void sparse_load_op(OpCode op, size_t i_z, const addr_t *arg, size_t num_combined, const size_t *combined, Vector_set &var_sparsity, Vector_set &vecad_sparsity)
Shared documentation for sparsity operations corresponding to op = LdpOp or LdvOp (not called)...
Definition: load_op.hpp:227
void forward_load_v_op_0(const local::player< Base > *play, size_t i_z, const addr_t *arg, const Base *parameter, size_t cap_order, Base *taylor, bool *isvar_by_ind, size_t *index_by_ind, addr_t *var_by_load_op)
Zero order forward mode implementation of op = LdvOp.
Definition: load_op.hpp:291
void forward_load_p_op_0(const local::player< Base > *play, size_t i_z, const addr_t *arg, const Base *parameter, size_t cap_order, Base *taylor, bool *isvar_by_ind, size_t *index_by_ind, addr_t *var_by_load_op)
Zero order forward mode implementation of op = LdpOp.
Definition: load_op.hpp:247