Eurobot2012_Primary

Dependencies:   mbed Eurobot_2012_Primary

Committer:
narshu
Date:
Wed Oct 17 22:22:47 2012 +0000
Revision:
26:0995f61cb7b8
Parent:
25:143b19c1fb05
Eurobot 2012 Primary;

Who changed what in which revision?

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