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