|
Sacado Package Browser (Single Doxygen Collection) Version of the Day
|
00001 // $Id$ 00002 // $Source$ 00003 // @HEADER 00004 // *********************************************************************** 00005 // 00006 // Sacado Package 00007 // Copyright (2006) Sandia Corporation 00008 // 00009 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00010 // the U.S. Government retains certain rights in this software. 00011 // 00012 // This library is free software; you can redistribute it and/or modify 00013 // it under the terms of the GNU Lesser General Public License as 00014 // published by the Free Software Foundation; either version 2.1 of the 00015 // License, or (at your option) any later version. 00016 // 00017 // This library is distributed in the hope that it will be useful, but 00018 // WITHOUT ANY WARRANTY; without even the implied warranty of 00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 // Lesser General Public License for more details. 00021 // 00022 // You should have received a copy of the GNU Lesser General Public 00023 // License along with this library; if not, write to the Free Software 00024 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00025 // USA 00026 // Questions? Contact David M. Gay (dmgay@sandia.gov) or Eric T. Phipps 00027 // (etphipp@sandia.gov). 00028 // 00029 // *********************************************************************** 00030 // @HEADER 00031 00032 #ifndef SACADO_MATHFUNCTIONS_HPP 00033 #define SACADO_MATHFUNCTIONS_HPP 00034 00035 #define UNARYFUNC_MACRO(OP,FADOP) \ 00036 namespace Sacado { \ 00037 \ 00038 namespace Fad { \ 00039 template <typename T> class FADOP; \ 00040 template <typename T> class Expr; \ 00041 template <typename T> \ 00042 Expr< FADOP< Expr<T> > > OP (const Expr<T>&); \ 00043 template <typename T> class SimpleFad; \ 00044 template <typename T> \ 00045 SimpleFad<T> OP (const SimpleFad<T>&); \ 00046 } \ 00047 \ 00048 namespace ELRFad { \ 00049 template <typename T> class FADOP; \ 00050 template <typename T> class Expr; \ 00051 template <typename T> \ 00052 Expr< FADOP< Expr<T> > > OP (const Expr<T>&); \ 00053 } \ 00054 \ 00055 namespace CacheFad { \ 00056 template <typename T> class FADOP; \ 00057 template <typename T> class Expr; \ 00058 template <typename T> \ 00059 Expr< FADOP< Expr<T> > > OP (const Expr<T>&); \ 00060 } \ 00061 \ 00062 namespace ELRCacheFad { \ 00063 template <typename T> class FADOP; \ 00064 template <typename T> class Expr; \ 00065 template <typename T> \ 00066 Expr< FADOP< Expr<T> > > OP (const Expr<T>&); \ 00067 } \ 00068 \ 00069 namespace LFad { \ 00070 template <typename T> class FADOP; \ 00071 template <typename T> class Expr; \ 00072 template <typename T> \ 00073 Expr< FADOP< Expr<T> > > OP (const Expr<T>&); \ 00074 } \ 00075 \ 00076 namespace Tay { \ 00077 template <typename T> class Taylor; \ 00078 template <typename T> Taylor<T> OP (const Taylor<T>&); \ 00079 } \ 00080 \ 00081 namespace FlopCounterPack { \ 00082 template <typename T> class ScalarFlopCounter; \ 00083 template <typename T> \ 00084 ScalarFlopCounter<T> OP (const ScalarFlopCounter<T>&); \ 00085 } \ 00086 \ 00087 namespace Rad { \ 00088 template <typename T> class ADvari; \ 00089 template <typename T> class IndepADvar; \ 00090 template <typename T> ADvari<T>& OP (const ADvari<T>&); \ 00091 template <typename T> ADvari<T>& OP (const IndepADvar<T>&); \ 00092 } \ 00093 } \ 00094 \ 00095 namespace std { \ 00096 using Sacado::Fad::OP; \ 00097 using Sacado::ELRFad::OP; \ 00098 using Sacado::CacheFad::OP; \ 00099 using Sacado::ELRCacheFad::OP; \ 00100 using Sacado::LFad::OP; \ 00101 using Sacado::Tay::OP; \ 00102 using Sacado::FlopCounterPack::OP; \ 00103 using Sacado::Rad::OP; \ 00104 } 00105 00106 UNARYFUNC_MACRO(exp, ExpOp) 00107 UNARYFUNC_MACRO(log, LogOp) 00108 UNARYFUNC_MACRO(log10, Log10Op) 00109 UNARYFUNC_MACRO(sqrt, SqrtOp) 00110 UNARYFUNC_MACRO(cos, CosOp) 00111 UNARYFUNC_MACRO(sin, SinOp) 00112 UNARYFUNC_MACRO(tan, TanOp) 00113 UNARYFUNC_MACRO(acos, ACosOp) 00114 UNARYFUNC_MACRO(asin, ASinOp) 00115 UNARYFUNC_MACRO(atan, ATanOp) 00116 UNARYFUNC_MACRO(cosh, CoshOp) 00117 UNARYFUNC_MACRO(sinh, SinhOp) 00118 UNARYFUNC_MACRO(tanh, TanhOp) 00119 UNARYFUNC_MACRO(acosh, ACoshOp) 00120 UNARYFUNC_MACRO(asinh, ASinhOp) 00121 UNARYFUNC_MACRO(atanh, ATanhOp) 00122 UNARYFUNC_MACRO(abs, AbsOp) 00123 UNARYFUNC_MACRO(fabs, FAbsOp) 00124 00125 #undef UNARYFUNC_MACRO 00126 00127 #define BINARYFUNC_MACRO(OP,FADOP) \ 00128 namespace Sacado { \ 00129 \ 00130 namespace Fad { \ 00131 template <typename T1, typename T2> class FADOP; \ 00132 template <typename T> class Expr; \ 00133 \ 00134 template <typename T1, typename T2> \ 00135 Expr< FADOP< Expr<T1>, Expr<T2> > > \ 00136 OP (const Expr<T1>&, const Expr<T2>&); \ 00137 \ 00138 template <typename T> \ 00139 Expr< FADOP< Expr<T>, Expr<T> > > \ 00140 OP (const Expr<T>&, const Expr<T>&); \ 00141 \ 00142 template <typename T> \ 00143 Expr< FADOP< typename Expr<T>::value_type, Expr<T> > > \ 00144 OP (const typename Expr<T>::value_type&, const Expr<T>&); \ 00145 \ 00146 template <typename T> \ 00147 Expr< FADOP< Expr<T>, typename Expr<T>::value_type > > \ 00148 OP (const Expr<T>&, const typename Expr<T>::value_type&); \ 00149 \ 00150 template <typename T> class SimpleFad; \ 00151 template <typename T> \ 00152 SimpleFad<T> \ 00153 OP (const SimpleFad<T>&, const SimpleFad<T>&); \ 00154 \ 00155 template <typename T> \ 00156 SimpleFad<T> \ 00157 OP (const SimpleFad<T>&, \ 00158 const typename SimpleFad<T>::value_type&); \ 00159 \ 00160 template <typename T> \ 00161 SimpleFad<T> \ 00162 OP (const typename SimpleFad<T>::value_type&, \ 00163 const SimpleFad<T>&); \ 00164 } \ 00165 \ 00166 namespace ELRFad { \ 00167 template <typename T1, typename T2> class FADOP; \ 00168 template <typename T> class Expr; \ 00169 template <typename T> class ConstExpr; \ 00170 template <typename T1, typename T2> \ 00171 Expr< FADOP< Expr<T1>, Expr<T2> > > \ 00172 OP (const Expr<T1>&, const Expr<T2>&); \ 00173 \ 00174 template <typename T> \ 00175 Expr< FADOP< Expr<T>, Expr<T> > > \ 00176 OP (const Expr<T>&, const Expr<T>&); \ 00177 \ 00178 template <typename T> \ 00179 Expr< FADOP< ConstExpr<typename Expr<T>::value_type>, Expr<T> > > \ 00180 OP (const typename Expr<T>::value_type&, const Expr<T>&); \ 00181 \ 00182 template <typename T> \ 00183 Expr< FADOP< Expr<T>, ConstExpr<typename Expr<T>::value_type> > > \ 00184 OP (const Expr<T>&, const typename Expr<T>::value_type&); \ 00185 } \ 00186 \ 00187 namespace CacheFad { \ 00188 template <typename T1, typename T2> class FADOP; \ 00189 template <typename T> class Expr; \ 00190 template <typename T> class ConstExpr; \ 00191 template <typename T1, typename T2> \ 00192 Expr< FADOP< Expr<T1>, Expr<T2> > > \ 00193 OP (const Expr<T1>&, const Expr<T2>&); \ 00194 \ 00195 template <typename T> \ 00196 Expr< FADOP< Expr<T>, Expr<T> > > \ 00197 OP (const Expr<T>&, const Expr<T>&); \ 00198 \ 00199 template <typename T> \ 00200 Expr< FADOP< ConstExpr<typename Expr<T>::value_type>, Expr<T> > > \ 00201 OP (const typename Expr<T>::value_type&, const Expr<T>&); \ 00202 \ 00203 template <typename T> \ 00204 Expr< FADOP< Expr<T>, ConstExpr<typename Expr<T>::value_type> > > \ 00205 OP (const Expr<T>&, const typename Expr<T>::value_type&); \ 00206 } \ 00207 \ 00208 namespace ELRCacheFad { \ 00209 template <typename T1, typename T2> class FADOP; \ 00210 template <typename T> class Expr; \ 00211 template <typename T> class ConstExpr; \ 00212 template <typename T1, typename T2> \ 00213 Expr< FADOP< Expr<T1>, Expr<T2> > > \ 00214 OP (const Expr<T1>&, const Expr<T2>&); \ 00215 \ 00216 template <typename T> \ 00217 Expr< FADOP< Expr<T>, Expr<T> > > \ 00218 OP (const Expr<T>&, const Expr<T>&); \ 00219 \ 00220 template <typename T> \ 00221 Expr< FADOP< ConstExpr<typename Expr<T>::value_type>, Expr<T> > > \ 00222 OP (const typename Expr<T>::value_type&, const Expr<T>&); \ 00223 \ 00224 template <typename T> \ 00225 Expr< FADOP< Expr<T>, ConstExpr<typename Expr<T>::value_type> > > \ 00226 OP (const Expr<T>&, const typename Expr<T>::value_type&); \ 00227 } \ 00228 \ 00229 namespace LFad { \ 00230 template <typename T1, typename T2> class FADOP; \ 00231 template <typename T> class Expr; \ 00232 \ 00233 template <typename T1, typename T2> \ 00234 Expr< FADOP< Expr<T1>, Expr<T2> > > \ 00235 OP (const Expr<T1>&, const Expr<T2>&); \ 00236 \ 00237 template <typename T> \ 00238 Expr< FADOP< Expr<T>, Expr<T> > > \ 00239 OP (const Expr<T>&, const Expr<T>&); \ 00240 \ 00241 template <typename T> \ 00242 Expr< FADOP< typename Expr<T>::value_type, Expr<T> > > \ 00243 OP (const typename Expr<T>::value_type&, const Expr<T>&); \ 00244 \ 00245 template <typename T> \ 00246 Expr< FADOP< Expr<T>, typename Expr<T>::value_type > > \ 00247 OP (const Expr<T>&, const typename Expr<T>::value_type&); \ 00248 } \ 00249 \ 00250 namespace Tay { \ 00251 template <typename T> class Taylor; \ 00252 template <typename T> Taylor<T> OP (const Taylor<T>&, \ 00253 const Taylor<T>&); \ 00254 template <typename T> Taylor<T> OP (const T&, \ 00255 const Taylor<T>&); \ 00256 template <typename T> Taylor<T> OP (const Taylor<T>&, \ 00257 const T&); \ 00258 } \ 00259 \ 00260 namespace FlopCounterPack { \ 00261 template <typename T> class ScalarFlopCounter; \ 00262 template <typename T> \ 00263 ScalarFlopCounter<T> OP (const ScalarFlopCounter<T>&, \ 00264 const ScalarFlopCounter<T>&); \ 00265 template <typename T> \ 00266 ScalarFlopCounter<T> OP (const T&, \ 00267 const ScalarFlopCounter<T>); \ 00268 template <typename T> \ 00269 ScalarFlopCounter<T> OP (const ScalarFlopCounter<T>&, \ 00270 const T&); \ 00271 template <typename T> \ 00272 ScalarFlopCounter<T> OP (const int&, \ 00273 const ScalarFlopCounter<T>); \ 00274 template <typename T> \ 00275 ScalarFlopCounter<T> OP (const ScalarFlopCounter<T>&, \ 00276 const int&); \ 00277 } \ 00278 \ 00279 namespace Rad { \ 00280 template <typename T> class ADvari; \ 00281 template <typename T> class IndepADvar; \ 00282 template <typename T> class DoubleAvoid; \ 00283 template <typename T> ADvari<T>& OP (const ADvari<T>&, \ 00284 const ADvari<T>&); \ 00285 template <typename T> ADvari<T>& OP (const IndepADvar<T>&, \ 00286 const ADvari<T>&); \ 00287 template <typename T> ADvari<T>& OP (T, \ 00288 const ADvari<T>&); \ 00289 template <typename T> ADvari<T>& OP (typename DoubleAvoid<T>::dtype, \ 00290 const ADvari<T>&); \ 00291 template <typename T> ADvari<T>& OP (int, \ 00292 const ADvari<T>&); \ 00293 template <typename T> ADvari<T>& OP (long, \ 00294 const ADvari<T>&); \ 00295 template <typename T> ADvari<T>& OP (const ADvari<T>&, \ 00296 const IndepADvar<T>&); \ 00297 template <typename T> ADvari<T>& OP (const ADvari<T>&, \ 00298 T); \ 00299 template <typename T> ADvari<T>& OP (const ADvari<T>&, \ 00300 typename DoubleAvoid<T>::dtype); \ 00301 template <typename T> ADvari<T>& OP (const ADvari<T>&, \ 00302 int); \ 00303 template <typename T> ADvari<T>& OP (const ADvari<T>&, \ 00304 long); \ 00305 template <typename T> ADvari<T>& OP (const IndepADvar<T>&, \ 00306 const IndepADvar<T>&); \ 00307 template <typename T> ADvari<T>& OP (T, \ 00308 const IndepADvar<T>&); \ 00309 template <typename T> ADvari<T>& OP (typename DoubleAvoid<T>::dtype, \ 00310 const IndepADvar<T>&); \ 00311 template <typename T> ADvari<T>& OP (int, \ 00312 const IndepADvar<T>&); \ 00313 template <typename T> ADvari<T>& OP (long, \ 00314 const IndepADvar<T>&); \ 00315 template <typename T> ADvari<T>& OP (const IndepADvar<T>&, \ 00316 T); \ 00317 template <typename T> ADvari<T>& OP (const IndepADvar<T>&, \ 00318 typename DoubleAvoid<T>::dtype); \ 00319 template <typename T> ADvari<T>& OP (const IndepADvar<T>&, \ 00320 int); \ 00321 template <typename T> ADvari<T>& OP (const IndepADvar<T>&, \ 00322 long); \ 00323 } \ 00324 \ 00325 } \ 00326 \ 00327 namespace std { \ 00328 using Sacado::Fad::OP; \ 00329 using Sacado::ELRFad::OP; \ 00330 using Sacado::CacheFad::OP; \ 00331 using Sacado::ELRCacheFad::OP; \ 00332 using Sacado::LFad::OP; \ 00333 using Sacado::Tay::OP; \ 00334 using Sacado::FlopCounterPack::OP; \ 00335 using Sacado::Rad::OP; \ 00336 } 00337 00338 BINARYFUNC_MACRO(atan2, Atan2Op) 00339 BINARYFUNC_MACRO(pow, PowerOp) 00340 BINARYFUNC_MACRO(max, MaxOp) 00341 BINARYFUNC_MACRO(min, MinOp) 00342 00343 #undef BINARYFUNC_MACRO 00344 00345 #endif // SACADO_MATHFUNCTIONS_HPP
1.7.4