This is some awesome robot code
Dependencies: mbed-rtos mbed QEI
Fork of ICRSEurobot13 by
tvmet/xpr/VectorBinaryFunctions.h@15:9c5aaeda36dc, 2013-04-06 (annotated)
- 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?
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: VectorBinaryFunctions.h,v 1.12 2007-06-23 15:59:00 opetzold Exp $ |
madcowswe | 15:9c5aaeda36dc | 22 | */ |
madcowswe | 15:9c5aaeda36dc | 23 | |
madcowswe | 15:9c5aaeda36dc | 24 | #ifndef TVMET_XPR_VECTOR_BINARY_FUNCTIONS_H |
madcowswe | 15:9c5aaeda36dc | 25 | #define TVMET_XPR_VECTOR_BINARY_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 | * binary_function(XprVector<E1, Sz>, XprVector<E2, Sz>) |
madcowswe | 15:9c5aaeda36dc | 37 | */ |
madcowswe | 15:9c5aaeda36dc | 38 | #define TVMET_DECLARE_MACRO(NAME) \ |
madcowswe | 15:9c5aaeda36dc | 39 | template<class E1, class E2, std::size_t Sz> \ |
madcowswe | 15:9c5aaeda36dc | 40 | inline \ |
madcowswe | 15:9c5aaeda36dc | 41 | XprVector< \ |
madcowswe | 15:9c5aaeda36dc | 42 | XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 43 | Fcnl_##NAME<typename E1::value_type, typename E2::value_type>, \ |
madcowswe | 15:9c5aaeda36dc | 44 | XprVector<E1, Sz>, \ |
madcowswe | 15:9c5aaeda36dc | 45 | XprVector<E2, Sz> \ |
madcowswe | 15:9c5aaeda36dc | 46 | >, \ |
madcowswe | 15:9c5aaeda36dc | 47 | Sz \ |
madcowswe | 15:9c5aaeda36dc | 48 | > \ |
madcowswe | 15:9c5aaeda36dc | 49 | NAME(const XprVector<E1, Sz>& lhs, \ |
madcowswe | 15:9c5aaeda36dc | 50 | const XprVector<E2, Sz>& rhs) TVMET_CXX_ALWAYS_INLINE; |
madcowswe | 15:9c5aaeda36dc | 51 | |
madcowswe | 15:9c5aaeda36dc | 52 | TVMET_DECLARE_MACRO(atan2) |
madcowswe | 15:9c5aaeda36dc | 53 | TVMET_DECLARE_MACRO(drem) |
madcowswe | 15:9c5aaeda36dc | 54 | TVMET_DECLARE_MACRO(fmod) |
madcowswe | 15:9c5aaeda36dc | 55 | TVMET_DECLARE_MACRO(hypot) |
madcowswe | 15:9c5aaeda36dc | 56 | TVMET_DECLARE_MACRO(jn) |
madcowswe | 15:9c5aaeda36dc | 57 | TVMET_DECLARE_MACRO(yn) |
madcowswe | 15:9c5aaeda36dc | 58 | TVMET_DECLARE_MACRO(pow) |
madcowswe | 15:9c5aaeda36dc | 59 | #if defined(TVMET_HAVE_COMPLEX) |
madcowswe | 15:9c5aaeda36dc | 60 | TVMET_DECLARE_MACRO(polar) |
madcowswe | 15:9c5aaeda36dc | 61 | #endif |
madcowswe | 15:9c5aaeda36dc | 62 | |
madcowswe | 15:9c5aaeda36dc | 63 | #undef TVMET_DECLARE_MACRO |
madcowswe | 15:9c5aaeda36dc | 64 | |
madcowswe | 15:9c5aaeda36dc | 65 | |
madcowswe | 15:9c5aaeda36dc | 66 | /* |
madcowswe | 15:9c5aaeda36dc | 67 | * binary_function(XprVector<E, Sz>, POD) |
madcowswe | 15:9c5aaeda36dc | 68 | */ |
madcowswe | 15:9c5aaeda36dc | 69 | #define TVMET_DECLARE_MACRO(NAME, TP) \ |
madcowswe | 15:9c5aaeda36dc | 70 | template<class E, std::size_t Sz> \ |
madcowswe | 15:9c5aaeda36dc | 71 | inline \ |
madcowswe | 15:9c5aaeda36dc | 72 | XprVector< \ |
madcowswe | 15:9c5aaeda36dc | 73 | XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 74 | Fcnl_##NAME<typename E::value_type, TP >, \ |
madcowswe | 15:9c5aaeda36dc | 75 | XprVector<E, Sz>, \ |
madcowswe | 15:9c5aaeda36dc | 76 | XprLiteral< TP > \ |
madcowswe | 15:9c5aaeda36dc | 77 | >, \ |
madcowswe | 15:9c5aaeda36dc | 78 | Sz \ |
madcowswe | 15:9c5aaeda36dc | 79 | > \ |
madcowswe | 15:9c5aaeda36dc | 80 | NAME(const XprVector<E, Sz>& lhs, \ |
madcowswe | 15:9c5aaeda36dc | 81 | TP rhs) TVMET_CXX_ALWAYS_INLINE; |
madcowswe | 15:9c5aaeda36dc | 82 | |
madcowswe | 15:9c5aaeda36dc | 83 | TVMET_DECLARE_MACRO(atan2, int) |
madcowswe | 15:9c5aaeda36dc | 84 | TVMET_DECLARE_MACRO(drem, int) |
madcowswe | 15:9c5aaeda36dc | 85 | TVMET_DECLARE_MACRO(fmod, int) |
madcowswe | 15:9c5aaeda36dc | 86 | TVMET_DECLARE_MACRO(hypot, int) |
madcowswe | 15:9c5aaeda36dc | 87 | TVMET_DECLARE_MACRO(jn, int) |
madcowswe | 15:9c5aaeda36dc | 88 | TVMET_DECLARE_MACRO(yn, int) |
madcowswe | 15:9c5aaeda36dc | 89 | TVMET_DECLARE_MACRO(pow, int) |
madcowswe | 15:9c5aaeda36dc | 90 | |
madcowswe | 15:9c5aaeda36dc | 91 | #if defined(TVMET_HAVE_LONG_LONG) |
madcowswe | 15:9c5aaeda36dc | 92 | TVMET_DECLARE_MACRO(atan2, long long int) |
madcowswe | 15:9c5aaeda36dc | 93 | TVMET_DECLARE_MACRO(drem, long long int) |
madcowswe | 15:9c5aaeda36dc | 94 | TVMET_DECLARE_MACRO(fmod, long long int) |
madcowswe | 15:9c5aaeda36dc | 95 | TVMET_DECLARE_MACRO(hypot, long long int) |
madcowswe | 15:9c5aaeda36dc | 96 | TVMET_DECLARE_MACRO(jn, long long int) |
madcowswe | 15:9c5aaeda36dc | 97 | TVMET_DECLARE_MACRO(yn, long long int) |
madcowswe | 15:9c5aaeda36dc | 98 | TVMET_DECLARE_MACRO(pow, long long int) |
madcowswe | 15:9c5aaeda36dc | 99 | #endif // defined(TVMET_HAVE_LONG_LONG) |
madcowswe | 15:9c5aaeda36dc | 100 | |
madcowswe | 15:9c5aaeda36dc | 101 | TVMET_DECLARE_MACRO(atan2, float) |
madcowswe | 15:9c5aaeda36dc | 102 | TVMET_DECLARE_MACRO(drem, float) |
madcowswe | 15:9c5aaeda36dc | 103 | TVMET_DECLARE_MACRO(fmod, float) |
madcowswe | 15:9c5aaeda36dc | 104 | TVMET_DECLARE_MACRO(hypot, float) |
madcowswe | 15:9c5aaeda36dc | 105 | TVMET_DECLARE_MACRO(jn, float) |
madcowswe | 15:9c5aaeda36dc | 106 | TVMET_DECLARE_MACRO(yn, float) |
madcowswe | 15:9c5aaeda36dc | 107 | TVMET_DECLARE_MACRO(pow, float) |
madcowswe | 15:9c5aaeda36dc | 108 | |
madcowswe | 15:9c5aaeda36dc | 109 | TVMET_DECLARE_MACRO(atan2, double) |
madcowswe | 15:9c5aaeda36dc | 110 | TVMET_DECLARE_MACRO(drem, double) |
madcowswe | 15:9c5aaeda36dc | 111 | TVMET_DECLARE_MACRO(fmod, double) |
madcowswe | 15:9c5aaeda36dc | 112 | TVMET_DECLARE_MACRO(hypot, double) |
madcowswe | 15:9c5aaeda36dc | 113 | TVMET_DECLARE_MACRO(jn, double) |
madcowswe | 15:9c5aaeda36dc | 114 | TVMET_DECLARE_MACRO(yn, double) |
madcowswe | 15:9c5aaeda36dc | 115 | TVMET_DECLARE_MACRO(pow, double) |
madcowswe | 15:9c5aaeda36dc | 116 | |
madcowswe | 15:9c5aaeda36dc | 117 | #if defined(TVMET_HAVE_LONG_DOUBLE) |
madcowswe | 15:9c5aaeda36dc | 118 | TVMET_DECLARE_MACRO(atan2, long double) |
madcowswe | 15:9c5aaeda36dc | 119 | TVMET_DECLARE_MACRO(drem, long double) |
madcowswe | 15:9c5aaeda36dc | 120 | TVMET_DECLARE_MACRO(fmod, long double) |
madcowswe | 15:9c5aaeda36dc | 121 | TVMET_DECLARE_MACRO(hypot, long double) |
madcowswe | 15:9c5aaeda36dc | 122 | TVMET_DECLARE_MACRO(jn, long double) |
madcowswe | 15:9c5aaeda36dc | 123 | TVMET_DECLARE_MACRO(yn, long double) |
madcowswe | 15:9c5aaeda36dc | 124 | TVMET_DECLARE_MACRO(pow, long double) |
madcowswe | 15:9c5aaeda36dc | 125 | #endif // defined(TVMET_HAVE_LONG_DOUBLE) |
madcowswe | 15:9c5aaeda36dc | 126 | |
madcowswe | 15:9c5aaeda36dc | 127 | #undef TVMET_DECLARE_MACRO |
madcowswe | 15:9c5aaeda36dc | 128 | |
madcowswe | 15:9c5aaeda36dc | 129 | |
madcowswe | 15:9c5aaeda36dc | 130 | #if defined(TVMET_HAVE_COMPLEX) |
madcowswe | 15:9c5aaeda36dc | 131 | /* |
madcowswe | 15:9c5aaeda36dc | 132 | * binary_function(XprVector<E, Sz>, std::complex<>) |
madcowswe | 15:9c5aaeda36dc | 133 | */ |
madcowswe | 15:9c5aaeda36dc | 134 | #define TVMET_DECLARE_MACRO(NAME) \ |
madcowswe | 15:9c5aaeda36dc | 135 | template<class E, std::size_t Sz, class T> \ |
madcowswe | 15:9c5aaeda36dc | 136 | inline \ |
madcowswe | 15:9c5aaeda36dc | 137 | XprVector< \ |
madcowswe | 15:9c5aaeda36dc | 138 | XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 139 | Fcnl_##NAME<typename E::value_type, std::complex<T> >, \ |
madcowswe | 15:9c5aaeda36dc | 140 | XprVector<E, Sz>, \ |
madcowswe | 15:9c5aaeda36dc | 141 | XprLiteral< std::complex<T> > \ |
madcowswe | 15:9c5aaeda36dc | 142 | >, \ |
madcowswe | 15:9c5aaeda36dc | 143 | Sz \ |
madcowswe | 15:9c5aaeda36dc | 144 | > \ |
madcowswe | 15:9c5aaeda36dc | 145 | NAME(const XprVector<E, Sz>& lhs, \ |
madcowswe | 15:9c5aaeda36dc | 146 | const std::complex<T>& rhs) TVMET_CXX_ALWAYS_INLINE; |
madcowswe | 15:9c5aaeda36dc | 147 | |
madcowswe | 15:9c5aaeda36dc | 148 | TVMET_DECLARE_MACRO(atan2) |
madcowswe | 15:9c5aaeda36dc | 149 | TVMET_DECLARE_MACRO(drem) |
madcowswe | 15:9c5aaeda36dc | 150 | TVMET_DECLARE_MACRO(fmod) |
madcowswe | 15:9c5aaeda36dc | 151 | TVMET_DECLARE_MACRO(hypot) |
madcowswe | 15:9c5aaeda36dc | 152 | TVMET_DECLARE_MACRO(jn) |
madcowswe | 15:9c5aaeda36dc | 153 | TVMET_DECLARE_MACRO(yn) |
madcowswe | 15:9c5aaeda36dc | 154 | TVMET_DECLARE_MACRO(pow) |
madcowswe | 15:9c5aaeda36dc | 155 | |
madcowswe | 15:9c5aaeda36dc | 156 | #undef TVMET_DECLARE_MACRO |
madcowswe | 15:9c5aaeda36dc | 157 | |
madcowswe | 15:9c5aaeda36dc | 158 | #endif // defined(TVMET_HAVE_COMPLEX) |
madcowswe | 15:9c5aaeda36dc | 159 | |
madcowswe | 15:9c5aaeda36dc | 160 | |
madcowswe | 15:9c5aaeda36dc | 161 | /********************************************************* |
madcowswe | 15:9c5aaeda36dc | 162 | * PART II: IMPLEMENTATION |
madcowswe | 15:9c5aaeda36dc | 163 | *********************************************************/ |
madcowswe | 15:9c5aaeda36dc | 164 | |
madcowswe | 15:9c5aaeda36dc | 165 | |
madcowswe | 15:9c5aaeda36dc | 166 | /* |
madcowswe | 15:9c5aaeda36dc | 167 | * binary_function(XprVector<E1, Sz>, XprVector<E2, Sz>) |
madcowswe | 15:9c5aaeda36dc | 168 | */ |
madcowswe | 15:9c5aaeda36dc | 169 | #define TVMET_IMPLEMENT_MACRO(NAME) \ |
madcowswe | 15:9c5aaeda36dc | 170 | template<class E1, class E2, std::size_t Sz> \ |
madcowswe | 15:9c5aaeda36dc | 171 | inline \ |
madcowswe | 15:9c5aaeda36dc | 172 | XprVector< \ |
madcowswe | 15:9c5aaeda36dc | 173 | XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 174 | Fcnl_##NAME<typename E1::value_type, typename E2::value_type>, \ |
madcowswe | 15:9c5aaeda36dc | 175 | XprVector<E1, Sz>, \ |
madcowswe | 15:9c5aaeda36dc | 176 | XprVector<E2, Sz> \ |
madcowswe | 15:9c5aaeda36dc | 177 | >, \ |
madcowswe | 15:9c5aaeda36dc | 178 | Sz \ |
madcowswe | 15:9c5aaeda36dc | 179 | > \ |
madcowswe | 15:9c5aaeda36dc | 180 | NAME(const XprVector<E1, Sz>& lhs, const XprVector<E2, Sz>& rhs) { \ |
madcowswe | 15:9c5aaeda36dc | 181 | typedef XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 182 | Fcnl_##NAME<typename E1::value_type, typename E2::value_type>, \ |
madcowswe | 15:9c5aaeda36dc | 183 | XprVector<E1, Sz>, \ |
madcowswe | 15:9c5aaeda36dc | 184 | XprVector<E2, Sz> \ |
madcowswe | 15:9c5aaeda36dc | 185 | > expr_type; \ |
madcowswe | 15:9c5aaeda36dc | 186 | return XprVector<expr_type, Sz>( \ |
madcowswe | 15:9c5aaeda36dc | 187 | expr_type(lhs, rhs)); \ |
madcowswe | 15:9c5aaeda36dc | 188 | } |
madcowswe | 15:9c5aaeda36dc | 189 | |
madcowswe | 15:9c5aaeda36dc | 190 | TVMET_IMPLEMENT_MACRO(atan2) |
madcowswe | 15:9c5aaeda36dc | 191 | TVMET_IMPLEMENT_MACRO(drem) |
madcowswe | 15:9c5aaeda36dc | 192 | TVMET_IMPLEMENT_MACRO(fmod) |
madcowswe | 15:9c5aaeda36dc | 193 | TVMET_IMPLEMENT_MACRO(hypot) |
madcowswe | 15:9c5aaeda36dc | 194 | TVMET_IMPLEMENT_MACRO(jn) |
madcowswe | 15:9c5aaeda36dc | 195 | TVMET_IMPLEMENT_MACRO(yn) |
madcowswe | 15:9c5aaeda36dc | 196 | TVMET_IMPLEMENT_MACRO(pow) |
madcowswe | 15:9c5aaeda36dc | 197 | #if defined(TVMET_HAVE_COMPLEX) |
madcowswe | 15:9c5aaeda36dc | 198 | TVMET_IMPLEMENT_MACRO(polar) |
madcowswe | 15:9c5aaeda36dc | 199 | #endif |
madcowswe | 15:9c5aaeda36dc | 200 | |
madcowswe | 15:9c5aaeda36dc | 201 | #undef TVMET_IMPLEMENT_MACRO |
madcowswe | 15:9c5aaeda36dc | 202 | |
madcowswe | 15:9c5aaeda36dc | 203 | |
madcowswe | 15:9c5aaeda36dc | 204 | /* |
madcowswe | 15:9c5aaeda36dc | 205 | * binary_function(XprVector<E, Sz>, POD) |
madcowswe | 15:9c5aaeda36dc | 206 | */ |
madcowswe | 15:9c5aaeda36dc | 207 | #define TVMET_IMPLEMENT_MACRO(NAME, TP) \ |
madcowswe | 15:9c5aaeda36dc | 208 | template<class E, std::size_t Sz> \ |
madcowswe | 15:9c5aaeda36dc | 209 | inline \ |
madcowswe | 15:9c5aaeda36dc | 210 | XprVector< \ |
madcowswe | 15:9c5aaeda36dc | 211 | XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 212 | Fcnl_##NAME<typename E::value_type, TP >, \ |
madcowswe | 15:9c5aaeda36dc | 213 | XprVector<E, Sz>, \ |
madcowswe | 15:9c5aaeda36dc | 214 | XprLiteral< TP > \ |
madcowswe | 15:9c5aaeda36dc | 215 | >, \ |
madcowswe | 15:9c5aaeda36dc | 216 | Sz \ |
madcowswe | 15:9c5aaeda36dc | 217 | > \ |
madcowswe | 15:9c5aaeda36dc | 218 | NAME(const XprVector<E, Sz>& lhs, TP rhs) { \ |
madcowswe | 15:9c5aaeda36dc | 219 | typedef XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 220 | Fcnl_##NAME<typename E::value_type, TP >, \ |
madcowswe | 15:9c5aaeda36dc | 221 | XprVector<E, Sz>, \ |
madcowswe | 15:9c5aaeda36dc | 222 | XprLiteral< TP > \ |
madcowswe | 15:9c5aaeda36dc | 223 | > expr_type; \ |
madcowswe | 15:9c5aaeda36dc | 224 | return XprVector<expr_type, Sz>( \ |
madcowswe | 15:9c5aaeda36dc | 225 | expr_type(lhs, XprLiteral< TP >(rhs))); \ |
madcowswe | 15:9c5aaeda36dc | 226 | } |
madcowswe | 15:9c5aaeda36dc | 227 | |
madcowswe | 15:9c5aaeda36dc | 228 | TVMET_IMPLEMENT_MACRO(atan2, int) |
madcowswe | 15:9c5aaeda36dc | 229 | TVMET_IMPLEMENT_MACRO(drem, int) |
madcowswe | 15:9c5aaeda36dc | 230 | TVMET_IMPLEMENT_MACRO(fmod, int) |
madcowswe | 15:9c5aaeda36dc | 231 | TVMET_IMPLEMENT_MACRO(hypot, int) |
madcowswe | 15:9c5aaeda36dc | 232 | TVMET_IMPLEMENT_MACRO(jn, int) |
madcowswe | 15:9c5aaeda36dc | 233 | TVMET_IMPLEMENT_MACRO(yn, int) |
madcowswe | 15:9c5aaeda36dc | 234 | TVMET_IMPLEMENT_MACRO(pow, int) |
madcowswe | 15:9c5aaeda36dc | 235 | |
madcowswe | 15:9c5aaeda36dc | 236 | #if defined(TVMET_HAVE_LONG_LONG) |
madcowswe | 15:9c5aaeda36dc | 237 | TVMET_IMPLEMENT_MACRO(atan2, long long int) |
madcowswe | 15:9c5aaeda36dc | 238 | TVMET_IMPLEMENT_MACRO(drem, long long int) |
madcowswe | 15:9c5aaeda36dc | 239 | TVMET_IMPLEMENT_MACRO(fmod, long long int) |
madcowswe | 15:9c5aaeda36dc | 240 | TVMET_IMPLEMENT_MACRO(hypot, long long int) |
madcowswe | 15:9c5aaeda36dc | 241 | TVMET_IMPLEMENT_MACRO(jn, long long int) |
madcowswe | 15:9c5aaeda36dc | 242 | TVMET_IMPLEMENT_MACRO(yn, long long int) |
madcowswe | 15:9c5aaeda36dc | 243 | TVMET_IMPLEMENT_MACRO(pow, long long int) |
madcowswe | 15:9c5aaeda36dc | 244 | #endif // defined(TVMET_HAVE_LONG_LONG) |
madcowswe | 15:9c5aaeda36dc | 245 | |
madcowswe | 15:9c5aaeda36dc | 246 | TVMET_IMPLEMENT_MACRO(atan2, float) |
madcowswe | 15:9c5aaeda36dc | 247 | TVMET_IMPLEMENT_MACRO(drem, float) |
madcowswe | 15:9c5aaeda36dc | 248 | TVMET_IMPLEMENT_MACRO(fmod, float) |
madcowswe | 15:9c5aaeda36dc | 249 | TVMET_IMPLEMENT_MACRO(hypot, float) |
madcowswe | 15:9c5aaeda36dc | 250 | TVMET_IMPLEMENT_MACRO(jn, float) |
madcowswe | 15:9c5aaeda36dc | 251 | TVMET_IMPLEMENT_MACRO(yn, float) |
madcowswe | 15:9c5aaeda36dc | 252 | TVMET_IMPLEMENT_MACRO(pow, float) |
madcowswe | 15:9c5aaeda36dc | 253 | |
madcowswe | 15:9c5aaeda36dc | 254 | TVMET_IMPLEMENT_MACRO(atan2, double) |
madcowswe | 15:9c5aaeda36dc | 255 | TVMET_IMPLEMENT_MACRO(drem, double) |
madcowswe | 15:9c5aaeda36dc | 256 | TVMET_IMPLEMENT_MACRO(fmod, double) |
madcowswe | 15:9c5aaeda36dc | 257 | TVMET_IMPLEMENT_MACRO(hypot, double) |
madcowswe | 15:9c5aaeda36dc | 258 | TVMET_IMPLEMENT_MACRO(jn, double) |
madcowswe | 15:9c5aaeda36dc | 259 | TVMET_IMPLEMENT_MACRO(yn, double) |
madcowswe | 15:9c5aaeda36dc | 260 | TVMET_IMPLEMENT_MACRO(pow, double) |
madcowswe | 15:9c5aaeda36dc | 261 | |
madcowswe | 15:9c5aaeda36dc | 262 | #if defined(TVMET_HAVE_LONG_DOUBLE) |
madcowswe | 15:9c5aaeda36dc | 263 | TVMET_IMPLEMENT_MACRO(atan2, long double) |
madcowswe | 15:9c5aaeda36dc | 264 | TVMET_IMPLEMENT_MACRO(drem, long double) |
madcowswe | 15:9c5aaeda36dc | 265 | TVMET_IMPLEMENT_MACRO(fmod, long double) |
madcowswe | 15:9c5aaeda36dc | 266 | TVMET_IMPLEMENT_MACRO(hypot, long double) |
madcowswe | 15:9c5aaeda36dc | 267 | TVMET_IMPLEMENT_MACRO(jn, long double) |
madcowswe | 15:9c5aaeda36dc | 268 | TVMET_IMPLEMENT_MACRO(yn, long double) |
madcowswe | 15:9c5aaeda36dc | 269 | TVMET_IMPLEMENT_MACRO(pow, long double) |
madcowswe | 15:9c5aaeda36dc | 270 | #endif // defined(TVMET_HAVE_LONG_DOUBLE) |
madcowswe | 15:9c5aaeda36dc | 271 | |
madcowswe | 15:9c5aaeda36dc | 272 | #undef TVMET_IMPLEMENT_MACRO |
madcowswe | 15:9c5aaeda36dc | 273 | |
madcowswe | 15:9c5aaeda36dc | 274 | |
madcowswe | 15:9c5aaeda36dc | 275 | #if defined(TVMET_HAVE_COMPLEX) |
madcowswe | 15:9c5aaeda36dc | 276 | /* |
madcowswe | 15:9c5aaeda36dc | 277 | * binary_function(XprVector<E, Sz>, std::complex<>) |
madcowswe | 15:9c5aaeda36dc | 278 | */ |
madcowswe | 15:9c5aaeda36dc | 279 | #define TVMET_IMPLEMENT_MACRO(NAME) \ |
madcowswe | 15:9c5aaeda36dc | 280 | template<class E, std::size_t Sz, class T> \ |
madcowswe | 15:9c5aaeda36dc | 281 | inline \ |
madcowswe | 15:9c5aaeda36dc | 282 | XprVector< \ |
madcowswe | 15:9c5aaeda36dc | 283 | XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 284 | Fcnl_##NAME<typename E::value_type, std::complex<T> >, \ |
madcowswe | 15:9c5aaeda36dc | 285 | XprVector<E, Sz>, \ |
madcowswe | 15:9c5aaeda36dc | 286 | XprLiteral< std::complex<T> > \ |
madcowswe | 15:9c5aaeda36dc | 287 | >, \ |
madcowswe | 15:9c5aaeda36dc | 288 | Sz \ |
madcowswe | 15:9c5aaeda36dc | 289 | > \ |
madcowswe | 15:9c5aaeda36dc | 290 | NAME(const XprVector<E, Sz>& lhs, const std::complex<T>& rhs) { \ |
madcowswe | 15:9c5aaeda36dc | 291 | typedef XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 292 | Fcnl_##NAME<typename E::value_type, std::complex<T> >, \ |
madcowswe | 15:9c5aaeda36dc | 293 | XprVector<E, Sz>, \ |
madcowswe | 15:9c5aaeda36dc | 294 | XprLiteral< std::complex<T> > \ |
madcowswe | 15:9c5aaeda36dc | 295 | > expr_type; \ |
madcowswe | 15:9c5aaeda36dc | 296 | return XprVector<expr_type, Sz>( \ |
madcowswe | 15:9c5aaeda36dc | 297 | expr_type(lhs, XprLiteral< std::complex<T> >(rhs))); \ |
madcowswe | 15:9c5aaeda36dc | 298 | } |
madcowswe | 15:9c5aaeda36dc | 299 | |
madcowswe | 15:9c5aaeda36dc | 300 | TVMET_IMPLEMENT_MACRO(atan2) |
madcowswe | 15:9c5aaeda36dc | 301 | TVMET_IMPLEMENT_MACRO(drem) |
madcowswe | 15:9c5aaeda36dc | 302 | TVMET_IMPLEMENT_MACRO(fmod) |
madcowswe | 15:9c5aaeda36dc | 303 | TVMET_IMPLEMENT_MACRO(hypot) |
madcowswe | 15:9c5aaeda36dc | 304 | TVMET_IMPLEMENT_MACRO(jn) |
madcowswe | 15:9c5aaeda36dc | 305 | TVMET_IMPLEMENT_MACRO(yn) |
madcowswe | 15:9c5aaeda36dc | 306 | TVMET_IMPLEMENT_MACRO(pow) |
madcowswe | 15:9c5aaeda36dc | 307 | |
madcowswe | 15:9c5aaeda36dc | 308 | #undef TVMET_IMPLEMENT_MACRO |
madcowswe | 15:9c5aaeda36dc | 309 | |
madcowswe | 15:9c5aaeda36dc | 310 | #endif // defined(TVMET_HAVE_COMPLEX) |
madcowswe | 15:9c5aaeda36dc | 311 | |
madcowswe | 15:9c5aaeda36dc | 312 | |
madcowswe | 15:9c5aaeda36dc | 313 | } // namespace tvmet |
madcowswe | 15:9c5aaeda36dc | 314 | |
madcowswe | 15:9c5aaeda36dc | 315 | #endif // TVMET_XPR_VECTOR_BINARY_FUNCTIONS_H |
madcowswe | 15:9c5aaeda36dc | 316 | |
madcowswe | 15:9c5aaeda36dc | 317 | // Local Variables: |
madcowswe | 15:9c5aaeda36dc | 318 | // mode:C++ |
madcowswe | 15:9c5aaeda36dc | 319 | // tab-width:8 |
madcowswe | 15:9c5aaeda36dc | 320 | // End: |