Eurobot2012_Primary

Dependencies:   mbed Eurobot_2012_Primary

Committer:
narshu
Date:
Wed Oct 17 22:22:47 2012 +0000
Revision:
26:0995f61cb7b8
Parent:
25:143b19c1fb05
Eurobot 2012 Primary;

Who changed what in which revision?

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