We are going to win! wohoo

Dependencies:   mbed mbed-rtos

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?

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