CppAD: A C++ Algorithmic Differentiation Package  20171217
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
unary_plus.hpp
Go to the documentation of this file.
1 # ifndef CPPAD_CORE_UNARY_PLUS_HPP
2 # define CPPAD_CORE_UNARY_PLUS_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 $begin UnaryPlus$$
17 $spell
18  Vec
19  const
20  inline
21 $$
22 
23 
24 $section AD Unary Plus Operator$$
25 $mindex +$$
26 
27 $head Syntax$$
28 
29 $icode%y% = + %x%$$
30 
31 
32 $head Purpose$$
33 Performs the unary plus operation
34 (the result $icode y$$ is equal to the operand $icode x$$).
35 
36 
37 $head x$$
38 The operand $icode x$$ has one of the following prototypes
39 $codei%
40  const AD<%Base%> &%x%
41  const VecAD<%Base%>::reference &%x%
42 %$$
43 
44 $head y$$
45 The result $icode y$$ has type
46 $codei%
47  AD<%Base%> %y%
48 %$$
49 It is equal to the operand $icode x$$.
50 
51 $head Operation Sequence$$
52 This is an AD of $icode Base$$
53 $cref/atomic operation/glossary/Operation/Atomic/$$
54 and hence is part of the current
55 AD of $icode Base$$
56 $cref/operation sequence/glossary/Operation/Sequence/$$.
57 
58 $head Derivative$$
59 If $latex f$$ is a
60 $cref/Base function/glossary/Base Function/$$,
61 $latex \[
62  \D{[ + f(x) ]}{x} = \D{f(x)}{x}
63 \] $$
64 
65 
66 
67 $head Example$$
68 $children%
69  example/general/unary_plus.cpp
70 %$$
71 The file
72 $cref unary_plus.cpp$$
73 contains an example and test of this operation.
74 
75 $end
76 -------------------------------------------------------------------------------
77 */
78 
79 // BEGIN CppAD namespace
80 namespace CppAD {
81 
82 template <class Base>
83 inline AD<Base> AD<Base>::operator + (void) const
84 { AD<Base> result(*this);
85 
86  return result;
87 }
88 
89 
90 template <class Base>
92 { return right.ADBase(); }
93 
94 }
95 // END CppAD namespace
96 
97 
98 # endif
Definition: ad.hpp:34
AD< Base > ADBase(void) const
Conversion from VecAD_reference to AD&lt;Base&gt;. puts the correspond vecad load instruction in the tape...
Definition: vec_ad.hpp:392
Class used to hold a reference to an element of a VecAD object.
Definition: vec_ad.hpp:352
AD< Base > operator+(const AD< Base > &left, const AD< Base > &right)
Definition: add.hpp:20
AD operator+(void) const
Definition: unary_plus.hpp:83