CppAD: A C++ Algorithmic Differentiation Package 20110419
|
00001 /* $Id$ */ 00002 # ifndef CPPAD_STD_MATH_UNARY_INCLUDED 00003 # define CPPAD_STD_MATH_UNARY_INCLUDED 00004 00005 /* -------------------------------------------------------------------------- 00006 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-07 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 ------------------------------------------------------------------------------- 00018 $begin std_math_unary$$ 00019 $spell 00020 cppad.hpp 00021 Vec 00022 std 00023 atan 00024 const 00025 acos 00026 asin 00027 atan 00028 cos 00029 exp 00030 sqrt 00031 CppAD 00032 namespace 00033 tanh 00034 $$ 00035 00036 $index standard, math unary$$ 00037 $index math, unary$$ 00038 $index unary, math$$ 00039 00040 $index abs, float and double$$ 00041 $index acos, float and double$$ 00042 $index asin, float and double$$ 00043 $index atan, float and double$$ 00044 $index cos, float and double$$ 00045 $index cosh, float and double$$ 00046 $index exp, float and double$$ 00047 $index log, float and double$$ 00048 $index log10, float and double$$ 00049 $index sin, float and double$$ 00050 $index sinh, float and double$$ 00051 $index sqrt, float and double$$ 00052 $index tan, float and double$$ 00053 $index tanh, float and double$$ 00054 00055 $section Float and Double Standard Math Unary Functions$$ 00056 00057 $head Syntax$$ 00058 $syntax%# include <cppad/std_math_unary.hpp>%$$ 00059 $syntax%%y% = %fun%(%x%)%$$ 00060 00061 00062 $head Purpose$$ 00063 Places a copy of the standard math unary functions in the CppAD namespace. 00064 This is included with $code <cppad/cppad.hpp>$$ and can 00065 be included separately. 00066 00067 $head Type$$ 00068 The $italic Type$$ is determined by the argument $italic x$$ 00069 and is either $code float$$ or $code double$$. 00070 00071 $head x$$ 00072 The argument $italic x$$ has the following prototype 00073 $syntax% 00074 const %Type% &%x% 00075 %$$ 00076 00077 $head y$$ 00078 The result $italic y$$ has prototype 00079 $syntax% 00080 %Type% %y% 00081 %$$ 00082 00083 $head fun$$ 00084 A definition of $italic fun$$ is included for each of the 00085 following functions: 00086 $code abs$$, 00087 $code acos$$, 00088 $code asin$$, 00089 $code atan$$, 00090 $code cos$$, 00091 $code cosh$$ 00092 $code exp$$, 00093 $code log$$, 00094 $code log10$$, 00095 $code sin$$, 00096 $code sinh$$, 00097 $code sqrt$$, 00098 $code tan$$, 00099 $code tanh$$, 00100 00101 $end 00102 ------------------------------------------------------------------------------- 00103 */ 00104 00105 # include <cmath> 00106 00107 # define CPPAD_STANDARD_MATH_UNARY(Name) \ 00108 \ 00109 inline float Name(const float &x) \ 00110 { return std::Name(x); } \ 00111 \ 00112 inline double Name(const double &x) \ 00113 { return std::Name(x); } 00114 00115 namespace CppAD { 00116 00117 CPPAD_STANDARD_MATH_UNARY(abs) 00118 CPPAD_STANDARD_MATH_UNARY(acos) 00119 CPPAD_STANDARD_MATH_UNARY(asin) 00120 CPPAD_STANDARD_MATH_UNARY(atan) 00121 CPPAD_STANDARD_MATH_UNARY(cos) 00122 CPPAD_STANDARD_MATH_UNARY(cosh) 00123 CPPAD_STANDARD_MATH_UNARY(exp) 00124 CPPAD_STANDARD_MATH_UNARY(log) 00125 CPPAD_STANDARD_MATH_UNARY(log10) 00126 CPPAD_STANDARD_MATH_UNARY(sin) 00127 CPPAD_STANDARD_MATH_UNARY(sinh) 00128 CPPAD_STANDARD_MATH_UNARY(sqrt) 00129 CPPAD_STANDARD_MATH_UNARY(tan) 00130 CPPAD_STANDARD_MATH_UNARY(tanh) 00131 } 00132 00133 # undef CPPAD_STANDARD_MATH_UNARY 00134 00135 # endif