Cooper Liu
/
Eurobot2013_Co-Processor
working version with calibration done
Fork of Eurobot2013 by
tvmet/xpr/VectorUnaryFunctions.h@1:6799c07fe510, 2012-11-07 (annotated)
- 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?
User | Revision | Line number | New 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: VectorUnaryFunctions.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_VECTOR_UNARY_FUNCTIONS_H |
sv | 1:6799c07fe510 | 25 | #define TVMET_XPR_VECTOR_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 | * unary_function(XprVector<E, Sz>) |
sv | 1:6799c07fe510 | 36 | */ |
sv | 1:6799c07fe510 | 37 | #define TVMET_DECLARE_MACRO(NAME) \ |
sv | 1:6799c07fe510 | 38 | template<class E, std::size_t Sz> \ |
sv | 1:6799c07fe510 | 39 | inline \ |
sv | 1:6799c07fe510 | 40 | XprVector< \ |
sv | 1:6799c07fe510 | 41 | XprUnOp< \ |
sv | 1:6799c07fe510 | 42 | Fcnl_##NAME<typename E::value_type>, \ |
sv | 1:6799c07fe510 | 43 | XprVector<E, Sz> \ |
sv | 1:6799c07fe510 | 44 | >, \ |
sv | 1:6799c07fe510 | 45 | Sz \ |
sv | 1:6799c07fe510 | 46 | > \ |
sv | 1:6799c07fe510 | 47 | NAME(const XprVector<E, Sz>& rhs) TVMET_CXX_ALWAYS_INLINE; |
sv | 1:6799c07fe510 | 48 | |
sv | 1:6799c07fe510 | 49 | TVMET_DECLARE_MACRO(abs) |
sv | 1:6799c07fe510 | 50 | TVMET_DECLARE_MACRO(cbrt) |
sv | 1:6799c07fe510 | 51 | TVMET_DECLARE_MACRO(ceil) |
sv | 1:6799c07fe510 | 52 | TVMET_DECLARE_MACRO(floor) |
sv | 1:6799c07fe510 | 53 | TVMET_DECLARE_MACRO(rint) |
sv | 1:6799c07fe510 | 54 | TVMET_DECLARE_MACRO(sin) |
sv | 1:6799c07fe510 | 55 | TVMET_DECLARE_MACRO(cos) |
sv | 1:6799c07fe510 | 56 | TVMET_DECLARE_MACRO(tan) |
sv | 1:6799c07fe510 | 57 | TVMET_DECLARE_MACRO(sinh) |
sv | 1:6799c07fe510 | 58 | TVMET_DECLARE_MACRO(cosh) |
sv | 1:6799c07fe510 | 59 | TVMET_DECLARE_MACRO(tanh) |
sv | 1:6799c07fe510 | 60 | TVMET_DECLARE_MACRO(asin) |
sv | 1:6799c07fe510 | 61 | TVMET_DECLARE_MACRO(acos) |
sv | 1:6799c07fe510 | 62 | TVMET_DECLARE_MACRO(atan) |
sv | 1:6799c07fe510 | 63 | TVMET_DECLARE_MACRO(exp) |
sv | 1:6799c07fe510 | 64 | TVMET_DECLARE_MACRO(log) |
sv | 1:6799c07fe510 | 65 | TVMET_DECLARE_MACRO(log10) |
sv | 1:6799c07fe510 | 66 | TVMET_DECLARE_MACRO(sqrt) |
sv | 1:6799c07fe510 | 67 | |
sv | 1:6799c07fe510 | 68 | #if defined(TVMET_HAVE_IEEE_MATH) |
sv | 1:6799c07fe510 | 69 | TVMET_DECLARE_MACRO(asinh) |
sv | 1:6799c07fe510 | 70 | TVMET_DECLARE_MACRO(acosh) |
sv | 1:6799c07fe510 | 71 | TVMET_DECLARE_MACRO(atanh) |
sv | 1:6799c07fe510 | 72 | TVMET_DECLARE_MACRO(expm1) |
sv | 1:6799c07fe510 | 73 | TVMET_DECLARE_MACRO(log1p) |
sv | 1:6799c07fe510 | 74 | TVMET_DECLARE_MACRO(erf) |
sv | 1:6799c07fe510 | 75 | TVMET_DECLARE_MACRO(erfc) |
sv | 1:6799c07fe510 | 76 | TVMET_DECLARE_MACRO(j0) |
sv | 1:6799c07fe510 | 77 | TVMET_DECLARE_MACRO(j1) |
sv | 1:6799c07fe510 | 78 | TVMET_DECLARE_MACRO(y0) |
sv | 1:6799c07fe510 | 79 | TVMET_DECLARE_MACRO(y1) |
sv | 1:6799c07fe510 | 80 | TVMET_DECLARE_MACRO(lgamma) |
sv | 1:6799c07fe510 | 81 | /** \todo isnan etc. - default return is only an int! */ |
sv | 1:6799c07fe510 | 82 | |
sv | 1:6799c07fe510 | 83 | TVMET_DECLARE_MACRO(finite) |
sv | 1:6799c07fe510 | 84 | #endif // defined(TVMET_HAVE_IEEE_MATH) |
sv | 1:6799c07fe510 | 85 | |
sv | 1:6799c07fe510 | 86 | #undef TVMET_DECLARE_MACRO |
sv | 1:6799c07fe510 | 87 | |
sv | 1:6799c07fe510 | 88 | |
sv | 1:6799c07fe510 | 89 | /********************************************************* |
sv | 1:6799c07fe510 | 90 | * PART II: IMPLEMENTATION |
sv | 1:6799c07fe510 | 91 | *********************************************************/ |
sv | 1:6799c07fe510 | 92 | |
sv | 1:6799c07fe510 | 93 | |
sv | 1:6799c07fe510 | 94 | /* |
sv | 1:6799c07fe510 | 95 | * unary_function(XprVector<E, Sz>) |
sv | 1:6799c07fe510 | 96 | */ |
sv | 1:6799c07fe510 | 97 | #define TVMET_IMPLEMENT_MACRO(NAME) \ |
sv | 1:6799c07fe510 | 98 | template<class E, std::size_t Sz> \ |
sv | 1:6799c07fe510 | 99 | inline \ |
sv | 1:6799c07fe510 | 100 | XprVector< \ |
sv | 1:6799c07fe510 | 101 | XprUnOp< \ |
sv | 1:6799c07fe510 | 102 | Fcnl_##NAME<typename E::value_type>, \ |
sv | 1:6799c07fe510 | 103 | XprVector<E, Sz> \ |
sv | 1:6799c07fe510 | 104 | >, \ |
sv | 1:6799c07fe510 | 105 | Sz \ |
sv | 1:6799c07fe510 | 106 | > \ |
sv | 1:6799c07fe510 | 107 | NAME(const XprVector<E, Sz>& rhs) { \ |
sv | 1:6799c07fe510 | 108 | typedef XprUnOp< \ |
sv | 1:6799c07fe510 | 109 | Fcnl_##NAME<typename E::value_type>, \ |
sv | 1:6799c07fe510 | 110 | XprVector<E, Sz> \ |
sv | 1:6799c07fe510 | 111 | > expr_type; \ |
sv | 1:6799c07fe510 | 112 | return XprVector<expr_type, Sz>(expr_type(rhs)); \ |
sv | 1:6799c07fe510 | 113 | } |
sv | 1:6799c07fe510 | 114 | |
sv | 1:6799c07fe510 | 115 | TVMET_IMPLEMENT_MACRO(abs) |
sv | 1:6799c07fe510 | 116 | TVMET_IMPLEMENT_MACRO(cbrt) |
sv | 1:6799c07fe510 | 117 | TVMET_IMPLEMENT_MACRO(ceil) |
sv | 1:6799c07fe510 | 118 | TVMET_IMPLEMENT_MACRO(floor) |
sv | 1:6799c07fe510 | 119 | TVMET_IMPLEMENT_MACRO(rint) |
sv | 1:6799c07fe510 | 120 | TVMET_IMPLEMENT_MACRO(sin) |
sv | 1:6799c07fe510 | 121 | TVMET_IMPLEMENT_MACRO(cos) |
sv | 1:6799c07fe510 | 122 | TVMET_IMPLEMENT_MACRO(tan) |
sv | 1:6799c07fe510 | 123 | TVMET_IMPLEMENT_MACRO(sinh) |
sv | 1:6799c07fe510 | 124 | TVMET_IMPLEMENT_MACRO(cosh) |
sv | 1:6799c07fe510 | 125 | TVMET_IMPLEMENT_MACRO(tanh) |
sv | 1:6799c07fe510 | 126 | TVMET_IMPLEMENT_MACRO(asin) |
sv | 1:6799c07fe510 | 127 | TVMET_IMPLEMENT_MACRO(acos) |
sv | 1:6799c07fe510 | 128 | TVMET_IMPLEMENT_MACRO(atan) |
sv | 1:6799c07fe510 | 129 | TVMET_IMPLEMENT_MACRO(exp) |
sv | 1:6799c07fe510 | 130 | TVMET_IMPLEMENT_MACRO(log) |
sv | 1:6799c07fe510 | 131 | TVMET_IMPLEMENT_MACRO(log10) |
sv | 1:6799c07fe510 | 132 | TVMET_IMPLEMENT_MACRO(sqrt) |
sv | 1:6799c07fe510 | 133 | |
sv | 1:6799c07fe510 | 134 | #if defined(TVMET_HAVE_IEEE_MATH) |
sv | 1:6799c07fe510 | 135 | TVMET_IMPLEMENT_MACRO(asinh) |
sv | 1:6799c07fe510 | 136 | TVMET_IMPLEMENT_MACRO(acosh) |
sv | 1:6799c07fe510 | 137 | TVMET_IMPLEMENT_MACRO(atanh) |
sv | 1:6799c07fe510 | 138 | TVMET_IMPLEMENT_MACRO(expm1) |
sv | 1:6799c07fe510 | 139 | TVMET_IMPLEMENT_MACRO(log1p) |
sv | 1:6799c07fe510 | 140 | TVMET_IMPLEMENT_MACRO(erf) |
sv | 1:6799c07fe510 | 141 | TVMET_IMPLEMENT_MACRO(erfc) |
sv | 1:6799c07fe510 | 142 | TVMET_IMPLEMENT_MACRO(j0) |
sv | 1:6799c07fe510 | 143 | TVMET_IMPLEMENT_MACRO(j1) |
sv | 1:6799c07fe510 | 144 | TVMET_IMPLEMENT_MACRO(y0) |
sv | 1:6799c07fe510 | 145 | TVMET_IMPLEMENT_MACRO(y1) |
sv | 1:6799c07fe510 | 146 | TVMET_IMPLEMENT_MACRO(lgamma) |
sv | 1:6799c07fe510 | 147 | /** \todo isnan etc. - default return is only an int! */ |
sv | 1:6799c07fe510 | 148 | |
sv | 1:6799c07fe510 | 149 | TVMET_IMPLEMENT_MACRO(finite) |
sv | 1:6799c07fe510 | 150 | #endif // defined(TVMET_HAVE_IEEE_MATH) |
sv | 1:6799c07fe510 | 151 | |
sv | 1:6799c07fe510 | 152 | #undef TVMET_IMPLEMENT_MACRO |
sv | 1:6799c07fe510 | 153 | |
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_VECTOR_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: |