CppAD: A C++ Algorithmic Differentiation Package
20130102
|
00001 // $Id$ 00002 # ifndef CPPAD_BASE_REQUIRE_INCLUDED 00003 # define CPPAD_BASE_REQUIRE_INCLUDED 00004 00005 /* -------------------------------------------------------------------------- 00006 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell 00007 00008 CppAD is distributed under multiple licenses. This distribution is under 00009 the terms of the 00010 Eclipse 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 base_require$$ 00018 $spell 00019 ostream 00020 alloc 00021 eps 00022 std 00023 Lt 00024 Le 00025 Eq 00026 Ge 00027 Gt 00028 cppad.hpp 00029 namespace 00030 acos 00031 asin 00032 atan 00033 cos 00034 sqrt 00035 optimizations 00036 bool 00037 const 00038 CppAD 00039 enum 00040 Lt 00041 Le 00042 Eq 00043 Ge 00044 Gt 00045 inline 00046 Op 00047 std 00048 CondExp 00049 erf 00050 $$ 00051 00052 $index Base, require$$ 00053 $index require, Base type$$ 00054 $index type, Base require$$ 00055 00056 $section AD<Base> Requirements for Base Type$$ 00057 00058 $head Syntax$$ 00059 $code include <cppad/base_require.hpp>$$ 00060 00061 $head Warning$$ 00062 This is a preliminary version of these specifications 00063 and it is subject to change in future versions of CppAD. 00064 00065 $head Purpose$$ 00066 This section lists the requirements that the type 00067 $icode Base$$ so that the type $codei%AD<%Base%>%$$ can be used. 00068 00069 $subhead Standard Base Types$$ 00070 In the case where $icode Base$$ is 00071 $code float$$, 00072 $code double$$, 00073 $code std::complex<float>$$, 00074 $code std::complex<double>$$, 00075 or $codei%AD<%Other%>%$$, 00076 these requirements are provided by including the file 00077 $code cppad/cppad.hpp$$. 00078 00079 $head Include Order$$ 00080 If you are linking a non-standard base type to CppAD, 00081 you must first include the file $code cppad/base_require.hpp/$$, 00082 then provide the specifications below, 00083 and then include the file $code cppad/cppad.hpp$$. 00084 00085 $head Numeric Type$$ 00086 The type $icode Base$$ must support all the operations for a 00087 $cref NumericType$$. 00088 00089 $head Output Operator$$ 00090 $index output, base operator$$ 00091 $index base, output operator$$ 00092 $index operator, base output$$ 00093 The type $icode Base$$ must support the syntax 00094 $codei% 00095 %os% << %x% 00096 %$$ 00097 where $icode os$$ is an $code std::ostream&$$ 00098 and $icode x$$ is a $code const base_alloc&$$. 00099 For example, see 00100 $cref/base_alloc/base_alloc.hpp/Output Operator/$$. 00101 00102 $head Integer$$ 00103 $index Integer, base require$$ 00104 $index base, Integer require$$ 00105 $index require, base Integer$$ 00106 The type $icode Base$$ must support the syntax 00107 $codei% 00108 %i% = CppAD::Integer(%x%) 00109 %$$ 00110 which converts $icode x$$ to an $code int$$. 00111 The argument $icode x$$ has prototype 00112 $codei% 00113 const %Base%& %x% 00114 %$$ 00115 and the return value $icode i$$ has prototype 00116 $codei% 00117 int %i% 00118 %$$ 00119 00120 $subhead Suggestion$$ 00121 In many cases, the $icode Base$$ version of the $code Integer$$ function 00122 can be defined by 00123 $codei% 00124 namespace CppAD { 00125 inline int Integer(const %Base%& x) 00126 { return static_cast<int>(x); } 00127 } 00128 %$$ 00129 For example, see 00130 $cref/base_float/base_float.hpp/Integer/$$ and 00131 $cref/base_alloc/base_alloc.hpp/Integer/$$. 00132 00133 $childtable% 00134 omh/base_member.omh% 00135 cppad/local/base_cond_exp.hpp% 00136 omh/base_identical.omh% 00137 omh/base_ordered.omh% 00138 cppad/local/base_std_math.hpp% 00139 omh/base_example.omh 00140 %$$ 00141 00142 $end 00143 */ 00144 00145 // definitions that must come before base implementations 00146 # include <cppad/error_handler.hpp> 00147 # include <cppad/local/define.hpp> 00148 # include <cppad/local/cppad_assert.hpp> 00149 # include <cppad/local/declare_ad.hpp> 00150 00151 // grouping documentation by feature 00152 # include <cppad/local/base_cond_exp.hpp> 00153 # include <cppad/local/base_std_math.hpp> 00154 00155 // must define template class numeric_limits before the base cases 00156 # include <cppad/local/limits.hpp> 00157 # include <cppad/local/epsilon.hpp> // deprecated 00158 00159 // base cases that come with CppAD 00160 # include <cppad/local/base_float.hpp> 00161 # include <cppad/local/base_double.hpp> 00162 # include <cppad/local/base_complex.hpp> 00163 00164 # endif