00001 # ifndef CPPAD_OUTPUT_INCLUDED 00002 # define CPPAD_OUTPUT_INCLUDED 00003 00004 /* -------------------------------------------------------------------------- 00005 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-07 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 Output$$ 00017 $spell 00018 VecAD 00019 inline 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 template <class Base> 00089 inline std::ostream& operator << (std::ostream &os, const AD<Base> &x) 00090 { return (os << x.value_); } 00091 00092 template <class Base> 00093 inline std::ostream& operator << 00094 (std::ostream &os, const VecAD_reference<Base> &x) 00095 { return (os << x.ADBase()); } 00096 00097 } 00098 00099 # endif