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