CppAD: A C++ Algorithmic Differentiation Package 20110419
output.hpp
Go to the documentation of this file.
00001 /* $Id$ */
00002 # ifndef CPPAD_OUTPUT_INCLUDED
00003 # define CPPAD_OUTPUT_INCLUDED
00004 
00005 /* --------------------------------------------------------------------------
00006 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-08 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 Output$$
00018 $spell
00019         VecAD
00020         std
00021         ostream
00022         const
00023 $$
00024 
00025 $index <<, AD output$$
00026 $index AD, stream output$$
00027 $index output, AD$$
00028 $index stream, AD output$$
00029 $index write, AD$$
00030 
00031 $section AD Output Stream Operator$$ 
00032 
00033 $head Syntax$$
00034 $syntax%%os% << %x%$$
00035 
00036 
00037 $head Purpose$$
00038 Writes the $italic Base$$ value_, corresponding to $italic x$$,
00039 to the output stream $italic os$$.
00040 
00041 $head os$$
00042 The operand $italic os$$ has prototype
00043 $syntax%
00044         std::ostream &%os%
00045 %$$
00046 
00047 $head x$$
00048 The operand $italic x$$ has one of the following prototypes
00049 $syntax%
00050         const AD<%Base%>               &%x%
00051         const VecAD<%Base%>::reference &%x%
00052 %$$
00053 
00054 $head Result$$
00055 The result of this operation can be used as a reference to $italic os$$.
00056 For example, if the operand $italic y$$ has prototype
00057 $syntax%
00058         AD<%Base%> %y%
00059 %$$
00060 then the syntax
00061 $syntax%
00062         %os% << %x% << %y%
00063 %$$
00064 will output the value corresponding to $italic x$$
00065 followed by the value corresponding to $italic y$$. 
00066 
00067 $head Operation Sequence$$
00068 The result of this operation is not an
00069 $xref/glossary/AD of Base/AD of Base/$$ object.
00070 Thus it will not be recorded as part of an
00071 AD of $italic Base$$
00072 $xref/glossary/Operation/Sequence/operation sequence/1/$$.
00073 
00074 $head Example$$
00075 $children%
00076         example/output.cpp
00077 %$$
00078 The file
00079 $xref/Output.cpp/$$
00080 contains an example and test of this operation.
00081 It returns true if it succeeds and false otherwise.
00082 
00083 $end
00084 ------------------------------------------------------------------------------
00085 */
00086 
00087 namespace CppAD { 
00088 
00089         template <class Base>
00090         CPPAD_INLINE std::ostream& operator << 
00091         (std::ostream &os, const AD<Base> &x)
00092         {       return (os << x.value_); }
00093 
00094         template <class Base>
00095         CPPAD_INLINE std::ostream& operator << 
00096         (std::ostream &os, const VecAD_reference<Base> &x)
00097         {       return (os << x.ADBase()); }
00098 
00099 }
00100 
00101 # endif