2014 Eurobot fork

Dependencies:   mbed-rtos mbed QEI

Committer:
madcowswe
Date:
Sat Apr 06 20:57:54 2013 +0000
Revision:
15:9c5aaeda36dc
Encoders fairly tuned, still has random noise in it

Who changed what in which revision?

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