SourceForge Logo Tiny Vector Matrix library using Expression Templates Sourceforge Project Page

include/tvmet/xpr/VectorUnaryFunctions.h

Go to the documentation of this file.
00001 /*
00002  * Tiny Vector Matrix Library
00003  * Dense Vector Matrix Libary of Tiny size using Expression Templates
00004  *
00005  * Copyright (C) 2001 - 2007 Olaf Petzold <opetzold@users.sourceforge.net>
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  * $Id: VectorUnaryFunctions.h,v 1.11 2007-06-23 15:59:00 opetzold Exp $
00022  */
00023 
00024 #ifndef TVMET_XPR_VECTOR_UNARY_FUNCTIONS_H
00025 #define TVMET_XPR_VECTOR_UNARY_FUNCTIONS_H
00026 
00027 namespace tvmet {
00028 
00029 
00030 /*********************************************************
00031  * PART I: DECLARATION
00032  *********************************************************/
00033 
00034 /*
00035  * unary_function(XprVector<E, Sz>)
00036  */
00037 #define TVMET_DECLARE_MACRO(NAME)       \
00038 template<class E, std::size_t Sz>       \
00039 inline                \
00040 XprVector<              \
00041   XprUnOp<              \
00042     Fcnl_##NAME<typename E::value_type>,      \
00043     XprVector<E, Sz>            \
00044   >,                \
00045   Sz                \
00046 >               \
00047 NAME(const XprVector<E, Sz>& rhs) TVMET_CXX_ALWAYS_INLINE;
00048 
00049 TVMET_DECLARE_MACRO(abs)
00050 TVMET_DECLARE_MACRO(cbrt)
00051 TVMET_DECLARE_MACRO(ceil)
00052 TVMET_DECLARE_MACRO(floor)
00053 TVMET_DECLARE_MACRO(rint)
00054 TVMET_DECLARE_MACRO(sin)
00055 TVMET_DECLARE_MACRO(cos)
00056 TVMET_DECLARE_MACRO(tan)
00057 TVMET_DECLARE_MACRO(sinh)
00058 TVMET_DECLARE_MACRO(cosh)
00059 TVMET_DECLARE_MACRO(tanh)
00060 TVMET_DECLARE_MACRO(asin)
00061 TVMET_DECLARE_MACRO(acos)
00062 TVMET_DECLARE_MACRO(atan)
00063 TVMET_DECLARE_MACRO(exp)
00064 TVMET_DECLARE_MACRO(log)
00065 TVMET_DECLARE_MACRO(log10)
00066 TVMET_DECLARE_MACRO(sqrt)
00067 
00068 #if defined(TVMET_HAVE_IEEE_MATH)
00069 TVMET_DECLARE_MACRO(asinh)
00070 TVMET_DECLARE_MACRO(acosh)
00071 TVMET_DECLARE_MACRO(atanh)
00072 TVMET_DECLARE_MACRO(expm1)
00073 TVMET_DECLARE_MACRO(log1p)
00074 TVMET_DECLARE_MACRO(erf)
00075 TVMET_DECLARE_MACRO(erfc)
00076 TVMET_DECLARE_MACRO(j0)
00077 TVMET_DECLARE_MACRO(j1)
00078 TVMET_DECLARE_MACRO(y0)
00079 TVMET_DECLARE_MACRO(y1)
00080 TVMET_DECLARE_MACRO(lgamma)
00082 #if !defined(TVMET_NO_IEEE_MATH_ISNAN)
00083 TVMET_DECLARE_MACRO(isnan)
00084 #endif
00085 #if !defined(TVMET_NO_IEEE_MATH_ISINF)
00086 TVMET_DECLARE_MACRO(isinf)
00087 #endif
00088 TVMET_DECLARE_MACRO(finite)
00089 #endif // defined(TVMET_HAVE_IEEE_MATH)
00090 
00091 #undef TVMET_DECLARE_MACRO
00092 
00093 
00094 /*********************************************************
00095  * PART II: IMPLEMENTATION
00096  *********************************************************/
00097 
00098 
00099 /*
00100  * unary_function(XprVector<E, Sz>)
00101  */
00102 #define TVMET_IMPLEMENT_MACRO(NAME)         \
00103 template<class E, std::size_t Sz>         \
00104 inline                  \
00105 XprVector<                \
00106   XprUnOp<                \
00107     Fcnl_##NAME<typename E::value_type>,        \
00108     XprVector<E, Sz>              \
00109   >,                  \
00110   Sz                  \
00111 >                 \
00112 NAME(const XprVector<E, Sz>& rhs) {         \
00113   typedef XprUnOp<              \
00114     Fcnl_##NAME<typename E::value_type>,        \
00115     XprVector<E, Sz>              \
00116   >               expr_type;  \
00117   return XprVector<expr_type, Sz>(expr_type(rhs));      \
00118 }
00119 
00120 TVMET_IMPLEMENT_MACRO(abs)
00121 TVMET_IMPLEMENT_MACRO(cbrt)
00122 TVMET_IMPLEMENT_MACRO(ceil)
00123 TVMET_IMPLEMENT_MACRO(floor)
00124 TVMET_IMPLEMENT_MACRO(rint)
00125 TVMET_IMPLEMENT_MACRO(sin)
00126 TVMET_IMPLEMENT_MACRO(cos)
00127 TVMET_IMPLEMENT_MACRO(tan)
00128 TVMET_IMPLEMENT_MACRO(sinh)
00129 TVMET_IMPLEMENT_MACRO(cosh)
00130 TVMET_IMPLEMENT_MACRO(tanh)
00131 TVMET_IMPLEMENT_MACRO(asin)
00132 TVMET_IMPLEMENT_MACRO(acos)
00133 TVMET_IMPLEMENT_MACRO(atan)
00134 TVMET_IMPLEMENT_MACRO(exp)
00135 TVMET_IMPLEMENT_MACRO(log)
00136 TVMET_IMPLEMENT_MACRO(log10)
00137 TVMET_IMPLEMENT_MACRO(sqrt)
00138 
00139 #if defined(TVMET_HAVE_IEEE_MATH)
00140 TVMET_IMPLEMENT_MACRO(asinh)
00141 TVMET_IMPLEMENT_MACRO(acosh)
00142 TVMET_IMPLEMENT_MACRO(atanh)
00143 TVMET_IMPLEMENT_MACRO(expm1)
00144 TVMET_IMPLEMENT_MACRO(log1p)
00145 TVMET_IMPLEMENT_MACRO(erf)
00146 TVMET_IMPLEMENT_MACRO(erfc)
00147 TVMET_IMPLEMENT_MACRO(j0)
00148 TVMET_IMPLEMENT_MACRO(j1)
00149 TVMET_IMPLEMENT_MACRO(y0)
00150 TVMET_IMPLEMENT_MACRO(y1)
00151 TVMET_IMPLEMENT_MACRO(lgamma)
00153 #if !defined(TVMET_NO_IEEE_MATH_ISNAN)
00154 TVMET_IMPLEMENT_MACRO(isnan)
00155 #endif
00156 #if !defined(TVMET_NO_IEEE_MATH_ISINF)
00157 TVMET_IMPLEMENT_MACRO(isinf)
00158 #endif
00159 TVMET_IMPLEMENT_MACRO(finite)
00160 #endif // defined(TVMET_HAVE_IEEE_MATH)
00161 
00162 #undef TVMET_IMPLEMENT_MACRO
00163 
00164 
00165 
00166 } // namespace tvmet
00167 
00168 #endif // TVMET_XPR_VECTOR_FUNCTIONS_H
00169 
00170 // Local Variables:
00171 // mode:C++
00172 // tab-width:8
00173 // End:

Author: