CppAD: A C++ Algorithmic Differentiation Package  20171217
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
player.hpp
Go to the documentation of this file.
1 # ifndef CPPAD_LOCAL_PLAYER_HPP
2 # define CPPAD_LOCAL_PLAYER_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 
16 # include <cppad/local/is_pod.hpp>
17 
18 namespace CppAD { namespace local { // BEGIN_CPPAD_LOCAL_NAMESPACE
19 /*!
20 \file player.hpp
21 File used to define the player class.
22 */
23 
24 /*!
25 Class used to store and play back an operation sequence recording.
26 
27 \tparam Base
28 These were AD< Base > operations when recorded. Operations during playback
29 are done using the type Base .
30 */
31 template <class Base>
32 class player {
33 private:
34  // ----------------------------------------------------------------------
35  // information that defines the recording
36 
37  /// Number of variables in the recording.
38  size_t num_var_rec_;
39 
40  /// number of vecad load opeations in the reconding
42 
43  /// Number of VecAD vectors in the recording
45 
46  /// The operators in the recording.
48 
49  /// The operation argument indices in the recording
51 
52  /// The parameters in the recording.
53  /// Note that Base may not be plain old data, so use false in consructor.
55 
56  /// Character strings ('\\0' terminated) in the recording.
58 
59  /// The VecAD indices in the recording.
61 
62  // ----------------------------------------------------------------------
63  // Redundant information that simplifies and speeds up iterating through
64  // the operation sequence.
65 
66  /// index in arg_vec_ corresonding to the first argument for each operator
68 
69  /*!
70  Index of the result variable for each operator. If the operator has
71  no results, this is not defined. The invalid index num_var_rec_ is used
72  when NDEBUG is not defined. If the operator has more than one result, this
73  is the primary result; i.e., the last result. Auxillary are only used by
74  the operator and not used by other operators.
75  */
77 
78  /// Mapping from primary variable index to corresponding operator index.
79  /// This is used to traverse sub-graphs of the operation sequence.
80  /// This value is valid (invalid) for primary (auxillary) variables.
82 
83 public:
84  // =================================================================
85  /// constructor
86  player(void) :
87  num_var_rec_(0) ,
89  { }
90 
91  // =================================================================
92  /// destructor
93  ~player(void)
94  { }
95 
96  // ===============================================================
97  /*!
98  Moving an operation sequence from a recorder to this player
99 
100  \param rec
101  the object that was used to record the operation sequence. After this
102  operation, the state of the recording is no longer defined. For example,
103  the pod_vector member variables in this have been swapped with rec.
104 
105  \param n_ind
106  the number of independent variables (only used for error checking
107  when NDEBUG is not defined).
108 
109  \par
110  Use an assert to check that the length of the following vectors is
111  less than the maximum possible value for addr_t; i.e., that an index
112  in these vectors can be represented using the type addr_t:
113  op_vec_, vecad_ind_vec_, arg_vec_, par_vec_, text_vec_.
114  */
115  void get(recorder<Base>& rec, size_t n_ind)
116  {
117 # ifndef NDEBUG
118  size_t addr_t_max = size_t( std::numeric_limits<addr_t>::max() );
119 # endif
120  // just set size_t values
121  num_var_rec_ = rec.num_var_rec_;
122  num_load_op_rec_ = rec.num_load_op_rec_;
123 
124  // op_rec_
125  op_vec_.swap(rec.op_vec_);
126  CPPAD_ASSERT_UNKNOWN(op_vec_.size() < addr_t_max );
127 
128  // op_arg_rec_
129  arg_vec_.swap(rec.arg_vec_);
130  CPPAD_ASSERT_UNKNOWN(arg_vec_.size() < addr_t_max );
131 
132  // par_rec_
133  par_vec_.swap(rec.par_vec_);
134  CPPAD_ASSERT_UNKNOWN(par_vec_.size() < addr_t_max );
135 
136  // text_rec_
137  text_vec_.swap(rec.text_vec_);
138  CPPAD_ASSERT_UNKNOWN(text_vec_.size() < addr_t_max );
139 
140  // vec_ind_rec_
141  vecad_ind_vec_.swap(rec.vecad_ind_vec_);
142  CPPAD_ASSERT_UNKNOWN(vecad_ind_vec_.size() < addr_t_max );
143 
144  // num_vecad_vec_rec_
145  num_vecad_vec_rec_ = 0;
146  { // vecad_ind_vec_ contains size of each VecAD followed by
147  // the parameter indices used to inialize it.
148  size_t i = 0;
149  while( i < vecad_ind_vec_.size() )
150  { num_vecad_vec_rec_++;
151  i += vecad_ind_vec_[i] + 1;
152  }
154  }
155 
156  // op2arg_vec_, op2var_vec_, var2op_vec_
159  addr_t num_op = addr_t( op_vec_.size() );
160  addr_t var_index = 0;
161  addr_t arg_index = 0;
162  //
163  op2arg_vec_.resize( num_op );
164  op2var_vec_.resize( num_op );
166 # ifndef NDEBUG
167  // value of var2op for auxillary variables is op_vec_.size() (invalid)
168  for(size_t i_var = 0; i_var < num_var_rec_; ++i_var)
169  var2op_vec_[i_var] = addr_t( op_vec_.size() );
170 # endif
171  for(addr_t i_op = 0; i_op < num_op; ++i_op)
172  { OpCode op = op_vec_[i_op];
173  //
174  // index of first argument for this operator
175  op2arg_vec_[i_op] = arg_index;
176  //
177  // index of first argument for next operator
178  arg_index += addr_t( NumArg(op) );
179  //
180  // index of first result for next operator
181  var_index += addr_t( NumRes(op) );
182  //
183  if( NumRes(op) > 0 )
184  { // index of last (primary) result for this operator
185  // when NumRes(op) > 0.
186  op2var_vec_[i_op] = var_index - 1;
187  //
188  // mapping from this primary variable to its operator
189  var2op_vec_[var_index - 1] = i_op;
190  //
191  if( op == CSumOp )
192  { // phony number of arguments
194  //
195  // pointer to first argument for this operator
196  addr_t* op_arg = arg_vec_.data() + arg_index;
197  //
198  // The actual number of arugments for this operator is
199  // op_arg[0] + op_arg[1] + 4. Correct index of
200  // first argument for next operator
201  arg_index += op_arg[0] + op_arg[1] + 4;
202  }
203  }
204  else
205  { // invalid index, no result for this operator
206  op2var_vec_[i_op] = addr_t( num_var_rec_ );
207  //
208  if( op == CSkipOp )
209  { // phony number of arguments
211  //
212  // pointer to first argument for this operator
213  addr_t* op_arg = arg_vec_.data() + arg_index;
214  //
215  // The actual number of arugments for this operator is
216  // 7 + op_arg[4] + op_arg[5]. Correct index of
217  // first argument for next operator.
218  arg_index += 7 + op_arg[4] + op_arg[5];
219  }
220  }
221  }
222  check_inv_op(n_ind);
223  check_dag();
224  }
225  // ----------------------------------------------------------------------
226  /*!
227  Check that InvOp operators start with second operator and are contiguous,
228  and there are n_ind of them.
229  */
230 # ifdef NDEBUG
231  void check_inv_op(size_t n_ind)
232  { return; }
233 # else
234  void check_inv_op(size_t n_ind)
235  { size_t num_op = op_vec_.size();
238  // start at second operator
239  for(size_t i_op = 1; i_op < num_op; ++i_op)
240  { OpCode op = op_vec_[i_op];
241  CPPAD_ASSERT_UNKNOWN( (op == InvOp) == (i_op <= n_ind) );
242  }
243  return;
244  }
245 
246 # endif
247  // ----------------------------------------------------------------------
248  /*!
249  Check arguments that are variables, to make sure the have value less
250  than or equal to the previously created variable. This is the directed
251  acyclic graph condition (DAG).
252  */
253 # ifdef NDEBUG
254  void check_dag(void)
255  { return; }
256 # else
257  void check_dag(void)
258  {
259  size_t num_op = op_vec_.size();
260  addr_t arg_var_bound = 0;
261  for(size_t i = 0; i < num_op; i++)
262  { OpCode op = op_vec_[i];
263  addr_t* op_arg = arg_vec_.data() + op2arg_vec_[i];
264  switch(op)
265  {
266  // cases where nothing to do
267  case BeginOp:
268  case EndOp:
269  case InvOp:
270  case LdpOp:
271  case ParOp:
272  case UserOp:
273  case UsrapOp:
274  case UsrrpOp:
275  case UsrrvOp:
276  case StppOp:
277  break;
278 
279  // only first argument is a variable
280  case AbsOp:
281  case AcosOp:
282  case AcoshOp:
283  case AsinOp:
284  case AsinhOp:
285  case AtanOp:
286  case AtanhOp:
287  case CosOp:
288  case CoshOp:
289  case DivvpOp:
290  case ErfOp:
291  case ExpOp:
292  case Expm1Op:
293  case LevpOp:
294  case LogOp:
295  case Log1pOp:
296  case LtvpOp:
297  case PowvpOp:
298  case SignOp:
299  case SinOp:
300  case SinhOp:
301  case SqrtOp:
302  case SubvpOp:
303  case TanOp:
304  case TanhOp:
305  case UsravOp:
306  case ZmulvpOp:
307  CPPAD_ASSERT_UNKNOWN(op_arg[0] <= arg_var_bound );
308  break;
309 
310  // only second argument is a variable
311  case AddpvOp:
312  case DisOp:
313  case DivpvOp:
314  case EqpvOp:
315  case LdvOp:
316  case LepvOp:
317  case LtpvOp:
318  case MulpvOp:
319  case NepvOp:
320  case PowpvOp:
321  case StvpOp:
322  case SubpvOp:
323  case ZmulpvOp:
324  CPPAD_ASSERT_UNKNOWN(op_arg[1] <= arg_var_bound );
325  break;
326 
327  // only first and second arguments are variables
328  case AddvvOp:
329  case DivvvOp:
330  case EqvvOp:
331  case LevvOp:
332  case LtvvOp:
333  case MulvvOp:
334  case NevvOp:
335  case PowvvOp:
336  case SubvvOp:
337  case ZmulvvOp:
338  CPPAD_ASSERT_UNKNOWN(op_arg[0] <= arg_var_bound );
339  CPPAD_ASSERT_UNKNOWN(op_arg[1] <= arg_var_bound );
340  break;
341 
342  // StpvOp
343  case StpvOp:
344  CPPAD_ASSERT_UNKNOWN(op_arg[2] <= arg_var_bound );
345  break;
346 
347  // StvvOp
348  case StvvOp:
349  CPPAD_ASSERT_UNKNOWN(op_arg[1] <= arg_var_bound );
350  CPPAD_ASSERT_UNKNOWN(op_arg[2] <= arg_var_bound );
351  break;
352 
353  // CSumOp
354  case CSumOp:
355  { addr_t num_add = op_arg[0];
356  addr_t num_sub = op_arg[1];
357  for(addr_t j = 0; j < num_add + num_sub; j++)
358  CPPAD_ASSERT_UNKNOWN(op_arg[3+j] <= arg_var_bound);
359  }
360  break;
361 
362  // CExpOp
363  case CExpOp:
364  if( op_arg[1] & 1 )
365  CPPAD_ASSERT_UNKNOWN( op_arg[2] <= arg_var_bound);
366  if( op_arg[1] & 2 )
367  CPPAD_ASSERT_UNKNOWN( op_arg[3] <= arg_var_bound);
368  if( op_arg[1] & 4 )
369  CPPAD_ASSERT_UNKNOWN( op_arg[4] <= arg_var_bound);
370  if( op_arg[1] & 8 )
371  CPPAD_ASSERT_UNKNOWN( op_arg[5] <= arg_var_bound);
372  break;
373 
374  // PriOp
375  case PriOp:
376  if( op_arg[0] & 1 )
377  CPPAD_ASSERT_UNKNOWN( op_arg[1] <= arg_var_bound);
378  if( op_arg[0] & 2 )
379  CPPAD_ASSERT_UNKNOWN( op_arg[3] <= arg_var_bound);
380  break;
381 
382  // CSkipOp, PriOp
383  case CSkipOp:
384  if( op_arg[1] & 1 )
385  CPPAD_ASSERT_UNKNOWN( op_arg[2] <= arg_var_bound);
386  if( op_arg[1] & 2 )
387  CPPAD_ASSERT_UNKNOWN( op_arg[3] <= arg_var_bound);
388  break;
389 
390  default:
391  CPPAD_ASSERT_UNKNOWN(false);
392  break;
393 
394 
395  }
396  if( NumRes(op) > 0 )
397  { addr_t var_index = op2var_vec_[i];
398  if( var_index > 0 )
399  { CPPAD_ASSERT_UNKNOWN(arg_var_bound < var_index);
400  }
401  else
402  { CPPAD_ASSERT_UNKNOWN(arg_var_bound == var_index);
403  }
404  //
405  arg_var_bound = var_index;
406  }
407  }
408  }
409 # endif
410  // ===============================================================
411  /*!
412  Copying an operation sequence from another player to this one
413 
414  \param play
415  the object that contains the operatoion sequence to copy.
416  */
417  void operator=(const player& play)
418  {
419  num_var_rec_ = play.num_var_rec_;
420  num_load_op_rec_ = play.num_load_op_rec_;
421  op_vec_ = play.op_vec_;
422  num_vecad_vec_rec_ = play.num_vecad_vec_rec_;
423  vecad_ind_vec_ = play.vecad_ind_vec_;
424  arg_vec_ = play.arg_vec_;
425  par_vec_ = play.par_vec_;
426  text_vec_ = play.text_vec_;
427  op2arg_vec_ = play.op2arg_vec_;
428  op2var_vec_ = play.op2var_vec_;
429  var2op_vec_ = play.var2op_vec_;
430  }
431  // ===============================================================
432  /// Erase the recording stored in the player
433  void Erase(void)
434  {
435  num_var_rec_ = 0;
436  num_load_op_rec_ = 0;
437  num_vecad_vec_rec_ = 0;
438 
439  op_vec_.resize(0);
441  arg_vec_.resize(0);
442  par_vec_.resize(0);
443  text_vec_.resize(0);
444  op2arg_vec_.resize(0);
445  op2var_vec_.resize(0);
446  var2op_vec_.resize(0);
447  }
448  // ================================================================
449  // const functions that retrieve infromation from this player
450  // ================================================================
451  /*!
452  \brief
453  fetch the operator corresponding to a primary variable
454 
455  \param var_index
456  must be the index of a primary variable.
457 
458  \return
459  is the index of the operator corresponding to this primary variable.
460  */
461  size_t var2op(size_t var_index) const
462  { size_t i_op = var2op_vec_[var_index];
463  // check that var_index is a primary variable index
464  CPPAD_ASSERT_UNKNOWN( i_op < op_vec_.size() );
465  return i_op;
466  }
467  /*!
468  \brief
469  fetch the information corresponding to an operator
470 
471  \param op_index
472  index for this operator [in]
473 
474  \param op [out]
475  op code for this operator.
476 
477  \param op_arg [out]
478  pointer to the first arguement to this operator.
479 
480  \param var_index [out]
481  index of the last variable (primary variable) for this operator.
482  If there is no primary variable for this operator, i_var not sepcified
483  and could have any value.
484  */
486  size_t op_index ,
487  OpCode& op ,
488  const addr_t*& op_arg ,
489  size_t& var_index ) const
490  { op = OpCode( op_vec_[op_index] );
491  op_arg = op2arg_vec_[op_index] + arg_vec_.data();
492  var_index = op2var_vec_[op_index];
493  return;
494  }
495  /*!
496  \brief
497  unpack extra information corresponding to a UserOp
498 
499  \param op [in]
500  must be a UserOp
501 
502  \param op_arg [in]
503  is the arguments for this operator
504 
505  \param user_old [out]
506  is the extra information passed to the old style user atomic functions.
507 
508  \param user_m [out]
509  is the number of results for this user atmoic function.
510 
511  \param user_n [out]
512  is the number of arguments for this user atmoic function.
513 
514  \return
515  Is a pointer to this user atomic function.
516  */
518  const OpCode op ,
519  const addr_t* op_arg ,
520  size_t& user_old ,
521  size_t& user_m ,
522  size_t& user_n ) const
523  { atomic_base<Base>* user_atom;
524  //
525  CPPAD_ASSERT_UNKNOWN( op == UserOp );
526  CPPAD_ASSERT_NARG_NRES(op, 4, 0);
527  //
528  user_old = op_arg[1];
529  user_n = op_arg[2];
530  user_m = op_arg[3];
531  CPPAD_ASSERT_UNKNOWN( user_n > 0 );
532  //
533  size_t user_index = size_t( op_arg[0] );
534  user_atom = atomic_base<Base>::class_object(user_index);
535 # ifndef NDEBUG
536  if( user_atom == CPPAD_NULL )
537  { // user_atom is null so cannot use user_atom->afun_name()
538  std::string msg = atomic_base<Base>::class_name(user_index)
539  + ": atomic_base function has been deleted";
540  CPPAD_ASSERT_KNOWN(false, msg.c_str() );
541  }
542 # endif
543  // the atomic_base object corresponding to this user function
544  user_atom = atomic_base<Base>::class_object(user_index);
545  CPPAD_ASSERT_UNKNOWN( user_atom != CPPAD_NULL );
546  return user_atom;
547  }
548  /*!
549  \brief
550  fetch an operator from the recording.
551 
552  \return
553  the i-th operator in the recording.
554 
555  \param i
556  the index of the operator in recording
557  */
558  OpCode GetOp (size_t i) const
559  { return OpCode(op_vec_[i]); }
560 
561  /*!
562  \brief
563  Fetch a VecAD index from the recording.
564 
565  \return
566  the i-th VecAD index in the recording.
567 
568  \param i
569  the index of the VecAD index in recording
570  */
571  size_t GetVecInd (size_t i) const
572  { return vecad_ind_vec_[i]; }
573 
574  /*!
575  \brief
576  Fetch a parameter from the recording.
577 
578  \return
579  the i-th parameter in the recording.
580 
581  \param i
582  the index of the parameter in recording
583  */
584  Base GetPar(size_t i) const
585  { return par_vec_[i]; }
586 
587  /*!
588  \brief
589  Fetch entire parameter vector from the recording.
590 
591  \return
592  the entire parameter vector.
593 
594  */
595  const Base* GetPar(void) const
596  { return par_vec_.data(); }
597 
598  /*!
599  \brief
600  Fetch a '\\0' terminated string from the recording.
601 
602  \return
603  the beginning of the string.
604 
605  \param i
606  the index where the string begins.
607  */
608  const char *GetTxt(size_t i) const
610  return text_vec_.data() + i;
611  }
612 
613  /// Fetch number of variables in the recording.
614  size_t num_var_rec(void) const
615  { return num_var_rec_; }
616 
617  /// Fetch number of vecad load operations
618  size_t num_load_op_rec(void) const
619  { return num_load_op_rec_; }
620 
621  /// Fetch number of operators in the recording.
622  size_t num_op_rec(void) const
623  { return op_vec_.size(); }
624 
625  /// Fetch number of VecAD indices in the recording.
626  size_t num_vec_ind_rec(void) const
627  { return vecad_ind_vec_.size(); }
628 
629  /// Fetch number of VecAD vectors in the recording
630  size_t num_vecad_vec_rec(void) const
631  { return num_vecad_vec_rec_; }
632 
633  /// Fetch number of argument indices in the recording.
634  size_t num_op_arg_rec(void) const
635  { return arg_vec_.size(); }
636 
637  /// Fetch number of parameters in the recording.
638  size_t num_par_rec(void) const
639  { return par_vec_.size(); }
640 
641  /// Fetch number of characters (representing strings) in the recording.
642  size_t num_text_rec(void) const
643  { return text_vec_.size(); }
644 
645  /// Fetch a rough measure of amount of memory used to store recording
646  /// using just lengths, not capacities; see the heading size_op_arg
647  /// in the file seq_property.omh.
648  size_t Memory(void) const
649  { // check assumptions made by ad_fun<Base>::size_op_seq()
657  //
658  return op_vec_.size() * sizeof(OpCode)
659  + arg_vec_.size() * sizeof(addr_t)
660  + par_vec_.size() * sizeof(Base)
661  + text_vec_.size() * sizeof(char)
662  + vecad_ind_vec_.size() * sizeof(addr_t)
663  + op_vec_.size() * sizeof(addr_t) * 3
664  ;
665  }
666 
667 };
668 
669 } } // END_CPPAD_lOCAL_NAMESPACE
670 # endif
size_t num_var_rec_
Number of variables in the recording.
Definition: player.hpp:38
#define CPPAD_ASSERT_KNOWN(exp, msg)
Check that exp is true, if not print msg and terminate execution.
void resize(size_t n)
resize the vector (existing elements preserved when n &lt;= capacity_).
Definition: pod_vector.hpp:180
size_t num_par_rec(void) const
Fetch number of parameters in the recording.
Definition: player.hpp:638
static std::vector< atomic_base * > & class_object(void)
List of all the object in this class.
Definition: atomic_base.hpp:83
pod_vector< Base > par_vec_
The parameters in the recording. Note that Base may not be plain old data, so use false in consructor...
Definition: player.hpp:54
size_t num_vec_ind_rec(void) const
Fetch number of VecAD indices in the recording.
Definition: player.hpp:626
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 Memory(void) const
Fetch a rough measure of amount of memory used to store recording using just lengths, not capacities; see the heading size_op_arg in the file seq_property.omh.
Definition: player.hpp:648
const char * GetTxt(size_t i) const
Fetch a &#39;\0&#39; terminated string from the recording.
Definition: player.hpp:608
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
const Base * GetPar(void) const
Fetch entire parameter vector from the recording.
Definition: player.hpp:595
size_t GetVecInd(size_t i) const
Fetch a VecAD index from the recording.
Definition: player.hpp:571
~player(void)
destructor
Definition: player.hpp:93
size_t NumRes(OpCode op)
Number of variables resulting from the specified operation.
Definition: op_code.hpp:281
pod_vector< OpCode > op_vec_
The operators in the recording.
Definition: player.hpp:47
static std::vector< std::string > & class_name(void)
List of names for each object in this class.
Definition: atomic_base.hpp:89
pod_vector< addr_t > arg_vec_
The operation argument indices in the recording.
Definition: player.hpp:50
atomic_base< Base > * get_user_info(const OpCode op, const addr_t *op_arg, size_t &user_old, size_t &user_m, size_t &user_n) const
unpack extra information corresponding to a UserOp
Definition: player.hpp:517
OpCode
Type used to distinguish different AD&lt; Base &gt; atomic operations.
Definition: op_code.hpp:49
pod_vector< addr_t > var2op_vec_
Mapping from primary variable index to corresponding operator index. This is used to traverse sub-gra...
Definition: player.hpp:81
Class used to store an operation sequence while it is being recorded (the operation sequence is copie...
Definition: declare_ad.hpp:28
void get_op_info(size_t op_index, OpCode &op, const addr_t *&op_arg, size_t &var_index) const
fetch the information corresponding to an operator
Definition: player.hpp:485
void check_inv_op(size_t n_ind)
Check that InvOp operators start with second operator and are contiguous, and there are n_ind of them...
Definition: player.hpp:234
pod_vector< addr_t > op2var_vec_
Index of the result variable for each operator.
Definition: player.hpp:76
size_t size(void) const
current number of elements in this vector.
Definition: pod_vector.hpp:79
size_t num_vecad_vec_rec(void) const
Fetch number of VecAD vectors in the recording.
Definition: player.hpp:630
Type * data(void)
current data pointer is no longer valid after any of the following: extend, erase, operator=, and ~pod_vector. Take extreem care when using this function.
Definition: pod_vector.hpp:89
pod_vector< char > text_vec_
Character strings (&#39;\0&#39; terminated) in the recording.
Definition: player.hpp:57
void check_dag(void)
Check arguments that are variables, to make sure the have value less than or equal to the previously ...
Definition: player.hpp:257
void swap(pod_vector &other)
Swap all properties of this vector with another.
Definition: pod_vector.hpp:300
#define CPPAD_ASSERT_UNKNOWN(exp)
Check that exp is true, if not terminate execution.
void Erase(void)
Erase the recording stored in the player.
Definition: player.hpp:433
size_t num_op_rec(void) const
Fetch number of operators in the recording.
Definition: player.hpp:622
pod_vector< addr_t > vecad_ind_vec_
The VecAD indices in the recording.
Definition: player.hpp:60
size_t num_load_op_rec_
number of vecad load opeations in the reconding
Definition: player.hpp:41
size_t num_text_rec(void) const
Fetch number of characters (representing strings) in the recording.
Definition: player.hpp:642
#define CPPAD_ASSERT_NARG_NRES(op, n_arg, n_res)
Check that operator op has the specified number of of arguments and results.
size_t num_vecad_vec_rec_
Number of VecAD vectors in the recording.
Definition: player.hpp:44
size_t var2op(size_t var_index) const
fetch the operator corresponding to a primary variable
Definition: player.hpp:461
size_t num_op_arg_rec(void) const
Fetch number of argument indices in the recording.
Definition: player.hpp:634
player(void)
constructor
Definition: player.hpp:86
pod_vector< addr_t > op2arg_vec_
index in arg_vec_ corresonding to the first argument for each operator
Definition: player.hpp:67
Base GetPar(size_t i) const
Fetch a parameter from the recording.
Definition: player.hpp:584
OpCode GetOp(size_t i) const
fetch an operator from the recording.
Definition: player.hpp:558
void operator=(const player &play)
Copying an operation sequence from another player to this one.
Definition: player.hpp:417
size_t num_var_rec(void) const
Fetch number of variables in the recording.
Definition: player.hpp:614