This is the Tiny Vector Matrix Expression Templates library found at http://tvmet.sourceforge.net. It is the fastest and most compact matrix lib out there (for < 10x10 matricies). I have done some minor tweaks to make it compile for mbed. For examples and hints on how to use, see: http://tvmet.sourceforge.net/usage.html

Dependents:   Eurobot_2012_Secondary

Committer:
madcowswe
Date:
Wed Mar 28 15:53:45 2012 +0000
Revision:
0:feb4117d16d8

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
madcowswe 0:feb4117d16d8 1 /*
madcowswe 0:feb4117d16d8 2 * Tiny Vector Matrix Library
madcowswe 0:feb4117d16d8 3 * Dense Vector Matrix Libary of Tiny size using Expression Templates
madcowswe 0:feb4117d16d8 4 *
madcowswe 0:feb4117d16d8 5 * Copyright (C) 2001 - 2007 Olaf Petzold <opetzold@users.sourceforge.net>
madcowswe 0:feb4117d16d8 6 *
madcowswe 0:feb4117d16d8 7 * This library is free software; you can redistribute it and/or
madcowswe 0:feb4117d16d8 8 * modify it under the terms of the GNU Lesser General Public
madcowswe 0:feb4117d16d8 9 * License as published by the Free Software Foundation; either
madcowswe 0:feb4117d16d8 10 * version 2.1 of the License, or (at your option) any later version.
madcowswe 0:feb4117d16d8 11 *
madcowswe 0:feb4117d16d8 12 * This library is distributed in the hope that it will be useful,
madcowswe 0:feb4117d16d8 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
madcowswe 0:feb4117d16d8 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
madcowswe 0:feb4117d16d8 15 * Lesser General Public License for more details.
madcowswe 0:feb4117d16d8 16 *
madcowswe 0:feb4117d16d8 17 * You should have received a copy of the GNU Lesser General Public
madcowswe 0:feb4117d16d8 18 * License along with this library; if not, write to the Free Software
madcowswe 0:feb4117d16d8 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
madcowswe 0:feb4117d16d8 20 *
madcowswe 0:feb4117d16d8 21 * $Id: VectorEval.h,v 1.18 2007-06-23 15:58:58 opetzold Exp $
madcowswe 0:feb4117d16d8 22 */
madcowswe 0:feb4117d16d8 23
madcowswe 0:feb4117d16d8 24 #ifndef TVMET_VECTOR_EVAL_H
madcowswe 0:feb4117d16d8 25 #define TVMET_VECTOR_EVAL_H
madcowswe 0:feb4117d16d8 26
madcowswe 0:feb4117d16d8 27 namespace tvmet {
madcowswe 0:feb4117d16d8 28
madcowswe 0:feb4117d16d8 29
madcowswe 0:feb4117d16d8 30 /********************************************************************
madcowswe 0:feb4117d16d8 31 * functions all_elements/any_elements
madcowswe 0:feb4117d16d8 32 ********************************************************************/
madcowswe 0:feb4117d16d8 33
madcowswe 0:feb4117d16d8 34
madcowswe 0:feb4117d16d8 35 /**
madcowswe 0:feb4117d16d8 36 * \fn bool all_elements(const XprVector<E, Sz>& e)
madcowswe 0:feb4117d16d8 37 * \brief check on statements for all elements
madcowswe 0:feb4117d16d8 38 * \ingroup _unary_function
madcowswe 0:feb4117d16d8 39 * This is for use with boolean operators like
madcowswe 0:feb4117d16d8 40 * \par Example:
madcowswe 0:feb4117d16d8 41 * \code
madcowswe 0:feb4117d16d8 42 * all_elements(vector > 0) {
madcowswe 0:feb4117d16d8 43 * // true branch
madcowswe 0:feb4117d16d8 44 * } else {
madcowswe 0:feb4117d16d8 45 * // false branch
madcowswe 0:feb4117d16d8 46 * }
madcowswe 0:feb4117d16d8 47 * \endcode
madcowswe 0:feb4117d16d8 48 * \sa \ref compare
madcowswe 0:feb4117d16d8 49 */
madcowswe 0:feb4117d16d8 50 template<class E, std::size_t Sz>
madcowswe 0:feb4117d16d8 51 inline
madcowswe 0:feb4117d16d8 52 bool all_elements(const XprVector<E, Sz>& e) {
madcowswe 0:feb4117d16d8 53 return meta::Vector<Sz>::all_elements(e);
madcowswe 0:feb4117d16d8 54 }
madcowswe 0:feb4117d16d8 55
madcowswe 0:feb4117d16d8 56
madcowswe 0:feb4117d16d8 57 /**
madcowswe 0:feb4117d16d8 58 * \fn bool any_elements(const XprVector<E, Sz>& e)
madcowswe 0:feb4117d16d8 59 * \brief check on statements for any elements
madcowswe 0:feb4117d16d8 60 * \ingroup _unary_function
madcowswe 0:feb4117d16d8 61 * This is for use with boolean operators like
madcowswe 0:feb4117d16d8 62 * \par Example:
madcowswe 0:feb4117d16d8 63 * \code
madcowswe 0:feb4117d16d8 64 * any_elements(vector > 0) {
madcowswe 0:feb4117d16d8 65 * // true branch
madcowswe 0:feb4117d16d8 66 * } else {
madcowswe 0:feb4117d16d8 67 * // false branch
madcowswe 0:feb4117d16d8 68 * }
madcowswe 0:feb4117d16d8 69 * \endcode
madcowswe 0:feb4117d16d8 70 * \sa \ref compare
madcowswe 0:feb4117d16d8 71 */
madcowswe 0:feb4117d16d8 72 template<class E, std::size_t Sz>
madcowswe 0:feb4117d16d8 73 inline
madcowswe 0:feb4117d16d8 74 bool any_elements(const XprVector<E, Sz>& e) {
madcowswe 0:feb4117d16d8 75 return meta::Vector<Sz>::any_elements(e);
madcowswe 0:feb4117d16d8 76 }
madcowswe 0:feb4117d16d8 77
madcowswe 0:feb4117d16d8 78
madcowswe 0:feb4117d16d8 79 /*
madcowswe 0:feb4117d16d8 80 * trinary evaluation functions with vectors and xpr of
madcowswe 0:feb4117d16d8 81 * XprVector<E1, Sz> ? Vector<T2, Sz> : Vector<T3, Sz>
madcowswe 0:feb4117d16d8 82 * XprVector<E1, Sz> ? Vector<T2, Sz> : XprVector<E3, Sz>
madcowswe 0:feb4117d16d8 83 * XprVector<E1, Sz> ? XprVector<E2, Sz> : Vector<T3, Sz>
madcowswe 0:feb4117d16d8 84 * XprVector<E1, Sz> ? XprVector<E2, Sz> : XprVector<E3, Sz>
madcowswe 0:feb4117d16d8 85 */
madcowswe 0:feb4117d16d8 86
madcowswe 0:feb4117d16d8 87 /**
madcowswe 0:feb4117d16d8 88 * eval(const XprVector<E1, Sz>& e1, const Vector<T2, Sz>& v2, const Vector<T3, Sz>& v3)
madcowswe 0:feb4117d16d8 89 * \brief Evals the vector expressions.
madcowswe 0:feb4117d16d8 90 * \ingroup _trinary_function
madcowswe 0:feb4117d16d8 91 * This eval is for the a?b:c syntax, since it's not allowed to overload
madcowswe 0:feb4117d16d8 92 * these operators.
madcowswe 0:feb4117d16d8 93 */
madcowswe 0:feb4117d16d8 94 template<class E1, class T2, class T3, std::size_t Sz>
madcowswe 0:feb4117d16d8 95 inline
madcowswe 0:feb4117d16d8 96 XprVector<
madcowswe 0:feb4117d16d8 97 XprEval<
madcowswe 0:feb4117d16d8 98 XprVector<E1, Sz>,
madcowswe 0:feb4117d16d8 99 VectorConstReference<T2, Sz>,
madcowswe 0:feb4117d16d8 100 VectorConstReference<T3, Sz>
madcowswe 0:feb4117d16d8 101 >,
madcowswe 0:feb4117d16d8 102 Sz
madcowswe 0:feb4117d16d8 103 >
madcowswe 0:feb4117d16d8 104 eval(const XprVector<E1, Sz>& e1, const Vector<T2, Sz>& v2, const Vector<T3, Sz>& v3) {
madcowswe 0:feb4117d16d8 105 typedef XprEval<
madcowswe 0:feb4117d16d8 106 XprVector<E1, Sz>,
madcowswe 0:feb4117d16d8 107 VectorConstReference<T2, Sz>,
madcowswe 0:feb4117d16d8 108 VectorConstReference<T3, Sz>
madcowswe 0:feb4117d16d8 109 > expr_type;
madcowswe 0:feb4117d16d8 110 return XprVector<expr_type, Sz>(
madcowswe 0:feb4117d16d8 111 expr_type(e1, v2.const_ref(), v3.const_ref()));
madcowswe 0:feb4117d16d8 112 }
madcowswe 0:feb4117d16d8 113
madcowswe 0:feb4117d16d8 114
madcowswe 0:feb4117d16d8 115 /**
madcowswe 0:feb4117d16d8 116 * eval(const XprVector<E1, Sz>& e1, const Vector<T2, Sz>& v2, const XprVector<E3, Sz>& e3)
madcowswe 0:feb4117d16d8 117 * \brief Evals the vector expressions.
madcowswe 0:feb4117d16d8 118 * \ingroup _trinary_function
madcowswe 0:feb4117d16d8 119 * This eval is for the a?b:c syntax, since it's not allowed to overload
madcowswe 0:feb4117d16d8 120 * these operators.
madcowswe 0:feb4117d16d8 121 */
madcowswe 0:feb4117d16d8 122 template<class E1, class T2, class E3, std::size_t Sz>
madcowswe 0:feb4117d16d8 123 inline
madcowswe 0:feb4117d16d8 124 XprVector<
madcowswe 0:feb4117d16d8 125 XprEval<
madcowswe 0:feb4117d16d8 126 XprVector<E1, Sz>,
madcowswe 0:feb4117d16d8 127 VectorConstReference<T2, Sz>,
madcowswe 0:feb4117d16d8 128 XprVector<E3, Sz>
madcowswe 0:feb4117d16d8 129 >,
madcowswe 0:feb4117d16d8 130 Sz
madcowswe 0:feb4117d16d8 131 >
madcowswe 0:feb4117d16d8 132 eval(const XprVector<E1, Sz>& e1, const Vector<T2, Sz>& v2, const XprVector<E3, Sz>& e3) {
madcowswe 0:feb4117d16d8 133 typedef XprEval<
madcowswe 0:feb4117d16d8 134 XprVector<E1, Sz>,
madcowswe 0:feb4117d16d8 135 VectorConstReference<T2, Sz>,
madcowswe 0:feb4117d16d8 136 XprVector<E3, Sz>
madcowswe 0:feb4117d16d8 137 > expr_type;
madcowswe 0:feb4117d16d8 138 return XprVector<expr_type, Sz>(
madcowswe 0:feb4117d16d8 139 expr_type(e1, v2.const_ref(), e3));
madcowswe 0:feb4117d16d8 140 }
madcowswe 0:feb4117d16d8 141
madcowswe 0:feb4117d16d8 142
madcowswe 0:feb4117d16d8 143 /**
madcowswe 0:feb4117d16d8 144 * eval(const XprVector<E1, Sz>& e1, const XprVector<E2, Sz>& e2, const Vector<T3, Sz>& v3)
madcowswe 0:feb4117d16d8 145 * \brief Evals the vector expressions.
madcowswe 0:feb4117d16d8 146 * \ingroup _trinary_function
madcowswe 0:feb4117d16d8 147 * This eval is for the a?b:c syntax, since it's not allowed to overload
madcowswe 0:feb4117d16d8 148 * these operators.
madcowswe 0:feb4117d16d8 149 */
madcowswe 0:feb4117d16d8 150 template<class E1, class E2, class T3, std::size_t Sz>
madcowswe 0:feb4117d16d8 151 inline
madcowswe 0:feb4117d16d8 152 XprVector<
madcowswe 0:feb4117d16d8 153 XprEval<
madcowswe 0:feb4117d16d8 154 XprVector<E1, Sz>,
madcowswe 0:feb4117d16d8 155 XprVector<E2, Sz>,
madcowswe 0:feb4117d16d8 156 VectorConstReference<T3, Sz>
madcowswe 0:feb4117d16d8 157 >,
madcowswe 0:feb4117d16d8 158 Sz
madcowswe 0:feb4117d16d8 159 >
madcowswe 0:feb4117d16d8 160 eval(const XprVector<E1, Sz>& e1, const XprVector<E2, Sz>& e2, const Vector<T3, Sz>& v3) {
madcowswe 0:feb4117d16d8 161 typedef XprEval<
madcowswe 0:feb4117d16d8 162 XprVector<E1, Sz>,
madcowswe 0:feb4117d16d8 163 XprVector<E2, Sz>,
madcowswe 0:feb4117d16d8 164 VectorConstReference<T3, Sz>
madcowswe 0:feb4117d16d8 165 > expr_type;
madcowswe 0:feb4117d16d8 166 return XprVector<expr_type, Sz>(
madcowswe 0:feb4117d16d8 167 expr_type(e1, e2, v3.const_ref()));
madcowswe 0:feb4117d16d8 168 }
madcowswe 0:feb4117d16d8 169
madcowswe 0:feb4117d16d8 170
madcowswe 0:feb4117d16d8 171 /**
madcowswe 0:feb4117d16d8 172 * eval(const XprVector<E1, Sz>& e1, const XprVector<E2, Sz>& e2, const XprVector<E3, Sz>& e3)
madcowswe 0:feb4117d16d8 173 * \brief Evals the vector expressions.
madcowswe 0:feb4117d16d8 174 * \ingroup _trinary_function
madcowswe 0:feb4117d16d8 175 * This eval is for the a?b:c syntax, since it's not allowed to overload
madcowswe 0:feb4117d16d8 176 * these operators.
madcowswe 0:feb4117d16d8 177 */
madcowswe 0:feb4117d16d8 178 template<class E1, class E2, class E3, std::size_t Sz>
madcowswe 0:feb4117d16d8 179 inline
madcowswe 0:feb4117d16d8 180 XprVector<
madcowswe 0:feb4117d16d8 181 XprEval<
madcowswe 0:feb4117d16d8 182 XprVector<E1, Sz>,
madcowswe 0:feb4117d16d8 183 XprVector<E2, Sz>,
madcowswe 0:feb4117d16d8 184 XprVector<E3, Sz>
madcowswe 0:feb4117d16d8 185 >,
madcowswe 0:feb4117d16d8 186 Sz
madcowswe 0:feb4117d16d8 187 >
madcowswe 0:feb4117d16d8 188 eval(const XprVector<E1, Sz>& e1, const XprVector<E2, Sz>& e2, const XprVector<E3, Sz>& e3) {
madcowswe 0:feb4117d16d8 189 typedef XprEval<
madcowswe 0:feb4117d16d8 190 XprVector<E1, Sz>,
madcowswe 0:feb4117d16d8 191 XprVector<E2, Sz>,
madcowswe 0:feb4117d16d8 192 XprVector<E3, Sz>
madcowswe 0:feb4117d16d8 193 > expr_type;
madcowswe 0:feb4117d16d8 194 return XprVector<expr_type, Sz>(expr_type(e1, e2, e3));
madcowswe 0:feb4117d16d8 195 }
madcowswe 0:feb4117d16d8 196
madcowswe 0:feb4117d16d8 197
madcowswe 0:feb4117d16d8 198 /*
madcowswe 0:feb4117d16d8 199 * trinary evaluation functions with vectors, xpr of and POD
madcowswe 0:feb4117d16d8 200 *
madcowswe 0:feb4117d16d8 201 * XprVector<E, Sz> ? POD1 : POD2
madcowswe 0:feb4117d16d8 202 * XprVector<E1, Sz> ? POD : XprVector<E3, Sz>
madcowswe 0:feb4117d16d8 203 * XprVector<E1, Sz> ? XprVector<E2, Sz> : POD
madcowswe 0:feb4117d16d8 204 */
madcowswe 0:feb4117d16d8 205 #define TVMET_IMPLEMENT_MACRO(POD) \
madcowswe 0:feb4117d16d8 206 template<class E, std::size_t Sz> \
madcowswe 0:feb4117d16d8 207 inline \
madcowswe 0:feb4117d16d8 208 XprVector< \
madcowswe 0:feb4117d16d8 209 XprEval< \
madcowswe 0:feb4117d16d8 210 XprVector<E, Sz>, \
madcowswe 0:feb4117d16d8 211 XprLiteral< POD >, \
madcowswe 0:feb4117d16d8 212 XprLiteral< POD > \
madcowswe 0:feb4117d16d8 213 >, \
madcowswe 0:feb4117d16d8 214 Sz \
madcowswe 0:feb4117d16d8 215 > \
madcowswe 0:feb4117d16d8 216 eval(const XprVector<E, Sz>& e, POD x2, POD x3) { \
madcowswe 0:feb4117d16d8 217 typedef XprEval< \
madcowswe 0:feb4117d16d8 218 XprVector<E, Sz>, \
madcowswe 0:feb4117d16d8 219 XprLiteral< POD >, \
madcowswe 0:feb4117d16d8 220 XprLiteral< POD > \
madcowswe 0:feb4117d16d8 221 > expr_type; \
madcowswe 0:feb4117d16d8 222 return XprVector<expr_type, Sz>( \
madcowswe 0:feb4117d16d8 223 expr_type(e, XprLiteral< POD >(x2), XprLiteral< POD >(x3))); \
madcowswe 0:feb4117d16d8 224 } \
madcowswe 0:feb4117d16d8 225 \
madcowswe 0:feb4117d16d8 226 template<class E1, class E3, std::size_t Sz> \
madcowswe 0:feb4117d16d8 227 inline \
madcowswe 0:feb4117d16d8 228 XprVector< \
madcowswe 0:feb4117d16d8 229 XprEval< \
madcowswe 0:feb4117d16d8 230 XprVector<E1, Sz>, \
madcowswe 0:feb4117d16d8 231 XprLiteral< POD >, \
madcowswe 0:feb4117d16d8 232 XprVector<E3, Sz> \
madcowswe 0:feb4117d16d8 233 >, \
madcowswe 0:feb4117d16d8 234 Sz \
madcowswe 0:feb4117d16d8 235 > \
madcowswe 0:feb4117d16d8 236 eval(const XprVector<E1, Sz>& e1, POD x2, const XprVector<E3, Sz>& e3) { \
madcowswe 0:feb4117d16d8 237 typedef XprEval< \
madcowswe 0:feb4117d16d8 238 XprVector<E1, Sz>, \
madcowswe 0:feb4117d16d8 239 XprLiteral< POD >, \
madcowswe 0:feb4117d16d8 240 XprVector<E3, Sz> \
madcowswe 0:feb4117d16d8 241 > expr_type; \
madcowswe 0:feb4117d16d8 242 return XprVector<expr_type, Sz>( \
madcowswe 0:feb4117d16d8 243 expr_type(e1, XprLiteral< POD >(x2), e3)); \
madcowswe 0:feb4117d16d8 244 } \
madcowswe 0:feb4117d16d8 245 \
madcowswe 0:feb4117d16d8 246 template<class E1, class E2, std::size_t Sz> \
madcowswe 0:feb4117d16d8 247 inline \
madcowswe 0:feb4117d16d8 248 XprVector< \
madcowswe 0:feb4117d16d8 249 XprEval< \
madcowswe 0:feb4117d16d8 250 XprVector<E1, Sz>, \
madcowswe 0:feb4117d16d8 251 XprVector<E2, Sz>, \
madcowswe 0:feb4117d16d8 252 XprLiteral< POD > \
madcowswe 0:feb4117d16d8 253 >, \
madcowswe 0:feb4117d16d8 254 Sz \
madcowswe 0:feb4117d16d8 255 > \
madcowswe 0:feb4117d16d8 256 eval(const XprVector<E1, Sz>& e1, const XprVector<E2, Sz>& e2, POD x3) { \
madcowswe 0:feb4117d16d8 257 typedef XprEval< \
madcowswe 0:feb4117d16d8 258 XprVector<E1, Sz>, \
madcowswe 0:feb4117d16d8 259 XprVector<E2, Sz>, \
madcowswe 0:feb4117d16d8 260 XprLiteral< POD > \
madcowswe 0:feb4117d16d8 261 > expr_type; \
madcowswe 0:feb4117d16d8 262 return XprVector<expr_type, Sz>( \
madcowswe 0:feb4117d16d8 263 expr_type(e1, e2, XprLiteral< POD >(x3))); \
madcowswe 0:feb4117d16d8 264 }
madcowswe 0:feb4117d16d8 265
madcowswe 0:feb4117d16d8 266 TVMET_IMPLEMENT_MACRO(int)
madcowswe 0:feb4117d16d8 267
madcowswe 0:feb4117d16d8 268 #if defined(TVMET_HAVE_LONG_LONG)
madcowswe 0:feb4117d16d8 269 TVMET_IMPLEMENT_MACRO(long long int)
madcowswe 0:feb4117d16d8 270 #endif // defined(TVMET_HAVE_LONG_LONG)
madcowswe 0:feb4117d16d8 271
madcowswe 0:feb4117d16d8 272 TVMET_IMPLEMENT_MACRO(float)
madcowswe 0:feb4117d16d8 273 TVMET_IMPLEMENT_MACRO(double)
madcowswe 0:feb4117d16d8 274
madcowswe 0:feb4117d16d8 275 #if defined(TVMET_HAVE_LONG_DOUBLE)
madcowswe 0:feb4117d16d8 276 TVMET_IMPLEMENT_MACRO(long double)
madcowswe 0:feb4117d16d8 277 #endif // defined(TVMET_HAVE_LONG_DOUBLE)
madcowswe 0:feb4117d16d8 278
madcowswe 0:feb4117d16d8 279 #undef TVMET_IMPLEMENT_MACRO
madcowswe 0:feb4117d16d8 280
madcowswe 0:feb4117d16d8 281
madcowswe 0:feb4117d16d8 282 /*
madcowswe 0:feb4117d16d8 283 * trinary evaluation functions with vectors, xpr of and complex<> types
madcowswe 0:feb4117d16d8 284 *
madcowswe 0:feb4117d16d8 285 * XprVector<E, Sz> e, std::complex<T> z2, std::complex<T> z3
madcowswe 0:feb4117d16d8 286 * XprVector<E1, Sz> e1, std::complex<T> z2, XprVector<E3, Sz> e3
madcowswe 0:feb4117d16d8 287 * XprVector<E1, Sz> e1, XprVector<E2, Sz> e2, std::complex<T> z3
madcowswe 0:feb4117d16d8 288 */
madcowswe 0:feb4117d16d8 289 #if defined(TVMET_HAVE_COMPLEX)
madcowswe 0:feb4117d16d8 290
madcowswe 0:feb4117d16d8 291
madcowswe 0:feb4117d16d8 292 /**
madcowswe 0:feb4117d16d8 293 * eval(const XprVector<E, Sz>& e, std::complex<T> z2, std::complex<T> z3)
madcowswe 0:feb4117d16d8 294 * \brief Evals the vector expressions.
madcowswe 0:feb4117d16d8 295 * \ingroup _trinary_function
madcowswe 0:feb4117d16d8 296 * This eval is for the a?b:c syntax, since it's not allowed to overload
madcowswe 0:feb4117d16d8 297 * these operators.
madcowswe 0:feb4117d16d8 298 */
madcowswe 0:feb4117d16d8 299 template<class E, std::size_t Sz, class T>
madcowswe 0:feb4117d16d8 300 inline
madcowswe 0:feb4117d16d8 301 XprVector<
madcowswe 0:feb4117d16d8 302 XprEval<
madcowswe 0:feb4117d16d8 303 XprVector<E, Sz>,
madcowswe 0:feb4117d16d8 304 XprLiteral< std::complex<T> >,
madcowswe 0:feb4117d16d8 305 XprLiteral< std::complex<T> >
madcowswe 0:feb4117d16d8 306 >,
madcowswe 0:feb4117d16d8 307 Sz
madcowswe 0:feb4117d16d8 308 >
madcowswe 0:feb4117d16d8 309 eval(const XprVector<E, Sz>& e, std::complex<T> z2, std::complex<T> z3) {
madcowswe 0:feb4117d16d8 310 typedef XprEval<
madcowswe 0:feb4117d16d8 311 XprVector<E, Sz>,
madcowswe 0:feb4117d16d8 312 XprLiteral< std::complex<T> >,
madcowswe 0:feb4117d16d8 313 XprLiteral< std::complex<T> >
madcowswe 0:feb4117d16d8 314 > expr_type;
madcowswe 0:feb4117d16d8 315 return XprVector<expr_type, Sz>(
madcowswe 0:feb4117d16d8 316 expr_type(e, XprLiteral< std::complex<T> >(z2), XprLiteral< std::complex<T> >(z3)));
madcowswe 0:feb4117d16d8 317 }
madcowswe 0:feb4117d16d8 318
madcowswe 0:feb4117d16d8 319 /**
madcowswe 0:feb4117d16d8 320 * eval(const XprVector<E1, Sz>& e1, std::complex<T> z2, const XprVector<E3, Sz>& e3)
madcowswe 0:feb4117d16d8 321 * \brief Evals the vector expressions.
madcowswe 0:feb4117d16d8 322 * \ingroup _trinary_function
madcowswe 0:feb4117d16d8 323 * This eval is for the a?b:c syntax, since it's not allowed to overload
madcowswe 0:feb4117d16d8 324 * these operators.
madcowswe 0:feb4117d16d8 325 */
madcowswe 0:feb4117d16d8 326 template<class E1, class E3, std::size_t Sz, class T>
madcowswe 0:feb4117d16d8 327 inline
madcowswe 0:feb4117d16d8 328 XprVector<
madcowswe 0:feb4117d16d8 329 XprEval<
madcowswe 0:feb4117d16d8 330 XprVector<E1, Sz>,
madcowswe 0:feb4117d16d8 331 XprLiteral< std::complex<T> >,
madcowswe 0:feb4117d16d8 332 XprVector<E3, Sz>
madcowswe 0:feb4117d16d8 333 >,
madcowswe 0:feb4117d16d8 334 Sz
madcowswe 0:feb4117d16d8 335 >
madcowswe 0:feb4117d16d8 336 eval(const XprVector<E1, Sz>& e1, std::complex<T> z2, const XprVector<E3, Sz>& e3) {
madcowswe 0:feb4117d16d8 337 typedef XprEval<
madcowswe 0:feb4117d16d8 338 XprVector<E1, Sz>,
madcowswe 0:feb4117d16d8 339 XprLiteral< std::complex<T> >,
madcowswe 0:feb4117d16d8 340 XprVector<E3, Sz>
madcowswe 0:feb4117d16d8 341 > expr_type;
madcowswe 0:feb4117d16d8 342 return XprVector<expr_type, Sz>(
madcowswe 0:feb4117d16d8 343 expr_type(e1, XprLiteral< std::complex<T> >(z2), e3));
madcowswe 0:feb4117d16d8 344 }
madcowswe 0:feb4117d16d8 345
madcowswe 0:feb4117d16d8 346 /**
madcowswe 0:feb4117d16d8 347 * eval(const XprVector<E1, Sz>& e1, const XprVector<E2, Sz>& e2, std::complex<T> z3)
madcowswe 0:feb4117d16d8 348 * \brief Evals the vector expressions.
madcowswe 0:feb4117d16d8 349 * \ingroup _trinary_function
madcowswe 0:feb4117d16d8 350 * This eval is for the a?b:c syntax, since it's not allowed to overload
madcowswe 0:feb4117d16d8 351 * these operators.
madcowswe 0:feb4117d16d8 352 */
madcowswe 0:feb4117d16d8 353 template<class E1, class E2, std::size_t Sz, class T>
madcowswe 0:feb4117d16d8 354 inline
madcowswe 0:feb4117d16d8 355 XprVector<
madcowswe 0:feb4117d16d8 356 XprEval<
madcowswe 0:feb4117d16d8 357 XprVector<E1, Sz>,
madcowswe 0:feb4117d16d8 358 XprVector<E2, Sz>,
madcowswe 0:feb4117d16d8 359 XprLiteral< std::complex<T> >
madcowswe 0:feb4117d16d8 360 >,
madcowswe 0:feb4117d16d8 361 Sz
madcowswe 0:feb4117d16d8 362 >
madcowswe 0:feb4117d16d8 363 eval(const XprVector<E1, Sz>& e1, const XprVector<E2, Sz>& e2, std::complex<T> z3) {
madcowswe 0:feb4117d16d8 364 typedef XprEval<
madcowswe 0:feb4117d16d8 365 XprVector<E1, Sz>,
madcowswe 0:feb4117d16d8 366 XprVector<E2, Sz>,
madcowswe 0:feb4117d16d8 367 XprLiteral< std::complex<T> >
madcowswe 0:feb4117d16d8 368 > expr_type;
madcowswe 0:feb4117d16d8 369 return XprVector<expr_type, Sz>(
madcowswe 0:feb4117d16d8 370 expr_type(e1, e2, XprLiteral< std::complex<T> >(z3)));
madcowswe 0:feb4117d16d8 371 }
madcowswe 0:feb4117d16d8 372 #endif // defined(TVMET_HAVE_COMPLEX)
madcowswe 0:feb4117d16d8 373
madcowswe 0:feb4117d16d8 374
madcowswe 0:feb4117d16d8 375 } // namespace tvmet
madcowswe 0:feb4117d16d8 376
madcowswe 0:feb4117d16d8 377 #endif // TVMET_VECTOR_EVAL_H
madcowswe 0:feb4117d16d8 378
madcowswe 0:feb4117d16d8 379 // Local Variables:
madcowswe 0:feb4117d16d8 380 // mode:C++
madcowswe 0:feb4117d16d8 381 // tab-width:8
madcowswe 0:feb4117d16d8 382 // End: