00001 # ifndef CPPAD_UNARY_PLUS_INCLUDED 00002 # define CPPAD_UNARY_PLUS_INCLUDED 00003 00004 /* -------------------------------------------------------------------------- 00005 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-06 Bradley M. Bell 00006 00007 CppAD is distributed under multiple licenses. This distribution is under 00008 the terms of the 00009 Common Public License Version 1.0. 00010 00011 A copy of this license is included in the COPYING file of this distribution. 00012 Please visit http://www.coin-or.org/CppAD/ for information on other licenses. 00013 -------------------------------------------------------------------------- */ 00014 00015 /* 00016 $begin UnaryPlus$$ 00017 $spell 00018 Vec 00019 const 00020 inline 00021 $$ 00022 00023 $index unary, AD plus operator$$ 00024 $index AD, unary plus operator$$ 00025 $index plus, AD unary operator$$ 00026 $index +, AD unary operator$$ 00027 00028 $section AD Unary Plus Operator$$ 00029 00030 $head Syntax$$ 00031 00032 $syntax%%y% = + %x%$$ 00033 00034 00035 $head Purpose$$ 00036 Performs the unary plus operation 00037 (the result $italic y$$ is equal to the operand $italic x$$). 00038 00039 00040 $head x$$ 00041 The operand $italic x$$ has one of the following prototypes 00042 $syntax% 00043 const AD<%Base%> &%x% 00044 const VecAD<%Base%>::reference &%x% 00045 %$$ 00046 00047 $head y$$ 00048 The result $italic y$$ has type 00049 $syntax% 00050 AD<%Base%> %y% 00051 %$$ 00052 It is equal to the operand $italic x$$. 00053 00054 $head Operation Sequence$$ 00055 This is an AD of $italic Base$$ 00056 $xref/glossary/Operation/Atomic/atomic operation/1/$$ 00057 and hence is part of the current 00058 AD of $italic Base$$ 00059 $xref/glossary/Operation/Sequence/operation sequence/1/$$. 00060 00061 $head Derivative$$ 00062 If $latex f$$ is a 00063 $xref/glossary/Base Function/Base function/$$, 00064 $latex \[ 00065 \D{[ + f(x) ]}{x} = \D{f(x)}{x} 00066 \] $$ 00067 00068 00069 00070 $head Example$$ 00071 $children% 00072 example/unary_plus.cpp 00073 %$$ 00074 The file 00075 $xref/UnaryPlus.cpp/$$ 00076 contains an example and test of this operation. 00077 00078 $end 00079 ------------------------------------------------------------------------------- 00080 */ 00081 00082 // BEGIN CppAD namespace 00083 namespace CppAD { 00084 00085 template <class Base> 00086 inline AD<Base> AD<Base>::operator + (void) const 00087 { AD<Base> result(*this); 00088 00089 return result; 00090 } 00091 00092 00093 template <class Base> 00094 inline AD<Base> operator + (const VecAD_reference<Base> &right) 00095 { return right.ADBase(); } 00096 00097 } 00098 // END CppAD namespace 00099 00100 00101 # endif