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

include/tvmet/xpr/MatrixUnaryFunctions.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: MatrixUnaryFunctions.h,v 1.11 2007-06-23 15:59:00 opetzold Exp $
00022  */
00023 
00024 #ifndef TVMET_XPR_MATRIX_UNARY_FUNCTIONS_H
00025 #define TVMET_XPR_MATRIX_UNARY_FUNCTIONS_H
00026 
00027 namespace tvmet {
00028 
00029 
00030 /*********************************************************
00031  * PART I: DECLARATION
00032  *********************************************************/
00033 
00034 
00035 /*
00036  * unary_function(XprMatrix<E, Rows, Cols>)
00037  */
00038 #define TVMET_DECLARE_MACRO(NAME)         \
00039 template<class E, std::size_t Rows, std::size_t Cols>     \
00040 inline                  \
00041 XprMatrix<                \
00042   XprUnOp<                \
00043     Fcnl_##NAME<typename E::value_type>,        \
00044     XprMatrix<E, Rows, Cols>            \
00045   >,                  \
00046   Rows, Cols                \
00047 >                 \
00048 NAME(const XprMatrix<E, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE;
00049 
00050 TVMET_DECLARE_MACRO(abs)
00051 TVMET_DECLARE_MACRO(cbrt)
00052 TVMET_DECLARE_MACRO(ceil)
00053 TVMET_DECLARE_MACRO(floor)
00054 TVMET_DECLARE_MACRO(rint)
00055 TVMET_DECLARE_MACRO(sin)
00056 TVMET_DECLARE_MACRO(cos)
00057 TVMET_DECLARE_MACRO(tan)
00058 TVMET_DECLARE_MACRO(sinh)
00059 TVMET_DECLARE_MACRO(cosh)
00060 TVMET_DECLARE_MACRO(tanh)
00061 TVMET_DECLARE_MACRO(asin)
00062 TVMET_DECLARE_MACRO(acos)
00063 TVMET_DECLARE_MACRO(atan)
00064 TVMET_DECLARE_MACRO(exp)
00065 TVMET_DECLARE_MACRO(log)
00066 TVMET_DECLARE_MACRO(log10)
00067 TVMET_DECLARE_MACRO(sqrt)
00068 
00069 #if defined(TVMET_HAVE_IEEE_MATH)
00070 TVMET_DECLARE_MACRO(asinh)
00071 TVMET_DECLARE_MACRO(acosh)
00072 TVMET_DECLARE_MACRO(atanh)
00073 TVMET_DECLARE_MACRO(expm1)
00074 TVMET_DECLARE_MACRO(log1p)
00075 TVMET_DECLARE_MACRO(erf)
00076 TVMET_DECLARE_MACRO(erfc)
00077 TVMET_DECLARE_MACRO(j0)
00078 TVMET_DECLARE_MACRO(j1)
00079 TVMET_DECLARE_MACRO(y0)
00080 TVMET_DECLARE_MACRO(y1)
00081 TVMET_DECLARE_MACRO(lgamma)
00083 #if !defined(TVMET_NO_IEEE_MATH_ISNAN)
00084 TVMET_DECLARE_MACRO(isnan)
00085 #endif
00086 #if !defined(TVMET_NO_IEEE_MATH_ISINF)
00087 TVMET_DECLARE_MACRO(isinf)
00088 #endif
00089 TVMET_DECLARE_MACRO(finite)
00090 #endif // defined(TVMET_HAVE_IEEE_MATH)
00091 
00092 #undef TVMET_DECLARE_MACRO
00093 
00094 
00095 /*********************************************************
00096  * PART II: IMPLEMENTATION
00097  *********************************************************/
00098 
00099 
00100 /*
00101  * unary_function(XprMatrix<E, Rows, Cols>)
00102  */
00103 #define TVMET_IMPLEMENT_MACRO(NAME)          \
00104 template<class E, std::size_t Rows, std::size_t Cols>      \
00105 inline                   \
00106 XprMatrix<                 \
00107   XprUnOp<                 \
00108     Fcnl_##NAME<typename E::value_type>,         \
00109     XprMatrix<E, Rows, Cols>             \
00110   >,                   \
00111   Rows, Cols                 \
00112 >                  \
00113 NAME(const XprMatrix<E, Rows, Cols>& rhs) {        \
00114   typedef XprUnOp<               \
00115     Fcnl_##NAME<typename E::value_type>,         \
00116     XprMatrix<E, Rows, Cols>             \
00117   >               expr_type; \
00118   return XprMatrix<expr_type, Rows, Cols>(expr_type(rhs));     \
00119 }
00120 
00121 TVMET_IMPLEMENT_MACRO(abs)
00122 TVMET_IMPLEMENT_MACRO(cbrt)
00123 TVMET_IMPLEMENT_MACRO(ceil)
00124 TVMET_IMPLEMENT_MACRO(floor)
00125 TVMET_IMPLEMENT_MACRO(rint)
00126 TVMET_IMPLEMENT_MACRO(sin)
00127 TVMET_IMPLEMENT_MACRO(cos)
00128 TVMET_IMPLEMENT_MACRO(tan)
00129 TVMET_IMPLEMENT_MACRO(sinh)
00130 TVMET_IMPLEMENT_MACRO(cosh)
00131 TVMET_IMPLEMENT_MACRO(tanh)
00132 TVMET_IMPLEMENT_MACRO(asin)
00133 TVMET_IMPLEMENT_MACRO(acos)
00134 TVMET_IMPLEMENT_MACRO(atan)
00135 TVMET_IMPLEMENT_MACRO(exp)
00136 TVMET_IMPLEMENT_MACRO(log)
00137 TVMET_IMPLEMENT_MACRO(log10)
00138 TVMET_IMPLEMENT_MACRO(sqrt)
00139 
00140 #if defined(TVMET_HAVE_IEEE_MATH)
00141 TVMET_IMPLEMENT_MACRO(asinh)
00142 TVMET_IMPLEMENT_MACRO(acosh)
00143 TVMET_IMPLEMENT_MACRO(atanh)
00144 TVMET_IMPLEMENT_MACRO(expm1)
00145 TVMET_IMPLEMENT_MACRO(log1p)
00146 TVMET_IMPLEMENT_MACRO(erf)
00147 TVMET_IMPLEMENT_MACRO(erfc)
00148 TVMET_IMPLEMENT_MACRO(j0)
00149 TVMET_IMPLEMENT_MACRO(j1)
00150 TVMET_IMPLEMENT_MACRO(y0)
00151 TVMET_IMPLEMENT_MACRO(y1)
00152 TVMET_IMPLEMENT_MACRO(lgamma)
00154 #if !defined(TVMET_NO_IEEE_MATH_ISNAN)
00155 TVMET_IMPLEMENT_MACRO(isnan)
00156 #endif
00157 #if !defined(TVMET_NO_IEEE_MATH_ISINF)
00158 TVMET_IMPLEMENT_MACRO(isinf)
00159 #endif
00160 TVMET_IMPLEMENT_MACRO(finite)
00161 #endif // defined(TVMET_HAVE_IEEE_MATH)
00162 
00163 #undef TVMET_IMPLEMENT_MACRO
00164 
00165 
00166 } // namespace tvmet
00167 
00168 #endif // TVMET_XPR_MATRIX_UNARY_FUNCTIONS_H
00169 
00170 // Local Variables:
00171 // mode:C++
00172 // tab-width:8
00173 // End:

Author: