ICRS Eurobot 2013
Dependencies: mbed mbed-rtos Servo QEI
tvmet/VectorEval.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: VectorEval.h,v 1.18 2007-06-23 15:58:58 opetzold Exp $ |
madcowswe | 15:9c5aaeda36dc | 22 | */ |
madcowswe | 15:9c5aaeda36dc | 23 | |
madcowswe | 15:9c5aaeda36dc | 24 | #ifndef TVMET_VECTOR_EVAL_H |
madcowswe | 15:9c5aaeda36dc | 25 | #define TVMET_VECTOR_EVAL_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 | * functions all_elements/any_elements |
madcowswe | 15:9c5aaeda36dc | 32 | ********************************************************************/ |
madcowswe | 15:9c5aaeda36dc | 33 | |
madcowswe | 15:9c5aaeda36dc | 34 | |
madcowswe | 15:9c5aaeda36dc | 35 | /** |
madcowswe | 15:9c5aaeda36dc | 36 | * \fn bool all_elements(const XprVector<E, Sz>& e) |
madcowswe | 15:9c5aaeda36dc | 37 | * \brief check on statements for all elements |
madcowswe | 15:9c5aaeda36dc | 38 | * \ingroup _unary_function |
madcowswe | 15:9c5aaeda36dc | 39 | * This is for use with boolean operators like |
madcowswe | 15:9c5aaeda36dc | 40 | * \par Example: |
madcowswe | 15:9c5aaeda36dc | 41 | * \code |
madcowswe | 15:9c5aaeda36dc | 42 | * all_elements(vector > 0) { |
madcowswe | 15:9c5aaeda36dc | 43 | * // true branch |
madcowswe | 15:9c5aaeda36dc | 44 | * } else { |
madcowswe | 15:9c5aaeda36dc | 45 | * // false branch |
madcowswe | 15:9c5aaeda36dc | 46 | * } |
madcowswe | 15:9c5aaeda36dc | 47 | * \endcode |
madcowswe | 15:9c5aaeda36dc | 48 | * \sa \ref compare |
madcowswe | 15:9c5aaeda36dc | 49 | */ |
madcowswe | 15:9c5aaeda36dc | 50 | template<class E, std::size_t Sz> |
madcowswe | 15:9c5aaeda36dc | 51 | inline |
madcowswe | 15:9c5aaeda36dc | 52 | bool all_elements(const XprVector<E, Sz>& e) { |
madcowswe | 15:9c5aaeda36dc | 53 | return meta::Vector<Sz>::all_elements(e); |
madcowswe | 15:9c5aaeda36dc | 54 | } |
madcowswe | 15:9c5aaeda36dc | 55 | |
madcowswe | 15:9c5aaeda36dc | 56 | |
madcowswe | 15:9c5aaeda36dc | 57 | /** |
madcowswe | 15:9c5aaeda36dc | 58 | * \fn bool any_elements(const XprVector<E, Sz>& e) |
madcowswe | 15:9c5aaeda36dc | 59 | * \brief check on statements for any elements |
madcowswe | 15:9c5aaeda36dc | 60 | * \ingroup _unary_function |
madcowswe | 15:9c5aaeda36dc | 61 | * This is for use with boolean operators like |
madcowswe | 15:9c5aaeda36dc | 62 | * \par Example: |
madcowswe | 15:9c5aaeda36dc | 63 | * \code |
madcowswe | 15:9c5aaeda36dc | 64 | * any_elements(vector > 0) { |
madcowswe | 15:9c5aaeda36dc | 65 | * // true branch |
madcowswe | 15:9c5aaeda36dc | 66 | * } else { |
madcowswe | 15:9c5aaeda36dc | 67 | * // false branch |
madcowswe | 15:9c5aaeda36dc | 68 | * } |
madcowswe | 15:9c5aaeda36dc | 69 | * \endcode |
madcowswe | 15:9c5aaeda36dc | 70 | * \sa \ref compare |
madcowswe | 15:9c5aaeda36dc | 71 | */ |
madcowswe | 15:9c5aaeda36dc | 72 | template<class E, std::size_t Sz> |
madcowswe | 15:9c5aaeda36dc | 73 | inline |
madcowswe | 15:9c5aaeda36dc | 74 | bool any_elements(const XprVector<E, Sz>& e) { |
madcowswe | 15:9c5aaeda36dc | 75 | return meta::Vector<Sz>::any_elements(e); |
madcowswe | 15:9c5aaeda36dc | 76 | } |
madcowswe | 15:9c5aaeda36dc | 77 | |
madcowswe | 15:9c5aaeda36dc | 78 | |
madcowswe | 15:9c5aaeda36dc | 79 | /* |
madcowswe | 15:9c5aaeda36dc | 80 | * trinary evaluation functions with vectors and xpr of |
madcowswe | 15:9c5aaeda36dc | 81 | * XprVector<E1, Sz> ? Vector<T2, Sz> : Vector<T3, Sz> |
madcowswe | 15:9c5aaeda36dc | 82 | * XprVector<E1, Sz> ? Vector<T2, Sz> : XprVector<E3, Sz> |
madcowswe | 15:9c5aaeda36dc | 83 | * XprVector<E1, Sz> ? XprVector<E2, Sz> : Vector<T3, Sz> |
madcowswe | 15:9c5aaeda36dc | 84 | * XprVector<E1, Sz> ? XprVector<E2, Sz> : XprVector<E3, Sz> |
madcowswe | 15:9c5aaeda36dc | 85 | */ |
madcowswe | 15:9c5aaeda36dc | 86 | |
madcowswe | 15:9c5aaeda36dc | 87 | /** |
madcowswe | 15:9c5aaeda36dc | 88 | * eval(const XprVector<E1, Sz>& e1, const Vector<T2, Sz>& v2, const Vector<T3, Sz>& v3) |
madcowswe | 15:9c5aaeda36dc | 89 | * \brief Evals the vector expressions. |
madcowswe | 15:9c5aaeda36dc | 90 | * \ingroup _trinary_function |
madcowswe | 15:9c5aaeda36dc | 91 | * This eval is for the a?b:c syntax, since it's not allowed to overload |
madcowswe | 15:9c5aaeda36dc | 92 | * these operators. |
madcowswe | 15:9c5aaeda36dc | 93 | */ |
madcowswe | 15:9c5aaeda36dc | 94 | template<class E1, class T2, class T3, std::size_t Sz> |
madcowswe | 15:9c5aaeda36dc | 95 | inline |
madcowswe | 15:9c5aaeda36dc | 96 | XprVector< |
madcowswe | 15:9c5aaeda36dc | 97 | XprEval< |
madcowswe | 15:9c5aaeda36dc | 98 | XprVector<E1, Sz>, |
madcowswe | 15:9c5aaeda36dc | 99 | VectorConstReference<T2, Sz>, |
madcowswe | 15:9c5aaeda36dc | 100 | VectorConstReference<T3, Sz> |
madcowswe | 15:9c5aaeda36dc | 101 | >, |
madcowswe | 15:9c5aaeda36dc | 102 | Sz |
madcowswe | 15:9c5aaeda36dc | 103 | > |
madcowswe | 15:9c5aaeda36dc | 104 | eval(const XprVector<E1, Sz>& e1, const Vector<T2, Sz>& v2, const Vector<T3, Sz>& v3) { |
madcowswe | 15:9c5aaeda36dc | 105 | typedef XprEval< |
madcowswe | 15:9c5aaeda36dc | 106 | XprVector<E1, Sz>, |
madcowswe | 15:9c5aaeda36dc | 107 | VectorConstReference<T2, Sz>, |
madcowswe | 15:9c5aaeda36dc | 108 | VectorConstReference<T3, Sz> |
madcowswe | 15:9c5aaeda36dc | 109 | > expr_type; |
madcowswe | 15:9c5aaeda36dc | 110 | return XprVector<expr_type, Sz>( |
madcowswe | 15:9c5aaeda36dc | 111 | expr_type(e1, v2.const_ref(), v3.const_ref())); |
madcowswe | 15:9c5aaeda36dc | 112 | } |
madcowswe | 15:9c5aaeda36dc | 113 | |
madcowswe | 15:9c5aaeda36dc | 114 | |
madcowswe | 15:9c5aaeda36dc | 115 | /** |
madcowswe | 15:9c5aaeda36dc | 116 | * eval(const XprVector<E1, Sz>& e1, const Vector<T2, Sz>& v2, const XprVector<E3, Sz>& e3) |
madcowswe | 15:9c5aaeda36dc | 117 | * \brief Evals the vector expressions. |
madcowswe | 15:9c5aaeda36dc | 118 | * \ingroup _trinary_function |
madcowswe | 15:9c5aaeda36dc | 119 | * This eval is for the a?b:c syntax, since it's not allowed to overload |
madcowswe | 15:9c5aaeda36dc | 120 | * these operators. |
madcowswe | 15:9c5aaeda36dc | 121 | */ |
madcowswe | 15:9c5aaeda36dc | 122 | template<class E1, class T2, class E3, std::size_t Sz> |
madcowswe | 15:9c5aaeda36dc | 123 | inline |
madcowswe | 15:9c5aaeda36dc | 124 | XprVector< |
madcowswe | 15:9c5aaeda36dc | 125 | XprEval< |
madcowswe | 15:9c5aaeda36dc | 126 | XprVector<E1, Sz>, |
madcowswe | 15:9c5aaeda36dc | 127 | VectorConstReference<T2, Sz>, |
madcowswe | 15:9c5aaeda36dc | 128 | XprVector<E3, Sz> |
madcowswe | 15:9c5aaeda36dc | 129 | >, |
madcowswe | 15:9c5aaeda36dc | 130 | Sz |
madcowswe | 15:9c5aaeda36dc | 131 | > |
madcowswe | 15:9c5aaeda36dc | 132 | eval(const XprVector<E1, Sz>& e1, const Vector<T2, Sz>& v2, const XprVector<E3, Sz>& e3) { |
madcowswe | 15:9c5aaeda36dc | 133 | typedef XprEval< |
madcowswe | 15:9c5aaeda36dc | 134 | XprVector<E1, Sz>, |
madcowswe | 15:9c5aaeda36dc | 135 | VectorConstReference<T2, Sz>, |
madcowswe | 15:9c5aaeda36dc | 136 | XprVector<E3, Sz> |
madcowswe | 15:9c5aaeda36dc | 137 | > expr_type; |
madcowswe | 15:9c5aaeda36dc | 138 | return XprVector<expr_type, Sz>( |
madcowswe | 15:9c5aaeda36dc | 139 | expr_type(e1, v2.const_ref(), e3)); |
madcowswe | 15:9c5aaeda36dc | 140 | } |
madcowswe | 15:9c5aaeda36dc | 141 | |
madcowswe | 15:9c5aaeda36dc | 142 | |
madcowswe | 15:9c5aaeda36dc | 143 | /** |
madcowswe | 15:9c5aaeda36dc | 144 | * eval(const XprVector<E1, Sz>& e1, const XprVector<E2, Sz>& e2, const Vector<T3, Sz>& v3) |
madcowswe | 15:9c5aaeda36dc | 145 | * \brief Evals the vector expressions. |
madcowswe | 15:9c5aaeda36dc | 146 | * \ingroup _trinary_function |
madcowswe | 15:9c5aaeda36dc | 147 | * This eval is for the a?b:c syntax, since it's not allowed to overload |
madcowswe | 15:9c5aaeda36dc | 148 | * these operators. |
madcowswe | 15:9c5aaeda36dc | 149 | */ |
madcowswe | 15:9c5aaeda36dc | 150 | template<class E1, class E2, class T3, std::size_t Sz> |
madcowswe | 15:9c5aaeda36dc | 151 | inline |
madcowswe | 15:9c5aaeda36dc | 152 | XprVector< |
madcowswe | 15:9c5aaeda36dc | 153 | XprEval< |
madcowswe | 15:9c5aaeda36dc | 154 | XprVector<E1, Sz>, |
madcowswe | 15:9c5aaeda36dc | 155 | XprVector<E2, Sz>, |
madcowswe | 15:9c5aaeda36dc | 156 | VectorConstReference<T3, Sz> |
madcowswe | 15:9c5aaeda36dc | 157 | >, |
madcowswe | 15:9c5aaeda36dc | 158 | Sz |
madcowswe | 15:9c5aaeda36dc | 159 | > |
madcowswe | 15:9c5aaeda36dc | 160 | eval(const XprVector<E1, Sz>& e1, const XprVector<E2, Sz>& e2, const Vector<T3, Sz>& v3) { |
madcowswe | 15:9c5aaeda36dc | 161 | typedef XprEval< |
madcowswe | 15:9c5aaeda36dc | 162 | XprVector<E1, Sz>, |
madcowswe | 15:9c5aaeda36dc | 163 | XprVector<E2, Sz>, |
madcowswe | 15:9c5aaeda36dc | 164 | VectorConstReference<T3, Sz> |
madcowswe | 15:9c5aaeda36dc | 165 | > expr_type; |
madcowswe | 15:9c5aaeda36dc | 166 | return XprVector<expr_type, Sz>( |
madcowswe | 15:9c5aaeda36dc | 167 | expr_type(e1, e2, v3.const_ref())); |
madcowswe | 15:9c5aaeda36dc | 168 | } |
madcowswe | 15:9c5aaeda36dc | 169 | |
madcowswe | 15:9c5aaeda36dc | 170 | |
madcowswe | 15:9c5aaeda36dc | 171 | /** |
madcowswe | 15:9c5aaeda36dc | 172 | * eval(const XprVector<E1, Sz>& e1, const XprVector<E2, Sz>& e2, const XprVector<E3, Sz>& e3) |
madcowswe | 15:9c5aaeda36dc | 173 | * \brief Evals the vector expressions. |
madcowswe | 15:9c5aaeda36dc | 174 | * \ingroup _trinary_function |
madcowswe | 15:9c5aaeda36dc | 175 | * This eval is for the a?b:c syntax, since it's not allowed to overload |
madcowswe | 15:9c5aaeda36dc | 176 | * these operators. |
madcowswe | 15:9c5aaeda36dc | 177 | */ |
madcowswe | 15:9c5aaeda36dc | 178 | template<class E1, class E2, class E3, std::size_t Sz> |
madcowswe | 15:9c5aaeda36dc | 179 | inline |
madcowswe | 15:9c5aaeda36dc | 180 | XprVector< |
madcowswe | 15:9c5aaeda36dc | 181 | XprEval< |
madcowswe | 15:9c5aaeda36dc | 182 | XprVector<E1, Sz>, |
madcowswe | 15:9c5aaeda36dc | 183 | XprVector<E2, Sz>, |
madcowswe | 15:9c5aaeda36dc | 184 | XprVector<E3, Sz> |
madcowswe | 15:9c5aaeda36dc | 185 | >, |
madcowswe | 15:9c5aaeda36dc | 186 | Sz |
madcowswe | 15:9c5aaeda36dc | 187 | > |
madcowswe | 15:9c5aaeda36dc | 188 | eval(const XprVector<E1, Sz>& e1, const XprVector<E2, Sz>& e2, const XprVector<E3, Sz>& e3) { |
madcowswe | 15:9c5aaeda36dc | 189 | typedef XprEval< |
madcowswe | 15:9c5aaeda36dc | 190 | XprVector<E1, Sz>, |
madcowswe | 15:9c5aaeda36dc | 191 | XprVector<E2, Sz>, |
madcowswe | 15:9c5aaeda36dc | 192 | XprVector<E3, Sz> |
madcowswe | 15:9c5aaeda36dc | 193 | > expr_type; |
madcowswe | 15:9c5aaeda36dc | 194 | return XprVector<expr_type, Sz>(expr_type(e1, e2, e3)); |
madcowswe | 15:9c5aaeda36dc | 195 | } |
madcowswe | 15:9c5aaeda36dc | 196 | |
madcowswe | 15:9c5aaeda36dc | 197 | |
madcowswe | 15:9c5aaeda36dc | 198 | /* |
madcowswe | 15:9c5aaeda36dc | 199 | * trinary evaluation functions with vectors, xpr of and POD |
madcowswe | 15:9c5aaeda36dc | 200 | * |
madcowswe | 15:9c5aaeda36dc | 201 | * XprVector<E, Sz> ? POD1 : POD2 |
madcowswe | 15:9c5aaeda36dc | 202 | * XprVector<E1, Sz> ? POD : XprVector<E3, Sz> |
madcowswe | 15:9c5aaeda36dc | 203 | * XprVector<E1, Sz> ? XprVector<E2, Sz> : POD |
madcowswe | 15:9c5aaeda36dc | 204 | */ |
madcowswe | 15:9c5aaeda36dc | 205 | #define TVMET_IMPLEMENT_MACRO(POD) \ |
madcowswe | 15:9c5aaeda36dc | 206 | template<class E, std::size_t Sz> \ |
madcowswe | 15:9c5aaeda36dc | 207 | inline \ |
madcowswe | 15:9c5aaeda36dc | 208 | XprVector< \ |
madcowswe | 15:9c5aaeda36dc | 209 | XprEval< \ |
madcowswe | 15:9c5aaeda36dc | 210 | XprVector<E, Sz>, \ |
madcowswe | 15:9c5aaeda36dc | 211 | XprLiteral< POD >, \ |
madcowswe | 15:9c5aaeda36dc | 212 | XprLiteral< POD > \ |
madcowswe | 15:9c5aaeda36dc | 213 | >, \ |
madcowswe | 15:9c5aaeda36dc | 214 | Sz \ |
madcowswe | 15:9c5aaeda36dc | 215 | > \ |
madcowswe | 15:9c5aaeda36dc | 216 | eval(const XprVector<E, Sz>& e, POD x2, POD x3) { \ |
madcowswe | 15:9c5aaeda36dc | 217 | typedef XprEval< \ |
madcowswe | 15:9c5aaeda36dc | 218 | XprVector<E, Sz>, \ |
madcowswe | 15:9c5aaeda36dc | 219 | XprLiteral< POD >, \ |
madcowswe | 15:9c5aaeda36dc | 220 | XprLiteral< POD > \ |
madcowswe | 15:9c5aaeda36dc | 221 | > expr_type; \ |
madcowswe | 15:9c5aaeda36dc | 222 | return XprVector<expr_type, Sz>( \ |
madcowswe | 15:9c5aaeda36dc | 223 | expr_type(e, XprLiteral< POD >(x2), XprLiteral< POD >(x3))); \ |
madcowswe | 15:9c5aaeda36dc | 224 | } \ |
madcowswe | 15:9c5aaeda36dc | 225 | \ |
madcowswe | 15:9c5aaeda36dc | 226 | template<class E1, class E3, std::size_t Sz> \ |
madcowswe | 15:9c5aaeda36dc | 227 | inline \ |
madcowswe | 15:9c5aaeda36dc | 228 | XprVector< \ |
madcowswe | 15:9c5aaeda36dc | 229 | XprEval< \ |
madcowswe | 15:9c5aaeda36dc | 230 | XprVector<E1, Sz>, \ |
madcowswe | 15:9c5aaeda36dc | 231 | XprLiteral< POD >, \ |
madcowswe | 15:9c5aaeda36dc | 232 | XprVector<E3, Sz> \ |
madcowswe | 15:9c5aaeda36dc | 233 | >, \ |
madcowswe | 15:9c5aaeda36dc | 234 | Sz \ |
madcowswe | 15:9c5aaeda36dc | 235 | > \ |
madcowswe | 15:9c5aaeda36dc | 236 | eval(const XprVector<E1, Sz>& e1, POD x2, const XprVector<E3, Sz>& e3) { \ |
madcowswe | 15:9c5aaeda36dc | 237 | typedef XprEval< \ |
madcowswe | 15:9c5aaeda36dc | 238 | XprVector<E1, Sz>, \ |
madcowswe | 15:9c5aaeda36dc | 239 | XprLiteral< POD >, \ |
madcowswe | 15:9c5aaeda36dc | 240 | XprVector<E3, Sz> \ |
madcowswe | 15:9c5aaeda36dc | 241 | > expr_type; \ |
madcowswe | 15:9c5aaeda36dc | 242 | return XprVector<expr_type, Sz>( \ |
madcowswe | 15:9c5aaeda36dc | 243 | expr_type(e1, XprLiteral< POD >(x2), e3)); \ |
madcowswe | 15:9c5aaeda36dc | 244 | } \ |
madcowswe | 15:9c5aaeda36dc | 245 | \ |
madcowswe | 15:9c5aaeda36dc | 246 | template<class E1, class E2, std::size_t Sz> \ |
madcowswe | 15:9c5aaeda36dc | 247 | inline \ |
madcowswe | 15:9c5aaeda36dc | 248 | XprVector< \ |
madcowswe | 15:9c5aaeda36dc | 249 | XprEval< \ |
madcowswe | 15:9c5aaeda36dc | 250 | XprVector<E1, Sz>, \ |
madcowswe | 15:9c5aaeda36dc | 251 | XprVector<E2, Sz>, \ |
madcowswe | 15:9c5aaeda36dc | 252 | XprLiteral< POD > \ |
madcowswe | 15:9c5aaeda36dc | 253 | >, \ |
madcowswe | 15:9c5aaeda36dc | 254 | Sz \ |
madcowswe | 15:9c5aaeda36dc | 255 | > \ |
madcowswe | 15:9c5aaeda36dc | 256 | eval(const XprVector<E1, Sz>& e1, const XprVector<E2, Sz>& e2, POD x3) { \ |
madcowswe | 15:9c5aaeda36dc | 257 | typedef XprEval< \ |
madcowswe | 15:9c5aaeda36dc | 258 | XprVector<E1, Sz>, \ |
madcowswe | 15:9c5aaeda36dc | 259 | XprVector<E2, Sz>, \ |
madcowswe | 15:9c5aaeda36dc | 260 | XprLiteral< POD > \ |
madcowswe | 15:9c5aaeda36dc | 261 | > expr_type; \ |
madcowswe | 15:9c5aaeda36dc | 262 | return XprVector<expr_type, Sz>( \ |
madcowswe | 15:9c5aaeda36dc | 263 | expr_type(e1, e2, XprLiteral< POD >(x3))); \ |
madcowswe | 15:9c5aaeda36dc | 264 | } |
madcowswe | 15:9c5aaeda36dc | 265 | |
madcowswe | 15:9c5aaeda36dc | 266 | TVMET_IMPLEMENT_MACRO(int) |
madcowswe | 15:9c5aaeda36dc | 267 | |
madcowswe | 15:9c5aaeda36dc | 268 | #if defined(TVMET_HAVE_LONG_LONG) |
madcowswe | 15:9c5aaeda36dc | 269 | TVMET_IMPLEMENT_MACRO(long long int) |
madcowswe | 15:9c5aaeda36dc | 270 | #endif // defined(TVMET_HAVE_LONG_LONG) |
madcowswe | 15:9c5aaeda36dc | 271 | |
madcowswe | 15:9c5aaeda36dc | 272 | TVMET_IMPLEMENT_MACRO(float) |
madcowswe | 15:9c5aaeda36dc | 273 | TVMET_IMPLEMENT_MACRO(double) |
madcowswe | 15:9c5aaeda36dc | 274 | |
madcowswe | 15:9c5aaeda36dc | 275 | #if defined(TVMET_HAVE_LONG_DOUBLE) |
madcowswe | 15:9c5aaeda36dc | 276 | TVMET_IMPLEMENT_MACRO(long double) |
madcowswe | 15:9c5aaeda36dc | 277 | #endif // defined(TVMET_HAVE_LONG_DOUBLE) |
madcowswe | 15:9c5aaeda36dc | 278 | |
madcowswe | 15:9c5aaeda36dc | 279 | #undef TVMET_IMPLEMENT_MACRO |
madcowswe | 15:9c5aaeda36dc | 280 | |
madcowswe | 15:9c5aaeda36dc | 281 | |
madcowswe | 15:9c5aaeda36dc | 282 | /* |
madcowswe | 15:9c5aaeda36dc | 283 | * trinary evaluation functions with vectors, xpr of and complex<> types |
madcowswe | 15:9c5aaeda36dc | 284 | * |
madcowswe | 15:9c5aaeda36dc | 285 | * XprVector<E, Sz> e, std::complex<T> z2, std::complex<T> z3 |
madcowswe | 15:9c5aaeda36dc | 286 | * XprVector<E1, Sz> e1, std::complex<T> z2, XprVector<E3, Sz> e3 |
madcowswe | 15:9c5aaeda36dc | 287 | * XprVector<E1, Sz> e1, XprVector<E2, Sz> e2, std::complex<T> z3 |
madcowswe | 15:9c5aaeda36dc | 288 | */ |
madcowswe | 15:9c5aaeda36dc | 289 | #if defined(TVMET_HAVE_COMPLEX) |
madcowswe | 15:9c5aaeda36dc | 290 | |
madcowswe | 15:9c5aaeda36dc | 291 | |
madcowswe | 15:9c5aaeda36dc | 292 | /** |
madcowswe | 15:9c5aaeda36dc | 293 | * eval(const XprVector<E, Sz>& e, std::complex<T> z2, std::complex<T> z3) |
madcowswe | 15:9c5aaeda36dc | 294 | * \brief Evals the vector expressions. |
madcowswe | 15:9c5aaeda36dc | 295 | * \ingroup _trinary_function |
madcowswe | 15:9c5aaeda36dc | 296 | * This eval is for the a?b:c syntax, since it's not allowed to overload |
madcowswe | 15:9c5aaeda36dc | 297 | * these operators. |
madcowswe | 15:9c5aaeda36dc | 298 | */ |
madcowswe | 15:9c5aaeda36dc | 299 | template<class E, std::size_t Sz, class T> |
madcowswe | 15:9c5aaeda36dc | 300 | inline |
madcowswe | 15:9c5aaeda36dc | 301 | XprVector< |
madcowswe | 15:9c5aaeda36dc | 302 | XprEval< |
madcowswe | 15:9c5aaeda36dc | 303 | XprVector<E, Sz>, |
madcowswe | 15:9c5aaeda36dc | 304 | XprLiteral< std::complex<T> >, |
madcowswe | 15:9c5aaeda36dc | 305 | XprLiteral< std::complex<T> > |
madcowswe | 15:9c5aaeda36dc | 306 | >, |
madcowswe | 15:9c5aaeda36dc | 307 | Sz |
madcowswe | 15:9c5aaeda36dc | 308 | > |
madcowswe | 15:9c5aaeda36dc | 309 | eval(const XprVector<E, Sz>& e, std::complex<T> z2, std::complex<T> z3) { |
madcowswe | 15:9c5aaeda36dc | 310 | typedef XprEval< |
madcowswe | 15:9c5aaeda36dc | 311 | XprVector<E, Sz>, |
madcowswe | 15:9c5aaeda36dc | 312 | XprLiteral< std::complex<T> >, |
madcowswe | 15:9c5aaeda36dc | 313 | XprLiteral< std::complex<T> > |
madcowswe | 15:9c5aaeda36dc | 314 | > expr_type; |
madcowswe | 15:9c5aaeda36dc | 315 | return XprVector<expr_type, Sz>( |
madcowswe | 15:9c5aaeda36dc | 316 | expr_type(e, XprLiteral< std::complex<T> >(z2), XprLiteral< std::complex<T> >(z3))); |
madcowswe | 15:9c5aaeda36dc | 317 | } |
madcowswe | 15:9c5aaeda36dc | 318 | |
madcowswe | 15:9c5aaeda36dc | 319 | /** |
madcowswe | 15:9c5aaeda36dc | 320 | * eval(const XprVector<E1, Sz>& e1, std::complex<T> z2, const XprVector<E3, Sz>& e3) |
madcowswe | 15:9c5aaeda36dc | 321 | * \brief Evals the vector expressions. |
madcowswe | 15:9c5aaeda36dc | 322 | * \ingroup _trinary_function |
madcowswe | 15:9c5aaeda36dc | 323 | * This eval is for the a?b:c syntax, since it's not allowed to overload |
madcowswe | 15:9c5aaeda36dc | 324 | * these operators. |
madcowswe | 15:9c5aaeda36dc | 325 | */ |
madcowswe | 15:9c5aaeda36dc | 326 | template<class E1, class E3, std::size_t Sz, class T> |
madcowswe | 15:9c5aaeda36dc | 327 | inline |
madcowswe | 15:9c5aaeda36dc | 328 | XprVector< |
madcowswe | 15:9c5aaeda36dc | 329 | XprEval< |
madcowswe | 15:9c5aaeda36dc | 330 | XprVector<E1, Sz>, |
madcowswe | 15:9c5aaeda36dc | 331 | XprLiteral< std::complex<T> >, |
madcowswe | 15:9c5aaeda36dc | 332 | XprVector<E3, Sz> |
madcowswe | 15:9c5aaeda36dc | 333 | >, |
madcowswe | 15:9c5aaeda36dc | 334 | Sz |
madcowswe | 15:9c5aaeda36dc | 335 | > |
madcowswe | 15:9c5aaeda36dc | 336 | eval(const XprVector<E1, Sz>& e1, std::complex<T> z2, const XprVector<E3, Sz>& e3) { |
madcowswe | 15:9c5aaeda36dc | 337 | typedef XprEval< |
madcowswe | 15:9c5aaeda36dc | 338 | XprVector<E1, Sz>, |
madcowswe | 15:9c5aaeda36dc | 339 | XprLiteral< std::complex<T> >, |
madcowswe | 15:9c5aaeda36dc | 340 | XprVector<E3, Sz> |
madcowswe | 15:9c5aaeda36dc | 341 | > expr_type; |
madcowswe | 15:9c5aaeda36dc | 342 | return XprVector<expr_type, Sz>( |
madcowswe | 15:9c5aaeda36dc | 343 | expr_type(e1, XprLiteral< std::complex<T> >(z2), e3)); |
madcowswe | 15:9c5aaeda36dc | 344 | } |
madcowswe | 15:9c5aaeda36dc | 345 | |
madcowswe | 15:9c5aaeda36dc | 346 | /** |
madcowswe | 15:9c5aaeda36dc | 347 | * eval(const XprVector<E1, Sz>& e1, const XprVector<E2, Sz>& e2, std::complex<T> z3) |
madcowswe | 15:9c5aaeda36dc | 348 | * \brief Evals the vector expressions. |
madcowswe | 15:9c5aaeda36dc | 349 | * \ingroup _trinary_function |
madcowswe | 15:9c5aaeda36dc | 350 | * This eval is for the a?b:c syntax, since it's not allowed to overload |
madcowswe | 15:9c5aaeda36dc | 351 | * these operators. |
madcowswe | 15:9c5aaeda36dc | 352 | */ |
madcowswe | 15:9c5aaeda36dc | 353 | template<class E1, class E2, std::size_t Sz, class T> |
madcowswe | 15:9c5aaeda36dc | 354 | inline |
madcowswe | 15:9c5aaeda36dc | 355 | XprVector< |
madcowswe | 15:9c5aaeda36dc | 356 | XprEval< |
madcowswe | 15:9c5aaeda36dc | 357 | XprVector<E1, Sz>, |
madcowswe | 15:9c5aaeda36dc | 358 | XprVector<E2, Sz>, |
madcowswe | 15:9c5aaeda36dc | 359 | XprLiteral< std::complex<T> > |
madcowswe | 15:9c5aaeda36dc | 360 | >, |
madcowswe | 15:9c5aaeda36dc | 361 | Sz |
madcowswe | 15:9c5aaeda36dc | 362 | > |
madcowswe | 15:9c5aaeda36dc | 363 | eval(const XprVector<E1, Sz>& e1, const XprVector<E2, Sz>& e2, std::complex<T> z3) { |
madcowswe | 15:9c5aaeda36dc | 364 | typedef XprEval< |
madcowswe | 15:9c5aaeda36dc | 365 | XprVector<E1, Sz>, |
madcowswe | 15:9c5aaeda36dc | 366 | XprVector<E2, Sz>, |
madcowswe | 15:9c5aaeda36dc | 367 | XprLiteral< std::complex<T> > |
madcowswe | 15:9c5aaeda36dc | 368 | > expr_type; |
madcowswe | 15:9c5aaeda36dc | 369 | return XprVector<expr_type, Sz>( |
madcowswe | 15:9c5aaeda36dc | 370 | expr_type(e1, e2, XprLiteral< std::complex<T> >(z3))); |
madcowswe | 15:9c5aaeda36dc | 371 | } |
madcowswe | 15:9c5aaeda36dc | 372 | #endif // defined(TVMET_HAVE_COMPLEX) |
madcowswe | 15:9c5aaeda36dc | 373 | |
madcowswe | 15:9c5aaeda36dc | 374 | |
madcowswe | 15:9c5aaeda36dc | 375 | } // namespace tvmet |
madcowswe | 15:9c5aaeda36dc | 376 | |
madcowswe | 15:9c5aaeda36dc | 377 | #endif // TVMET_VECTOR_EVAL_H |
madcowswe | 15:9c5aaeda36dc | 378 | |
madcowswe | 15:9c5aaeda36dc | 379 | // Local Variables: |
madcowswe | 15:9c5aaeda36dc | 380 | // mode:C++ |
madcowswe | 15:9c5aaeda36dc | 381 | // tab-width:8 |
madcowswe | 15:9c5aaeda36dc | 382 | // End: |