![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
This is some awesome robot code
Dependencies: mbed-rtos mbed QEI
Fork of ICRSEurobot13 by
tvmet/xpr/MatrixUnaryFunctions.h@90:e4164bb8c60e, 2013-04-17 (annotated)
- Committer:
- madcowswe
- Date:
- Wed Apr 17 23:16:25 2013 +0000
- Revision:
- 90:e4164bb8c60e
- Parent:
- 15:9c5aaeda36dc
final state at end of competition. Includes avoid wooden team hack
Who changed what in which revision?
User | Revision | Line number | New 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: MatrixUnaryFunctions.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_MATRIX_UNARY_FUNCTIONS_H |
madcowswe | 15:9c5aaeda36dc | 25 | #define TVMET_XPR_MATRIX_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 | /* |
madcowswe | 15:9c5aaeda36dc | 36 | * unary_function(XprMatrix<E, Rows, Cols>) |
madcowswe | 15:9c5aaeda36dc | 37 | */ |
madcowswe | 15:9c5aaeda36dc | 38 | #define TVMET_DECLARE_MACRO(NAME) \ |
madcowswe | 15:9c5aaeda36dc | 39 | template<class E, std::size_t Rows, std::size_t Cols> \ |
madcowswe | 15:9c5aaeda36dc | 40 | inline \ |
madcowswe | 15:9c5aaeda36dc | 41 | XprMatrix< \ |
madcowswe | 15:9c5aaeda36dc | 42 | XprUnOp< \ |
madcowswe | 15:9c5aaeda36dc | 43 | Fcnl_##NAME<typename E::value_type>, \ |
madcowswe | 15:9c5aaeda36dc | 44 | XprMatrix<E, Rows, Cols> \ |
madcowswe | 15:9c5aaeda36dc | 45 | >, \ |
madcowswe | 15:9c5aaeda36dc | 46 | Rows, Cols \ |
madcowswe | 15:9c5aaeda36dc | 47 | > \ |
madcowswe | 15:9c5aaeda36dc | 48 | NAME(const XprMatrix<E, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE; |
madcowswe | 15:9c5aaeda36dc | 49 | |
madcowswe | 15:9c5aaeda36dc | 50 | TVMET_DECLARE_MACRO(abs) |
madcowswe | 15:9c5aaeda36dc | 51 | TVMET_DECLARE_MACRO(cbrt) |
madcowswe | 15:9c5aaeda36dc | 52 | TVMET_DECLARE_MACRO(ceil) |
madcowswe | 15:9c5aaeda36dc | 53 | TVMET_DECLARE_MACRO(floor) |
madcowswe | 15:9c5aaeda36dc | 54 | TVMET_DECLARE_MACRO(rint) |
madcowswe | 15:9c5aaeda36dc | 55 | TVMET_DECLARE_MACRO(sin) |
madcowswe | 15:9c5aaeda36dc | 56 | TVMET_DECLARE_MACRO(cos) |
madcowswe | 15:9c5aaeda36dc | 57 | TVMET_DECLARE_MACRO(tan) |
madcowswe | 15:9c5aaeda36dc | 58 | TVMET_DECLARE_MACRO(sinh) |
madcowswe | 15:9c5aaeda36dc | 59 | TVMET_DECLARE_MACRO(cosh) |
madcowswe | 15:9c5aaeda36dc | 60 | TVMET_DECLARE_MACRO(tanh) |
madcowswe | 15:9c5aaeda36dc | 61 | TVMET_DECLARE_MACRO(asin) |
madcowswe | 15:9c5aaeda36dc | 62 | TVMET_DECLARE_MACRO(acos) |
madcowswe | 15:9c5aaeda36dc | 63 | TVMET_DECLARE_MACRO(atan) |
madcowswe | 15:9c5aaeda36dc | 64 | TVMET_DECLARE_MACRO(exp) |
madcowswe | 15:9c5aaeda36dc | 65 | TVMET_DECLARE_MACRO(log) |
madcowswe | 15:9c5aaeda36dc | 66 | TVMET_DECLARE_MACRO(log10) |
madcowswe | 15:9c5aaeda36dc | 67 | TVMET_DECLARE_MACRO(sqrt) |
madcowswe | 15:9c5aaeda36dc | 68 | |
madcowswe | 15:9c5aaeda36dc | 69 | #if defined(TVMET_HAVE_IEEE_MATH) |
madcowswe | 15:9c5aaeda36dc | 70 | TVMET_DECLARE_MACRO(asinh) |
madcowswe | 15:9c5aaeda36dc | 71 | TVMET_DECLARE_MACRO(acosh) |
madcowswe | 15:9c5aaeda36dc | 72 | TVMET_DECLARE_MACRO(atanh) |
madcowswe | 15:9c5aaeda36dc | 73 | TVMET_DECLARE_MACRO(expm1) |
madcowswe | 15:9c5aaeda36dc | 74 | TVMET_DECLARE_MACRO(log1p) |
madcowswe | 15:9c5aaeda36dc | 75 | TVMET_DECLARE_MACRO(erf) |
madcowswe | 15:9c5aaeda36dc | 76 | TVMET_DECLARE_MACRO(erfc) |
madcowswe | 15:9c5aaeda36dc | 77 | TVMET_DECLARE_MACRO(j0) |
madcowswe | 15:9c5aaeda36dc | 78 | TVMET_DECLARE_MACRO(j1) |
madcowswe | 15:9c5aaeda36dc | 79 | TVMET_DECLARE_MACRO(y0) |
madcowswe | 15:9c5aaeda36dc | 80 | TVMET_DECLARE_MACRO(y1) |
madcowswe | 15:9c5aaeda36dc | 81 | TVMET_DECLARE_MACRO(lgamma) |
madcowswe | 15:9c5aaeda36dc | 82 | /** \todo isnan etc. - default return is only an int! */ |
madcowswe | 15:9c5aaeda36dc | 83 | |
madcowswe | 15:9c5aaeda36dc | 84 | TVMET_DECLARE_MACRO(finite) |
madcowswe | 15:9c5aaeda36dc | 85 | #endif // defined(TVMET_HAVE_IEEE_MATH) |
madcowswe | 15:9c5aaeda36dc | 86 | |
madcowswe | 15:9c5aaeda36dc | 87 | #undef TVMET_DECLARE_MACRO |
madcowswe | 15:9c5aaeda36dc | 88 | |
madcowswe | 15:9c5aaeda36dc | 89 | |
madcowswe | 15:9c5aaeda36dc | 90 | /********************************************************* |
madcowswe | 15:9c5aaeda36dc | 91 | * PART II: IMPLEMENTATION |
madcowswe | 15:9c5aaeda36dc | 92 | *********************************************************/ |
madcowswe | 15:9c5aaeda36dc | 93 | |
madcowswe | 15:9c5aaeda36dc | 94 | |
madcowswe | 15:9c5aaeda36dc | 95 | /* |
madcowswe | 15:9c5aaeda36dc | 96 | * unary_function(XprMatrix<E, Rows, Cols>) |
madcowswe | 15:9c5aaeda36dc | 97 | */ |
madcowswe | 15:9c5aaeda36dc | 98 | #define TVMET_IMPLEMENT_MACRO(NAME) \ |
madcowswe | 15:9c5aaeda36dc | 99 | template<class E, std::size_t Rows, std::size_t Cols> \ |
madcowswe | 15:9c5aaeda36dc | 100 | inline \ |
madcowswe | 15:9c5aaeda36dc | 101 | XprMatrix< \ |
madcowswe | 15:9c5aaeda36dc | 102 | XprUnOp< \ |
madcowswe | 15:9c5aaeda36dc | 103 | Fcnl_##NAME<typename E::value_type>, \ |
madcowswe | 15:9c5aaeda36dc | 104 | XprMatrix<E, Rows, Cols> \ |
madcowswe | 15:9c5aaeda36dc | 105 | >, \ |
madcowswe | 15:9c5aaeda36dc | 106 | Rows, Cols \ |
madcowswe | 15:9c5aaeda36dc | 107 | > \ |
madcowswe | 15:9c5aaeda36dc | 108 | NAME(const XprMatrix<E, Rows, Cols>& rhs) { \ |
madcowswe | 15:9c5aaeda36dc | 109 | typedef XprUnOp< \ |
madcowswe | 15:9c5aaeda36dc | 110 | Fcnl_##NAME<typename E::value_type>, \ |
madcowswe | 15:9c5aaeda36dc | 111 | XprMatrix<E, Rows, Cols> \ |
madcowswe | 15:9c5aaeda36dc | 112 | > expr_type; \ |
madcowswe | 15:9c5aaeda36dc | 113 | return XprMatrix<expr_type, Rows, Cols>(expr_type(rhs)); \ |
madcowswe | 15:9c5aaeda36dc | 114 | } |
madcowswe | 15:9c5aaeda36dc | 115 | |
madcowswe | 15:9c5aaeda36dc | 116 | TVMET_IMPLEMENT_MACRO(abs) |
madcowswe | 15:9c5aaeda36dc | 117 | TVMET_IMPLEMENT_MACRO(cbrt) |
madcowswe | 15:9c5aaeda36dc | 118 | TVMET_IMPLEMENT_MACRO(ceil) |
madcowswe | 15:9c5aaeda36dc | 119 | TVMET_IMPLEMENT_MACRO(floor) |
madcowswe | 15:9c5aaeda36dc | 120 | TVMET_IMPLEMENT_MACRO(rint) |
madcowswe | 15:9c5aaeda36dc | 121 | TVMET_IMPLEMENT_MACRO(sin) |
madcowswe | 15:9c5aaeda36dc | 122 | TVMET_IMPLEMENT_MACRO(cos) |
madcowswe | 15:9c5aaeda36dc | 123 | TVMET_IMPLEMENT_MACRO(tan) |
madcowswe | 15:9c5aaeda36dc | 124 | TVMET_IMPLEMENT_MACRO(sinh) |
madcowswe | 15:9c5aaeda36dc | 125 | TVMET_IMPLEMENT_MACRO(cosh) |
madcowswe | 15:9c5aaeda36dc | 126 | TVMET_IMPLEMENT_MACRO(tanh) |
madcowswe | 15:9c5aaeda36dc | 127 | TVMET_IMPLEMENT_MACRO(asin) |
madcowswe | 15:9c5aaeda36dc | 128 | TVMET_IMPLEMENT_MACRO(acos) |
madcowswe | 15:9c5aaeda36dc | 129 | TVMET_IMPLEMENT_MACRO(atan) |
madcowswe | 15:9c5aaeda36dc | 130 | TVMET_IMPLEMENT_MACRO(exp) |
madcowswe | 15:9c5aaeda36dc | 131 | TVMET_IMPLEMENT_MACRO(log) |
madcowswe | 15:9c5aaeda36dc | 132 | TVMET_IMPLEMENT_MACRO(log10) |
madcowswe | 15:9c5aaeda36dc | 133 | TVMET_IMPLEMENT_MACRO(sqrt) |
madcowswe | 15:9c5aaeda36dc | 134 | |
madcowswe | 15:9c5aaeda36dc | 135 | #if defined(TVMET_HAVE_IEEE_MATH) |
madcowswe | 15:9c5aaeda36dc | 136 | TVMET_IMPLEMENT_MACRO(asinh) |
madcowswe | 15:9c5aaeda36dc | 137 | TVMET_IMPLEMENT_MACRO(acosh) |
madcowswe | 15:9c5aaeda36dc | 138 | TVMET_IMPLEMENT_MACRO(atanh) |
madcowswe | 15:9c5aaeda36dc | 139 | TVMET_IMPLEMENT_MACRO(expm1) |
madcowswe | 15:9c5aaeda36dc | 140 | TVMET_IMPLEMENT_MACRO(log1p) |
madcowswe | 15:9c5aaeda36dc | 141 | TVMET_IMPLEMENT_MACRO(erf) |
madcowswe | 15:9c5aaeda36dc | 142 | TVMET_IMPLEMENT_MACRO(erfc) |
madcowswe | 15:9c5aaeda36dc | 143 | TVMET_IMPLEMENT_MACRO(j0) |
madcowswe | 15:9c5aaeda36dc | 144 | TVMET_IMPLEMENT_MACRO(j1) |
madcowswe | 15:9c5aaeda36dc | 145 | TVMET_IMPLEMENT_MACRO(y0) |
madcowswe | 15:9c5aaeda36dc | 146 | TVMET_IMPLEMENT_MACRO(y1) |
madcowswe | 15:9c5aaeda36dc | 147 | TVMET_IMPLEMENT_MACRO(lgamma) |
madcowswe | 15:9c5aaeda36dc | 148 | /** \todo isnan etc. - default return is only an int! */ |
madcowswe | 15:9c5aaeda36dc | 149 | |
madcowswe | 15:9c5aaeda36dc | 150 | TVMET_IMPLEMENT_MACRO(finite) |
madcowswe | 15:9c5aaeda36dc | 151 | #endif // defined(TVMET_HAVE_IEEE_MATH) |
madcowswe | 15:9c5aaeda36dc | 152 | |
madcowswe | 15:9c5aaeda36dc | 153 | #undef TVMET_IMPLEMENT_MACRO |
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_MATRIX_UNARY_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: |