We are going to win! wohoo

Dependencies:   mbed mbed-rtos

Committer:
sv
Date:
Wed Nov 07 14:37:35 2012 +0000
Revision:
1:6799c07fe510
Preliminary copy of 2012 code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sv 1:6799c07fe510 1 /*
sv 1:6799c07fe510 2 * Tiny Vector Matrix Library
sv 1:6799c07fe510 3 * Dense Vector Matrix Libary of Tiny size using Expression Templates
sv 1:6799c07fe510 4 *
sv 1:6799c07fe510 5 * Copyright (C) 2001 - 2007 Olaf Petzold <opetzold@users.sourceforge.net>
sv 1:6799c07fe510 6 *
sv 1:6799c07fe510 7 * This library is free software; you can redistribute it and/or
sv 1:6799c07fe510 8 * modify it under the terms of the GNU lesser General Public
sv 1:6799c07fe510 9 * License as published by the Free Software Foundation; either
sv 1:6799c07fe510 10 * version 2.1 of the License, or (at your option) any later version.
sv 1:6799c07fe510 11 *
sv 1:6799c07fe510 12 * This library is distributed in the hope that it will be useful,
sv 1:6799c07fe510 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
sv 1:6799c07fe510 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
sv 1:6799c07fe510 15 * lesser General Public License for more details.
sv 1:6799c07fe510 16 *
sv 1:6799c07fe510 17 * You should have received a copy of the GNU lesser General Public
sv 1:6799c07fe510 18 * License along with this library; if not, write to the Free Software
sv 1:6799c07fe510 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
sv 1:6799c07fe510 20 *
sv 1:6799c07fe510 21 * $Id: MatrixUnaryFunctions.h,v 1.11 2007-06-23 15:59:00 opetzold Exp $
sv 1:6799c07fe510 22 */
sv 1:6799c07fe510 23
sv 1:6799c07fe510 24 #ifndef TVMET_XPR_MATRIX_UNARY_FUNCTIONS_H
sv 1:6799c07fe510 25 #define TVMET_XPR_MATRIX_UNARY_FUNCTIONS_H
sv 1:6799c07fe510 26
sv 1:6799c07fe510 27 namespace tvmet {
sv 1:6799c07fe510 28
sv 1:6799c07fe510 29
sv 1:6799c07fe510 30 /*********************************************************
sv 1:6799c07fe510 31 * PART I: DECLARATION
sv 1:6799c07fe510 32 *********************************************************/
sv 1:6799c07fe510 33
sv 1:6799c07fe510 34
sv 1:6799c07fe510 35 /*
sv 1:6799c07fe510 36 * unary_function(XprMatrix<E, Rows, Cols>)
sv 1:6799c07fe510 37 */
sv 1:6799c07fe510 38 #define TVMET_DECLARE_MACRO(NAME) \
sv 1:6799c07fe510 39 template<class E, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 40 inline \
sv 1:6799c07fe510 41 XprMatrix< \
sv 1:6799c07fe510 42 XprUnOp< \
sv 1:6799c07fe510 43 Fcnl_##NAME<typename E::value_type>, \
sv 1:6799c07fe510 44 XprMatrix<E, Rows, Cols> \
sv 1:6799c07fe510 45 >, \
sv 1:6799c07fe510 46 Rows, Cols \
sv 1:6799c07fe510 47 > \
sv 1:6799c07fe510 48 NAME(const XprMatrix<E, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 49
sv 1:6799c07fe510 50 TVMET_DECLARE_MACRO(abs)
sv 1:6799c07fe510 51 TVMET_DECLARE_MACRO(cbrt)
sv 1:6799c07fe510 52 TVMET_DECLARE_MACRO(ceil)
sv 1:6799c07fe510 53 TVMET_DECLARE_MACRO(floor)
sv 1:6799c07fe510 54 TVMET_DECLARE_MACRO(rint)
sv 1:6799c07fe510 55 TVMET_DECLARE_MACRO(sin)
sv 1:6799c07fe510 56 TVMET_DECLARE_MACRO(cos)
sv 1:6799c07fe510 57 TVMET_DECLARE_MACRO(tan)
sv 1:6799c07fe510 58 TVMET_DECLARE_MACRO(sinh)
sv 1:6799c07fe510 59 TVMET_DECLARE_MACRO(cosh)
sv 1:6799c07fe510 60 TVMET_DECLARE_MACRO(tanh)
sv 1:6799c07fe510 61 TVMET_DECLARE_MACRO(asin)
sv 1:6799c07fe510 62 TVMET_DECLARE_MACRO(acos)
sv 1:6799c07fe510 63 TVMET_DECLARE_MACRO(atan)
sv 1:6799c07fe510 64 TVMET_DECLARE_MACRO(exp)
sv 1:6799c07fe510 65 TVMET_DECLARE_MACRO(log)
sv 1:6799c07fe510 66 TVMET_DECLARE_MACRO(log10)
sv 1:6799c07fe510 67 TVMET_DECLARE_MACRO(sqrt)
sv 1:6799c07fe510 68
sv 1:6799c07fe510 69 #if defined(TVMET_HAVE_IEEE_MATH)
sv 1:6799c07fe510 70 TVMET_DECLARE_MACRO(asinh)
sv 1:6799c07fe510 71 TVMET_DECLARE_MACRO(acosh)
sv 1:6799c07fe510 72 TVMET_DECLARE_MACRO(atanh)
sv 1:6799c07fe510 73 TVMET_DECLARE_MACRO(expm1)
sv 1:6799c07fe510 74 TVMET_DECLARE_MACRO(log1p)
sv 1:6799c07fe510 75 TVMET_DECLARE_MACRO(erf)
sv 1:6799c07fe510 76 TVMET_DECLARE_MACRO(erfc)
sv 1:6799c07fe510 77 TVMET_DECLARE_MACRO(j0)
sv 1:6799c07fe510 78 TVMET_DECLARE_MACRO(j1)
sv 1:6799c07fe510 79 TVMET_DECLARE_MACRO(y0)
sv 1:6799c07fe510 80 TVMET_DECLARE_MACRO(y1)
sv 1:6799c07fe510 81 TVMET_DECLARE_MACRO(lgamma)
sv 1:6799c07fe510 82 /** \todo isnan etc. - default return is only an int! */
sv 1:6799c07fe510 83
sv 1:6799c07fe510 84 TVMET_DECLARE_MACRO(finite)
sv 1:6799c07fe510 85 #endif // defined(TVMET_HAVE_IEEE_MATH)
sv 1:6799c07fe510 86
sv 1:6799c07fe510 87 #undef TVMET_DECLARE_MACRO
sv 1:6799c07fe510 88
sv 1:6799c07fe510 89
sv 1:6799c07fe510 90 /*********************************************************
sv 1:6799c07fe510 91 * PART II: IMPLEMENTATION
sv 1:6799c07fe510 92 *********************************************************/
sv 1:6799c07fe510 93
sv 1:6799c07fe510 94
sv 1:6799c07fe510 95 /*
sv 1:6799c07fe510 96 * unary_function(XprMatrix<E, Rows, Cols>)
sv 1:6799c07fe510 97 */
sv 1:6799c07fe510 98 #define TVMET_IMPLEMENT_MACRO(NAME) \
sv 1:6799c07fe510 99 template<class E, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 100 inline \
sv 1:6799c07fe510 101 XprMatrix< \
sv 1:6799c07fe510 102 XprUnOp< \
sv 1:6799c07fe510 103 Fcnl_##NAME<typename E::value_type>, \
sv 1:6799c07fe510 104 XprMatrix<E, Rows, Cols> \
sv 1:6799c07fe510 105 >, \
sv 1:6799c07fe510 106 Rows, Cols \
sv 1:6799c07fe510 107 > \
sv 1:6799c07fe510 108 NAME(const XprMatrix<E, Rows, Cols>& rhs) { \
sv 1:6799c07fe510 109 typedef XprUnOp< \
sv 1:6799c07fe510 110 Fcnl_##NAME<typename E::value_type>, \
sv 1:6799c07fe510 111 XprMatrix<E, Rows, Cols> \
sv 1:6799c07fe510 112 > expr_type; \
sv 1:6799c07fe510 113 return XprMatrix<expr_type, Rows, Cols>(expr_type(rhs)); \
sv 1:6799c07fe510 114 }
sv 1:6799c07fe510 115
sv 1:6799c07fe510 116 TVMET_IMPLEMENT_MACRO(abs)
sv 1:6799c07fe510 117 TVMET_IMPLEMENT_MACRO(cbrt)
sv 1:6799c07fe510 118 TVMET_IMPLEMENT_MACRO(ceil)
sv 1:6799c07fe510 119 TVMET_IMPLEMENT_MACRO(floor)
sv 1:6799c07fe510 120 TVMET_IMPLEMENT_MACRO(rint)
sv 1:6799c07fe510 121 TVMET_IMPLEMENT_MACRO(sin)
sv 1:6799c07fe510 122 TVMET_IMPLEMENT_MACRO(cos)
sv 1:6799c07fe510 123 TVMET_IMPLEMENT_MACRO(tan)
sv 1:6799c07fe510 124 TVMET_IMPLEMENT_MACRO(sinh)
sv 1:6799c07fe510 125 TVMET_IMPLEMENT_MACRO(cosh)
sv 1:6799c07fe510 126 TVMET_IMPLEMENT_MACRO(tanh)
sv 1:6799c07fe510 127 TVMET_IMPLEMENT_MACRO(asin)
sv 1:6799c07fe510 128 TVMET_IMPLEMENT_MACRO(acos)
sv 1:6799c07fe510 129 TVMET_IMPLEMENT_MACRO(atan)
sv 1:6799c07fe510 130 TVMET_IMPLEMENT_MACRO(exp)
sv 1:6799c07fe510 131 TVMET_IMPLEMENT_MACRO(log)
sv 1:6799c07fe510 132 TVMET_IMPLEMENT_MACRO(log10)
sv 1:6799c07fe510 133 TVMET_IMPLEMENT_MACRO(sqrt)
sv 1:6799c07fe510 134
sv 1:6799c07fe510 135 #if defined(TVMET_HAVE_IEEE_MATH)
sv 1:6799c07fe510 136 TVMET_IMPLEMENT_MACRO(asinh)
sv 1:6799c07fe510 137 TVMET_IMPLEMENT_MACRO(acosh)
sv 1:6799c07fe510 138 TVMET_IMPLEMENT_MACRO(atanh)
sv 1:6799c07fe510 139 TVMET_IMPLEMENT_MACRO(expm1)
sv 1:6799c07fe510 140 TVMET_IMPLEMENT_MACRO(log1p)
sv 1:6799c07fe510 141 TVMET_IMPLEMENT_MACRO(erf)
sv 1:6799c07fe510 142 TVMET_IMPLEMENT_MACRO(erfc)
sv 1:6799c07fe510 143 TVMET_IMPLEMENT_MACRO(j0)
sv 1:6799c07fe510 144 TVMET_IMPLEMENT_MACRO(j1)
sv 1:6799c07fe510 145 TVMET_IMPLEMENT_MACRO(y0)
sv 1:6799c07fe510 146 TVMET_IMPLEMENT_MACRO(y1)
sv 1:6799c07fe510 147 TVMET_IMPLEMENT_MACRO(lgamma)
sv 1:6799c07fe510 148 /** \todo isnan etc. - default return is only an int! */
sv 1:6799c07fe510 149
sv 1:6799c07fe510 150 TVMET_IMPLEMENT_MACRO(finite)
sv 1:6799c07fe510 151 #endif // defined(TVMET_HAVE_IEEE_MATH)
sv 1:6799c07fe510 152
sv 1:6799c07fe510 153 #undef TVMET_IMPLEMENT_MACRO
sv 1:6799c07fe510 154
sv 1:6799c07fe510 155
sv 1:6799c07fe510 156 } // namespace tvmet
sv 1:6799c07fe510 157
sv 1:6799c07fe510 158 #endif // TVMET_XPR_MATRIX_UNARY_FUNCTIONS_H
sv 1:6799c07fe510 159
sv 1:6799c07fe510 160 // Local Variables:
sv 1:6799c07fe510 161 // mode:C++
sv 1:6799c07fe510 162 // tab-width:8
sv 1:6799c07fe510 163 // End: