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: MatrixOperators.h,v 1.37 2007-06-23 15:58:58 opetzold Exp $
sv 1:6799c07fe510 22 */
sv 1:6799c07fe510 23
sv 1:6799c07fe510 24 #ifndef TVMET_MATRIX_OPERATORS_H
sv 1:6799c07fe510 25 #define TVMET_MATRIX_OPERATORS_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 * PART I: DECLARATION
sv 1:6799c07fe510 32 *********************************************************/
sv 1:6799c07fe510 33
sv 1:6799c07fe510 34
sv 1:6799c07fe510 35 template<class T, std::size_t Rows, std::size_t Cols>
sv 1:6799c07fe510 36 std::ostream& operator<<(std::ostream& os,
sv 1:6799c07fe510 37 const Matrix<T, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 38
sv 1:6799c07fe510 39
sv 1:6799c07fe510 40 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sv 1:6799c07fe510 41 * Member operators (arithmetic and bit ops)
sv 1:6799c07fe510 42 *++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
sv 1:6799c07fe510 43
sv 1:6799c07fe510 44
sv 1:6799c07fe510 45 /*
sv 1:6799c07fe510 46 * update_operator(Matrix<T1, Rows, Cols>, Matrix<T2, Rows, Cols>)
sv 1:6799c07fe510 47 * update_operator(Matrix<T1, Rows, Cols>, XprMatrix<E, Rows, Cols> rhs)
sv 1:6799c07fe510 48 * Note: per se element wise
sv 1:6799c07fe510 49 * \todo: the operator*= can have element wise mul oder product, decide!
sv 1:6799c07fe510 50 */
sv 1:6799c07fe510 51 #define TVMET_DECLARE_MACRO(NAME, OP) \
sv 1:6799c07fe510 52 template<class T1, class T2, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 53 Matrix<T1, Rows, Cols>& \
sv 1:6799c07fe510 54 operator OP (Matrix<T1, Rows, Cols>& lhs, \
sv 1:6799c07fe510 55 const Matrix<T2, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE; \
sv 1:6799c07fe510 56 \
sv 1:6799c07fe510 57 template<class T, class E, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 58 Matrix<T, Rows, Cols>& \
sv 1:6799c07fe510 59 operator OP (Matrix<T, Rows, Cols>& lhs, \
sv 1:6799c07fe510 60 const XprMatrix<E, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 61
sv 1:6799c07fe510 62 TVMET_DECLARE_MACRO(add_eq, +=) // per se element wise
sv 1:6799c07fe510 63 TVMET_DECLARE_MACRO(sub_eq, -=) // per se element wise
sv 1:6799c07fe510 64 namespace element_wise {
sv 1:6799c07fe510 65 TVMET_DECLARE_MACRO(mul_eq, *=) // see note
sv 1:6799c07fe510 66 TVMET_DECLARE_MACRO(div_eq, /=) // not defined for vectors
sv 1:6799c07fe510 67 }
sv 1:6799c07fe510 68
sv 1:6799c07fe510 69 // integer operators only, e.g used on double you wil get an error
sv 1:6799c07fe510 70 namespace element_wise {
sv 1:6799c07fe510 71 TVMET_DECLARE_MACRO(mod_eq, %=)
sv 1:6799c07fe510 72 TVMET_DECLARE_MACRO(xor_eq, ^=)
sv 1:6799c07fe510 73 TVMET_DECLARE_MACRO(and_eq, &=)
sv 1:6799c07fe510 74 TVMET_DECLARE_MACRO(or_eq, |=)
sv 1:6799c07fe510 75 TVMET_DECLARE_MACRO(shl_eq, <<=)
sv 1:6799c07fe510 76 TVMET_DECLARE_MACRO(shr_eq, >>=)
sv 1:6799c07fe510 77 }
sv 1:6799c07fe510 78
sv 1:6799c07fe510 79 #undef TVMET_DECLARE_MACRO
sv 1:6799c07fe510 80
sv 1:6799c07fe510 81
sv 1:6799c07fe510 82 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sv 1:6799c07fe510 83 * Matrix arithmetic operators implemented by functions
sv 1:6799c07fe510 84 * add, sub, mul and div
sv 1:6799c07fe510 85 *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
sv 1:6799c07fe510 86
sv 1:6799c07fe510 87
sv 1:6799c07fe510 88 /*
sv 1:6799c07fe510 89 * operator(Matrix<T1, Rows, Cols>, Matrix<T2, Rows, Cols>)
sv 1:6799c07fe510 90 * operator(XprMatrix<E, Rows, Cols>, Matrix<T, Rows, Cols>)
sv 1:6799c07fe510 91 * operator(Matrix<T, Rows, Cols>, XprMatrix<E, Rows, Cols>)
sv 1:6799c07fe510 92 * Note: per se element wise
sv 1:6799c07fe510 93 */
sv 1:6799c07fe510 94 #define TVMET_DECLARE_MACRO(NAME, OP) \
sv 1:6799c07fe510 95 template<class T1, class T2, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 96 XprMatrix< \
sv 1:6799c07fe510 97 XprBinOp< \
sv 1:6799c07fe510 98 Fcnl_##NAME<T1, T2>, \
sv 1:6799c07fe510 99 MatrixConstReference<T1, Rows, Cols>, \
sv 1:6799c07fe510 100 MatrixConstReference<T2, Rows, Cols> \
sv 1:6799c07fe510 101 >, \
sv 1:6799c07fe510 102 Rows, Cols \
sv 1:6799c07fe510 103 > \
sv 1:6799c07fe510 104 operator OP (const Matrix<T1, Rows, Cols>& lhs, \
sv 1:6799c07fe510 105 const Matrix<T2, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE; \
sv 1:6799c07fe510 106 \
sv 1:6799c07fe510 107 template<class E, class T, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 108 XprMatrix< \
sv 1:6799c07fe510 109 XprBinOp< \
sv 1:6799c07fe510 110 Fcnl_##NAME<typename E::value_type, T>, \
sv 1:6799c07fe510 111 XprMatrix<E, Rows, Cols>, \
sv 1:6799c07fe510 112 MatrixConstReference<T, Rows, Cols> \
sv 1:6799c07fe510 113 >, \
sv 1:6799c07fe510 114 Rows, Cols \
sv 1:6799c07fe510 115 > \
sv 1:6799c07fe510 116 operator OP (const XprMatrix<E, Rows, Cols>& lhs, \
sv 1:6799c07fe510 117 const Matrix<T, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE; \
sv 1:6799c07fe510 118 \
sv 1:6799c07fe510 119 template<class T, class E, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 120 XprMatrix< \
sv 1:6799c07fe510 121 XprBinOp< \
sv 1:6799c07fe510 122 Fcnl_##NAME<typename E::value_type, T>, \
sv 1:6799c07fe510 123 MatrixConstReference<T, Rows, Cols>, \
sv 1:6799c07fe510 124 XprMatrix<E, Rows, Cols> \
sv 1:6799c07fe510 125 >, \
sv 1:6799c07fe510 126 Rows, Cols \
sv 1:6799c07fe510 127 > \
sv 1:6799c07fe510 128 operator OP (const Matrix<T, Rows, Cols>& lhs, \
sv 1:6799c07fe510 129 const XprMatrix<E, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 130
sv 1:6799c07fe510 131 TVMET_DECLARE_MACRO(add, +) // per se element wise
sv 1:6799c07fe510 132 TVMET_DECLARE_MACRO(sub, -) // per se element wise
sv 1:6799c07fe510 133 namespace element_wise {
sv 1:6799c07fe510 134 TVMET_DECLARE_MACRO(mul, *) // see as prod()
sv 1:6799c07fe510 135 TVMET_DECLARE_MACRO(div, /) // not defined for matrizes
sv 1:6799c07fe510 136 }
sv 1:6799c07fe510 137 #undef TVMET_DECLARE_MACRO
sv 1:6799c07fe510 138
sv 1:6799c07fe510 139
sv 1:6799c07fe510 140 /*
sv 1:6799c07fe510 141 * operator(Matrix<T, Rows, Cols>, POD)
sv 1:6799c07fe510 142 * operator(POD, Matrix<T, Rows, Cols>)
sv 1:6799c07fe510 143 * Note: operations +,-,*,/ are per se element wise
sv 1:6799c07fe510 144 */
sv 1:6799c07fe510 145 #define TVMET_DECLARE_MACRO(NAME, OP, POD) \
sv 1:6799c07fe510 146 template<class T, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 147 XprMatrix< \
sv 1:6799c07fe510 148 XprBinOp< \
sv 1:6799c07fe510 149 Fcnl_##NAME<T, POD >, \
sv 1:6799c07fe510 150 MatrixConstReference<T, Rows, Cols>, \
sv 1:6799c07fe510 151 XprLiteral<POD > \
sv 1:6799c07fe510 152 >, \
sv 1:6799c07fe510 153 Rows, Cols \
sv 1:6799c07fe510 154 > \
sv 1:6799c07fe510 155 operator OP (const Matrix<T, Rows, Cols>& lhs, \
sv 1:6799c07fe510 156 POD rhs) TVMET_CXX_ALWAYS_INLINE; \
sv 1:6799c07fe510 157 \
sv 1:6799c07fe510 158 template<class T, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 159 XprMatrix< \
sv 1:6799c07fe510 160 XprBinOp< \
sv 1:6799c07fe510 161 Fcnl_##NAME< POD, T>, \
sv 1:6799c07fe510 162 XprLiteral< POD >, \
sv 1:6799c07fe510 163 MatrixConstReference<T, Rows, Cols> \
sv 1:6799c07fe510 164 >, \
sv 1:6799c07fe510 165 Rows, Cols \
sv 1:6799c07fe510 166 > \
sv 1:6799c07fe510 167 operator OP (POD lhs, \
sv 1:6799c07fe510 168 const Matrix<T, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 169
sv 1:6799c07fe510 170 TVMET_DECLARE_MACRO(add, +, int)
sv 1:6799c07fe510 171 TVMET_DECLARE_MACRO(sub, -, int)
sv 1:6799c07fe510 172 TVMET_DECLARE_MACRO(mul, *, int)
sv 1:6799c07fe510 173 TVMET_DECLARE_MACRO(div, /, int)
sv 1:6799c07fe510 174
sv 1:6799c07fe510 175 #if defined(TVMET_HAVE_LONG_LONG)
sv 1:6799c07fe510 176 TVMET_DECLARE_MACRO(add, +, long long int)
sv 1:6799c07fe510 177 TVMET_DECLARE_MACRO(sub, -, long long int)
sv 1:6799c07fe510 178 TVMET_DECLARE_MACRO(mul, *, long long int)
sv 1:6799c07fe510 179 TVMET_DECLARE_MACRO(div, /, long long int)
sv 1:6799c07fe510 180 #endif // defined(TVMET_HAVE_LONG_LONG)
sv 1:6799c07fe510 181
sv 1:6799c07fe510 182 TVMET_DECLARE_MACRO(add, +, float)
sv 1:6799c07fe510 183 TVMET_DECLARE_MACRO(sub, -, float)
sv 1:6799c07fe510 184 TVMET_DECLARE_MACRO(mul, *, float)
sv 1:6799c07fe510 185 TVMET_DECLARE_MACRO(div, /, float)
sv 1:6799c07fe510 186
sv 1:6799c07fe510 187 TVMET_DECLARE_MACRO(add, +, double)
sv 1:6799c07fe510 188 TVMET_DECLARE_MACRO(sub, -, double)
sv 1:6799c07fe510 189 TVMET_DECLARE_MACRO(mul, *, double)
sv 1:6799c07fe510 190 TVMET_DECLARE_MACRO(div, /, double)
sv 1:6799c07fe510 191
sv 1:6799c07fe510 192 #if defined(TVMET_HAVE_LONG_DOUBLE)
sv 1:6799c07fe510 193 TVMET_DECLARE_MACRO(add, +, long double)
sv 1:6799c07fe510 194 TVMET_DECLARE_MACRO(sub, -, long double)
sv 1:6799c07fe510 195 TVMET_DECLARE_MACRO(mul, *, long double)
sv 1:6799c07fe510 196 TVMET_DECLARE_MACRO(div, /, long double)
sv 1:6799c07fe510 197 #endif // defined(TVMET_HAVE_LONG_DOUBLE)
sv 1:6799c07fe510 198
sv 1:6799c07fe510 199 #undef TVMET_DECLARE_MACRO
sv 1:6799c07fe510 200
sv 1:6799c07fe510 201
sv 1:6799c07fe510 202 #if defined(TVMET_HAVE_COMPLEX)
sv 1:6799c07fe510 203 /*
sv 1:6799c07fe510 204 * operator(Matrix<T, Rows, Cols>, complex<T>)
sv 1:6799c07fe510 205 * operator(complex<T>, Matrix<T, Rows, Cols>)
sv 1:6799c07fe510 206 * Note: operations +,-,*,/ are per se element wise
sv 1:6799c07fe510 207 * \todo type promotion
sv 1:6799c07fe510 208 */
sv 1:6799c07fe510 209 #define TVMET_DECLARE_MACRO(NAME, OP) \
sv 1:6799c07fe510 210 template<class T, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 211 XprMatrix< \
sv 1:6799c07fe510 212 XprBinOp< \
sv 1:6799c07fe510 213 Fcnl_##NAME< std::complex<T>, std::complex<T> >, \
sv 1:6799c07fe510 214 MatrixConstReference< std::complex<T>, Rows, Cols>, \
sv 1:6799c07fe510 215 XprLiteral<std::complex<T> > \
sv 1:6799c07fe510 216 >, \
sv 1:6799c07fe510 217 Rows, Cols \
sv 1:6799c07fe510 218 > \
sv 1:6799c07fe510 219 operator OP (const Matrix< std::complex<T>, Rows, Cols>& lhs, \
sv 1:6799c07fe510 220 const std::complex<T>& rhs) TVMET_CXX_ALWAYS_INLINE; \
sv 1:6799c07fe510 221 \
sv 1:6799c07fe510 222 template<class T, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 223 XprMatrix< \
sv 1:6799c07fe510 224 XprBinOp< \
sv 1:6799c07fe510 225 Fcnl_##NAME< std::complex<T>, std::complex<T> >, \
sv 1:6799c07fe510 226 XprLiteral< std::complex<T> >, \
sv 1:6799c07fe510 227 MatrixConstReference< std::complex<T>, Rows, Cols> \
sv 1:6799c07fe510 228 >, \
sv 1:6799c07fe510 229 Rows, Cols \
sv 1:6799c07fe510 230 > \
sv 1:6799c07fe510 231 operator OP (const std::complex<T>& lhs, \
sv 1:6799c07fe510 232 const Matrix< std::complex<T>, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 233
sv 1:6799c07fe510 234 TVMET_DECLARE_MACRO(add, +)
sv 1:6799c07fe510 235 TVMET_DECLARE_MACRO(sub, -)
sv 1:6799c07fe510 236 TVMET_DECLARE_MACRO(mul, *)
sv 1:6799c07fe510 237 TVMET_DECLARE_MACRO(div, /)
sv 1:6799c07fe510 238
sv 1:6799c07fe510 239 #undef TVMET_DECLARE_MACRO
sv 1:6799c07fe510 240
sv 1:6799c07fe510 241 #endif // defined(TVMET_HAVE_COMPLEX)
sv 1:6799c07fe510 242
sv 1:6799c07fe510 243
sv 1:6799c07fe510 244 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sv 1:6799c07fe510 245 * matrix specific operator*() = prod() operations
sv 1:6799c07fe510 246 *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
sv 1:6799c07fe510 247
sv 1:6799c07fe510 248
sv 1:6799c07fe510 249 template<class T1, std::size_t Rows1, std::size_t Cols1,
sv 1:6799c07fe510 250 class T2, std::size_t Cols2>
sv 1:6799c07fe510 251 XprMatrix<
sv 1:6799c07fe510 252 XprMMProduct<
sv 1:6799c07fe510 253 MatrixConstReference<T1, Rows1, Cols1>, Rows1, Cols1,
sv 1:6799c07fe510 254 MatrixConstReference<T2, Cols1, Cols2>, Cols2
sv 1:6799c07fe510 255 >,
sv 1:6799c07fe510 256 Rows1, Cols2
sv 1:6799c07fe510 257 >
sv 1:6799c07fe510 258 operator*(const Matrix<T1, Rows1, Cols1>& lhs,
sv 1:6799c07fe510 259 const Matrix<T2, Cols1, Cols2>& rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 260
sv 1:6799c07fe510 261
sv 1:6799c07fe510 262 template<class E1, std::size_t Rows1, std::size_t Cols1,
sv 1:6799c07fe510 263 class T2, std::size_t Cols2>
sv 1:6799c07fe510 264 XprMatrix<
sv 1:6799c07fe510 265 XprMMProduct<
sv 1:6799c07fe510 266 XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1,
sv 1:6799c07fe510 267 MatrixConstReference<T2, Cols1, Cols2>, Cols2
sv 1:6799c07fe510 268 >,
sv 1:6799c07fe510 269 Rows1, Cols2
sv 1:6799c07fe510 270 >
sv 1:6799c07fe510 271 operator*(const XprMatrix<E1, Rows1, Cols1>& lhs,
sv 1:6799c07fe510 272 const Matrix<T2, Cols1, Cols2>& rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 273
sv 1:6799c07fe510 274
sv 1:6799c07fe510 275 template<class T1, std::size_t Rows1, std::size_t Cols1,
sv 1:6799c07fe510 276 class E2, std::size_t Cols2>
sv 1:6799c07fe510 277 XprMatrix<
sv 1:6799c07fe510 278 XprMMProduct<
sv 1:6799c07fe510 279 MatrixConstReference<T1, Rows1, Cols1>, Rows1, Cols1,
sv 1:6799c07fe510 280 XprMatrix<E2, Cols1, Cols2>, Cols2
sv 1:6799c07fe510 281 >,
sv 1:6799c07fe510 282 Rows1, Cols2
sv 1:6799c07fe510 283 >
sv 1:6799c07fe510 284 operator*(const Matrix<T1, Rows1, Cols1>& lhs,
sv 1:6799c07fe510 285 const XprMatrix<E2, Cols1, Cols2>& rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 286
sv 1:6799c07fe510 287
sv 1:6799c07fe510 288 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sv 1:6799c07fe510 289 * matrix-vector specific prod( ... ) operators
sv 1:6799c07fe510 290 *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
sv 1:6799c07fe510 291
sv 1:6799c07fe510 292
sv 1:6799c07fe510 293 template<class T1, std::size_t Rows, std::size_t Cols, class T2>
sv 1:6799c07fe510 294 XprVector<
sv 1:6799c07fe510 295 XprMVProduct<
sv 1:6799c07fe510 296 MatrixConstReference<T1, Rows, Cols>, Rows, Cols,
sv 1:6799c07fe510 297 VectorConstReference<T2, Cols>
sv 1:6799c07fe510 298 >,
sv 1:6799c07fe510 299 Rows
sv 1:6799c07fe510 300 >
sv 1:6799c07fe510 301 operator*(const Matrix<T1, Rows, Cols>& lhs,
sv 1:6799c07fe510 302 const Vector<T2, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 303
sv 1:6799c07fe510 304
sv 1:6799c07fe510 305 template<class T1, class E2, std::size_t Rows, std::size_t Cols>
sv 1:6799c07fe510 306 XprVector<
sv 1:6799c07fe510 307 XprMVProduct<
sv 1:6799c07fe510 308 MatrixConstReference<T1, Rows, Cols>, Rows, Cols,
sv 1:6799c07fe510 309 XprVector<E2, Cols>
sv 1:6799c07fe510 310 >,
sv 1:6799c07fe510 311 Rows
sv 1:6799c07fe510 312 >
sv 1:6799c07fe510 313 operator*(const Matrix<T1, Rows, Cols>& lhs,
sv 1:6799c07fe510 314 const XprVector<E2, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 315
sv 1:6799c07fe510 316
sv 1:6799c07fe510 317 template<class E1, class T2, std::size_t Rows, std::size_t Cols>
sv 1:6799c07fe510 318 XprVector<
sv 1:6799c07fe510 319 XprMVProduct<
sv 1:6799c07fe510 320 XprMatrix<E1, Rows, Cols>, Rows, Cols,
sv 1:6799c07fe510 321 VectorConstReference<T2, Cols>
sv 1:6799c07fe510 322 >,
sv 1:6799c07fe510 323 Rows
sv 1:6799c07fe510 324 >
sv 1:6799c07fe510 325 operator*(const XprMatrix<E1, Rows, Cols>& lhs,
sv 1:6799c07fe510 326 const Vector<T2, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 327
sv 1:6799c07fe510 328
sv 1:6799c07fe510 329 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sv 1:6799c07fe510 330 * Matrix integer and compare operators
sv 1:6799c07fe510 331 *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
sv 1:6799c07fe510 332
sv 1:6799c07fe510 333
sv 1:6799c07fe510 334 /*
sv 1:6799c07fe510 335 * operator(Matrix<T1, Rows, Cols>, Matrix<T2, Rows, Cols>)
sv 1:6799c07fe510 336 * operator(XprMatrix<E>, Matrix<T, Rows, Cols>)
sv 1:6799c07fe510 337 * operator(Matrix<T, Rows, Cols>, XprMatrix<E>)
sv 1:6799c07fe510 338 * Note: operations are per se element wise
sv 1:6799c07fe510 339 */
sv 1:6799c07fe510 340 #define TVMET_DECLARE_MACRO(NAME, OP) \
sv 1:6799c07fe510 341 template<class T1, std::size_t Rows, std::size_t Cols, \
sv 1:6799c07fe510 342 class T2> \
sv 1:6799c07fe510 343 XprMatrix< \
sv 1:6799c07fe510 344 XprBinOp< \
sv 1:6799c07fe510 345 Fcnl_##NAME<T1, T2>, \
sv 1:6799c07fe510 346 MatrixConstReference<T1, Rows, Cols>, \
sv 1:6799c07fe510 347 MatrixConstReference<T2, Rows, Cols> \
sv 1:6799c07fe510 348 >, \
sv 1:6799c07fe510 349 Rows, Cols \
sv 1:6799c07fe510 350 > \
sv 1:6799c07fe510 351 operator OP (const Matrix<T1, Rows, Cols>& lhs, \
sv 1:6799c07fe510 352 const Matrix<T2, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE; \
sv 1:6799c07fe510 353 \
sv 1:6799c07fe510 354 template<class E, \
sv 1:6799c07fe510 355 class T, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 356 XprMatrix< \
sv 1:6799c07fe510 357 XprBinOp< \
sv 1:6799c07fe510 358 Fcnl_##NAME<typename E::value_type, T>, \
sv 1:6799c07fe510 359 XprMatrix<E, Rows, Cols>, \
sv 1:6799c07fe510 360 MatrixConstReference<T, Rows, Cols> \
sv 1:6799c07fe510 361 >, \
sv 1:6799c07fe510 362 Rows, Cols \
sv 1:6799c07fe510 363 > \
sv 1:6799c07fe510 364 operator OP (const XprMatrix<E, Rows, Cols>& lhs, \
sv 1:6799c07fe510 365 const Matrix<T, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE; \
sv 1:6799c07fe510 366 \
sv 1:6799c07fe510 367 template<class T, std::size_t Rows, std::size_t Cols, \
sv 1:6799c07fe510 368 class E> \
sv 1:6799c07fe510 369 XprMatrix< \
sv 1:6799c07fe510 370 XprBinOp< \
sv 1:6799c07fe510 371 Fcnl_##NAME<typename E::value_type, T>, \
sv 1:6799c07fe510 372 MatrixConstReference<T, Rows, Cols>, \
sv 1:6799c07fe510 373 XprMatrix<E, Rows, Cols> \
sv 1:6799c07fe510 374 >, \
sv 1:6799c07fe510 375 Rows, Cols \
sv 1:6799c07fe510 376 > \
sv 1:6799c07fe510 377 operator OP (const Matrix<T, Rows, Cols>& lhs, \
sv 1:6799c07fe510 378 const XprMatrix<E, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 379
sv 1:6799c07fe510 380 // integer operators only, e.g used on double you wil get an error
sv 1:6799c07fe510 381 namespace element_wise {
sv 1:6799c07fe510 382 TVMET_DECLARE_MACRO(mod, %)
sv 1:6799c07fe510 383 TVMET_DECLARE_MACRO(bitxor, ^)
sv 1:6799c07fe510 384 TVMET_DECLARE_MACRO(bitand, &)
sv 1:6799c07fe510 385 TVMET_DECLARE_MACRO(bitor, |)
sv 1:6799c07fe510 386 TVMET_DECLARE_MACRO(shl, <<)
sv 1:6799c07fe510 387 TVMET_DECLARE_MACRO(shr, >>)
sv 1:6799c07fe510 388 }
sv 1:6799c07fe510 389
sv 1:6799c07fe510 390 // necessary operators for eval functions
sv 1:6799c07fe510 391 TVMET_DECLARE_MACRO(greater, >)
sv 1:6799c07fe510 392 TVMET_DECLARE_MACRO(less, <)
sv 1:6799c07fe510 393 TVMET_DECLARE_MACRO(greater_eq, >=)
sv 1:6799c07fe510 394 TVMET_DECLARE_MACRO(less_eq, <=)
sv 1:6799c07fe510 395 TVMET_DECLARE_MACRO(eq, ==)
sv 1:6799c07fe510 396 TVMET_DECLARE_MACRO(not_eq, !=)
sv 1:6799c07fe510 397 TVMET_DECLARE_MACRO(and, &&)
sv 1:6799c07fe510 398 TVMET_DECLARE_MACRO(or, ||)
sv 1:6799c07fe510 399
sv 1:6799c07fe510 400 #undef TVMET_DECLARE_MACRO
sv 1:6799c07fe510 401
sv 1:6799c07fe510 402
sv 1:6799c07fe510 403 #if defined(TVMET_HAVE_COMPLEX)
sv 1:6799c07fe510 404 /*
sv 1:6799c07fe510 405 * operator(Matrix<T, Rows, Cols>, complex<T>)
sv 1:6799c07fe510 406 * operator(complex<T>, Matrix<T, Rows, Cols>)
sv 1:6799c07fe510 407 * Note: - per se element wise
sv 1:6799c07fe510 408 * - bit ops on complex<int> doesn't make sense, stay away
sv 1:6799c07fe510 409 * \todo type promotion
sv 1:6799c07fe510 410 */
sv 1:6799c07fe510 411 #define TVMET_DECLARE_MACRO(NAME, OP) \
sv 1:6799c07fe510 412 template<class T, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 413 XprMatrix< \
sv 1:6799c07fe510 414 XprBinOp< \
sv 1:6799c07fe510 415 Fcnl_##NAME< std::complex<T>, std::complex<T> >, \
sv 1:6799c07fe510 416 MatrixConstReference< std::complex<T>, Rows, Cols>, \
sv 1:6799c07fe510 417 XprLiteral<std::complex<T> > \
sv 1:6799c07fe510 418 >, \
sv 1:6799c07fe510 419 Rows, Cols \
sv 1:6799c07fe510 420 > \
sv 1:6799c07fe510 421 operator OP (const Matrix< std::complex<T>, Rows, Cols>& lhs, \
sv 1:6799c07fe510 422 const std::complex<T>& rhs) TVMET_CXX_ALWAYS_INLINE; \
sv 1:6799c07fe510 423 \
sv 1:6799c07fe510 424 template<class T, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 425 XprMatrix< \
sv 1:6799c07fe510 426 XprBinOp< \
sv 1:6799c07fe510 427 Fcnl_##NAME< std::complex<T>, std::complex<T> >, \
sv 1:6799c07fe510 428 XprLiteral< std::complex<T> >, \
sv 1:6799c07fe510 429 MatrixConstReference< std::complex<T>, Rows, Cols> \
sv 1:6799c07fe510 430 >, \
sv 1:6799c07fe510 431 Rows, Cols \
sv 1:6799c07fe510 432 > \
sv 1:6799c07fe510 433 operator OP (const std::complex<T>& lhs, \
sv 1:6799c07fe510 434 const Matrix< std::complex<T>, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 435
sv 1:6799c07fe510 436 // necessary operators for eval functions
sv 1:6799c07fe510 437 TVMET_DECLARE_MACRO(greater, >)
sv 1:6799c07fe510 438 TVMET_DECLARE_MACRO(less, <)
sv 1:6799c07fe510 439 TVMET_DECLARE_MACRO(greater_eq, >=)
sv 1:6799c07fe510 440 TVMET_DECLARE_MACRO(less_eq, <=)
sv 1:6799c07fe510 441 TVMET_DECLARE_MACRO(eq, ==)
sv 1:6799c07fe510 442 TVMET_DECLARE_MACRO(not_eq, !=)
sv 1:6799c07fe510 443 TVMET_DECLARE_MACRO(and, &&)
sv 1:6799c07fe510 444 TVMET_DECLARE_MACRO(or, ||)
sv 1:6799c07fe510 445
sv 1:6799c07fe510 446 #undef TVMET_DECLARE_MACRO
sv 1:6799c07fe510 447
sv 1:6799c07fe510 448 #endif // defined(TVMET_HAVE_COMPLEX)
sv 1:6799c07fe510 449
sv 1:6799c07fe510 450
sv 1:6799c07fe510 451 /*
sv 1:6799c07fe510 452 * operator(Matrix<T, Rows, Cols>, POD)
sv 1:6799c07fe510 453 * operator(POD, Matrix<T, Rows, Cols>)
sv 1:6799c07fe510 454 * Note: operations are per se element wise
sv 1:6799c07fe510 455 */
sv 1:6799c07fe510 456 #define TVMET_DECLARE_MACRO(NAME, OP, TP) \
sv 1:6799c07fe510 457 template<class T, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 458 XprMatrix< \
sv 1:6799c07fe510 459 XprBinOp< \
sv 1:6799c07fe510 460 Fcnl_##NAME<T, TP >, \
sv 1:6799c07fe510 461 MatrixConstReference<T, Rows, Cols>, \
sv 1:6799c07fe510 462 XprLiteral<TP > \
sv 1:6799c07fe510 463 >, \
sv 1:6799c07fe510 464 Rows, Cols \
sv 1:6799c07fe510 465 > \
sv 1:6799c07fe510 466 operator OP (const Matrix<T, Rows, Cols>& lhs, TP rhs) TVMET_CXX_ALWAYS_INLINE; \
sv 1:6799c07fe510 467 \
sv 1:6799c07fe510 468 template<class T, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 469 XprMatrix< \
sv 1:6799c07fe510 470 XprBinOp< \
sv 1:6799c07fe510 471 Fcnl_##NAME< TP, T>, \
sv 1:6799c07fe510 472 XprLiteral< TP >, \
sv 1:6799c07fe510 473 MatrixConstReference<T, Rows, Cols> \
sv 1:6799c07fe510 474 >, \
sv 1:6799c07fe510 475 Rows, Cols \
sv 1:6799c07fe510 476 > \
sv 1:6799c07fe510 477 operator OP (TP lhs, const Matrix<T, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 478
sv 1:6799c07fe510 479 // integer operators only, e.g used on double you wil get an error
sv 1:6799c07fe510 480 namespace element_wise {
sv 1:6799c07fe510 481 TVMET_DECLARE_MACRO(mod, %, int)
sv 1:6799c07fe510 482 TVMET_DECLARE_MACRO(bitxor, ^, int)
sv 1:6799c07fe510 483 TVMET_DECLARE_MACRO(bitand, &, int)
sv 1:6799c07fe510 484 TVMET_DECLARE_MACRO(bitor, |, int)
sv 1:6799c07fe510 485 TVMET_DECLARE_MACRO(shl, <<, int)
sv 1:6799c07fe510 486 TVMET_DECLARE_MACRO(shr, >>, int)
sv 1:6799c07fe510 487 }
sv 1:6799c07fe510 488
sv 1:6799c07fe510 489 // necessary operators for eval functions
sv 1:6799c07fe510 490 TVMET_DECLARE_MACRO(greater, >, int)
sv 1:6799c07fe510 491 TVMET_DECLARE_MACRO(less, <, int)
sv 1:6799c07fe510 492 TVMET_DECLARE_MACRO(greater_eq, >=, int)
sv 1:6799c07fe510 493 TVMET_DECLARE_MACRO(less_eq, <=, int)
sv 1:6799c07fe510 494 TVMET_DECLARE_MACRO(eq, ==, int)
sv 1:6799c07fe510 495 TVMET_DECLARE_MACRO(not_eq, !=, int)
sv 1:6799c07fe510 496 TVMET_DECLARE_MACRO(and, &&, int)
sv 1:6799c07fe510 497 TVMET_DECLARE_MACRO(or, ||, int)
sv 1:6799c07fe510 498
sv 1:6799c07fe510 499 #if defined(TVMET_HAVE_LONG_LONG)
sv 1:6799c07fe510 500 // integer operators only
sv 1:6799c07fe510 501 namespace element_wise {
sv 1:6799c07fe510 502 TVMET_DECLARE_MACRO(mod, %, long long int)
sv 1:6799c07fe510 503 TVMET_DECLARE_MACRO(bitxor, ^, long long int)
sv 1:6799c07fe510 504 TVMET_DECLARE_MACRO(bitand, &, long long int)
sv 1:6799c07fe510 505 TVMET_DECLARE_MACRO(bitor, |, long long int)
sv 1:6799c07fe510 506 TVMET_DECLARE_MACRO(shl, <<, long long int)
sv 1:6799c07fe510 507 TVMET_DECLARE_MACRO(shr, >>, long long int)
sv 1:6799c07fe510 508 }
sv 1:6799c07fe510 509
sv 1:6799c07fe510 510 // necessary operators for eval functions
sv 1:6799c07fe510 511 TVMET_DECLARE_MACRO(greater, >, long long int)
sv 1:6799c07fe510 512 TVMET_DECLARE_MACRO(less, <, long long int)
sv 1:6799c07fe510 513 TVMET_DECLARE_MACRO(greater_eq, >=, long long int)
sv 1:6799c07fe510 514 TVMET_DECLARE_MACRO(less_eq, <=, long long int)
sv 1:6799c07fe510 515 TVMET_DECLARE_MACRO(eq, ==, long long int)
sv 1:6799c07fe510 516 TVMET_DECLARE_MACRO(not_eq, !=, long long int)
sv 1:6799c07fe510 517 TVMET_DECLARE_MACRO(and, &&, long long int)
sv 1:6799c07fe510 518 TVMET_DECLARE_MACRO(or, ||, long long int)
sv 1:6799c07fe510 519 #endif // defined(TVMET_HAVE_LONG_LONG)
sv 1:6799c07fe510 520
sv 1:6799c07fe510 521 // necessary operators for eval functions
sv 1:6799c07fe510 522 TVMET_DECLARE_MACRO(greater, >, float)
sv 1:6799c07fe510 523 TVMET_DECLARE_MACRO(less, <, float)
sv 1:6799c07fe510 524 TVMET_DECLARE_MACRO(greater_eq, >=, float)
sv 1:6799c07fe510 525 TVMET_DECLARE_MACRO(less_eq, <=, float)
sv 1:6799c07fe510 526 TVMET_DECLARE_MACRO(eq, ==, float)
sv 1:6799c07fe510 527 TVMET_DECLARE_MACRO(not_eq, !=, float)
sv 1:6799c07fe510 528 TVMET_DECLARE_MACRO(and, &&, float)
sv 1:6799c07fe510 529 TVMET_DECLARE_MACRO(or, ||, float)
sv 1:6799c07fe510 530
sv 1:6799c07fe510 531 // necessary operators for eval functions
sv 1:6799c07fe510 532 TVMET_DECLARE_MACRO(greater, >, double)
sv 1:6799c07fe510 533 TVMET_DECLARE_MACRO(less, <, double)
sv 1:6799c07fe510 534 TVMET_DECLARE_MACRO(greater_eq, >=, double)
sv 1:6799c07fe510 535 TVMET_DECLARE_MACRO(less_eq, <=, double)
sv 1:6799c07fe510 536 TVMET_DECLARE_MACRO(eq, ==, double)
sv 1:6799c07fe510 537 TVMET_DECLARE_MACRO(not_eq, !=, double)
sv 1:6799c07fe510 538 TVMET_DECLARE_MACRO(and, &&, double)
sv 1:6799c07fe510 539 TVMET_DECLARE_MACRO(or, ||, double)
sv 1:6799c07fe510 540
sv 1:6799c07fe510 541 #if defined(TVMET_HAVE_LONG_DOUBLE)
sv 1:6799c07fe510 542 // necessary operators for eval functions
sv 1:6799c07fe510 543 TVMET_DECLARE_MACRO(greater, >, long double)
sv 1:6799c07fe510 544 TVMET_DECLARE_MACRO(less, <, long double)
sv 1:6799c07fe510 545 TVMET_DECLARE_MACRO(greater_eq, >=, long double)
sv 1:6799c07fe510 546 TVMET_DECLARE_MACRO(less_eq, <=, long double)
sv 1:6799c07fe510 547 TVMET_DECLARE_MACRO(eq, ==, long double)
sv 1:6799c07fe510 548 TVMET_DECLARE_MACRO(not_eq, !=, long double)
sv 1:6799c07fe510 549 TVMET_DECLARE_MACRO(and, &&, long double)
sv 1:6799c07fe510 550 TVMET_DECLARE_MACRO(or, ||, long double)
sv 1:6799c07fe510 551 #endif // defined(TVMET_HAVE_LONG_DOUBLE)
sv 1:6799c07fe510 552
sv 1:6799c07fe510 553 #undef TVMET_DECLARE_MACRO
sv 1:6799c07fe510 554
sv 1:6799c07fe510 555
sv 1:6799c07fe510 556
sv 1:6799c07fe510 557
sv 1:6799c07fe510 558 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sv 1:6799c07fe510 559 * global unary operators
sv 1:6799c07fe510 560 *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
sv 1:6799c07fe510 561
sv 1:6799c07fe510 562
sv 1:6799c07fe510 563 /*
sv 1:6799c07fe510 564 * unary_operator(Matrix<T, Rows, Cols>)
sv 1:6799c07fe510 565 * Note: per se element wise
sv 1:6799c07fe510 566 */
sv 1:6799c07fe510 567 #define TVMET_DECLARE_MACRO(NAME, OP) \
sv 1:6799c07fe510 568 template <class T, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 569 XprMatrix< \
sv 1:6799c07fe510 570 XprUnOp< \
sv 1:6799c07fe510 571 Fcnl_##NAME<T>, \
sv 1:6799c07fe510 572 MatrixConstReference<T, Rows, Cols> \
sv 1:6799c07fe510 573 >, \
sv 1:6799c07fe510 574 Rows, Cols \
sv 1:6799c07fe510 575 > \
sv 1:6799c07fe510 576 operator OP (const Matrix<T, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE;
sv 1:6799c07fe510 577
sv 1:6799c07fe510 578 TVMET_DECLARE_MACRO(not, !)
sv 1:6799c07fe510 579 TVMET_DECLARE_MACRO(compl, ~)
sv 1:6799c07fe510 580 TVMET_DECLARE_MACRO(neg, -)
sv 1:6799c07fe510 581 #undef TVMET_DECLARE_MACRO
sv 1:6799c07fe510 582
sv 1:6799c07fe510 583
sv 1:6799c07fe510 584 /*********************************************************
sv 1:6799c07fe510 585 * PART II: IMPLEMENTATION
sv 1:6799c07fe510 586 *********************************************************/
sv 1:6799c07fe510 587
sv 1:6799c07fe510 588
sv 1:6799c07fe510 589 /**
sv 1:6799c07fe510 590 * \fn operator<<(std::ostream& os, const Matrix<T, Rows, Cols>& rhs)
sv 1:6799c07fe510 591 * \brief Overload operator for i/o
sv 1:6799c07fe510 592 * \ingroup _binary_operator
sv 1:6799c07fe510 593 */
sv 1:6799c07fe510 594 template<class T, std::size_t Rows, std::size_t Cols>
sv 1:6799c07fe510 595 inline
sv 1:6799c07fe510 596 std::ostream& operator<<(std::ostream& os, const Matrix<T, Rows, Cols>& rhs) {
sv 1:6799c07fe510 597 return rhs.print_on(os);
sv 1:6799c07fe510 598 }
sv 1:6799c07fe510 599
sv 1:6799c07fe510 600
sv 1:6799c07fe510 601 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sv 1:6799c07fe510 602 * Member operators (arithmetic and bit ops)
sv 1:6799c07fe510 603 *++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
sv 1:6799c07fe510 604
sv 1:6799c07fe510 605
sv 1:6799c07fe510 606 /*
sv 1:6799c07fe510 607 * update_operator(Matrix<T1, Rows, Cols>, Matrix<T2, Rows, Cols>)
sv 1:6799c07fe510 608 * update_operator(Matrix<T1, Rows, Cols>, XprMatrix<E, Rows, Cols> rhs)
sv 1:6799c07fe510 609 * Note: per se element wise
sv 1:6799c07fe510 610 * \todo: the operator*= can have element wise mul oder product, decide!
sv 1:6799c07fe510 611 */
sv 1:6799c07fe510 612 #define TVMET_IMPLEMENT_MACRO(NAME, OP) \
sv 1:6799c07fe510 613 template<class T1, class T2, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 614 inline \
sv 1:6799c07fe510 615 Matrix<T1, Rows, Cols>& \
sv 1:6799c07fe510 616 operator OP (Matrix<T1, Rows, Cols>& lhs, const Matrix<T2, Rows, Cols>& rhs) { \
sv 1:6799c07fe510 617 return lhs.M_##NAME(rhs); \
sv 1:6799c07fe510 618 } \
sv 1:6799c07fe510 619 \
sv 1:6799c07fe510 620 template<class T, class E, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 621 inline \
sv 1:6799c07fe510 622 Matrix<T, Rows, Cols>& \
sv 1:6799c07fe510 623 operator OP (Matrix<T, Rows, Cols>& lhs, const XprMatrix<E, Rows, Cols>& rhs) { \
sv 1:6799c07fe510 624 return lhs.M_##NAME(rhs); \
sv 1:6799c07fe510 625 }
sv 1:6799c07fe510 626
sv 1:6799c07fe510 627 TVMET_IMPLEMENT_MACRO(add_eq, +=) // per se element wise
sv 1:6799c07fe510 628 TVMET_IMPLEMENT_MACRO(sub_eq, -=) // per se element wise
sv 1:6799c07fe510 629 namespace element_wise {
sv 1:6799c07fe510 630 TVMET_IMPLEMENT_MACRO(mul_eq, *=) // see note
sv 1:6799c07fe510 631 TVMET_IMPLEMENT_MACRO(div_eq, /=) // not defined for vectors
sv 1:6799c07fe510 632 }
sv 1:6799c07fe510 633
sv 1:6799c07fe510 634 // integer operators only, e.g used on double you wil get an error
sv 1:6799c07fe510 635 namespace element_wise {
sv 1:6799c07fe510 636 TVMET_IMPLEMENT_MACRO(mod_eq, %=)
sv 1:6799c07fe510 637 TVMET_IMPLEMENT_MACRO(xor_eq, ^=)
sv 1:6799c07fe510 638 TVMET_IMPLEMENT_MACRO(and_eq, &=)
sv 1:6799c07fe510 639 TVMET_IMPLEMENT_MACRO(or_eq, |=)
sv 1:6799c07fe510 640 TVMET_IMPLEMENT_MACRO(shl_eq, <<=)
sv 1:6799c07fe510 641 TVMET_IMPLEMENT_MACRO(shr_eq, >>=)
sv 1:6799c07fe510 642 }
sv 1:6799c07fe510 643
sv 1:6799c07fe510 644 #undef TVMET_IMPLEMENT_MACRO
sv 1:6799c07fe510 645
sv 1:6799c07fe510 646
sv 1:6799c07fe510 647 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sv 1:6799c07fe510 648 * Matrix arithmetic operators implemented by functions
sv 1:6799c07fe510 649 * add, sub, mul and div
sv 1:6799c07fe510 650 *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
sv 1:6799c07fe510 651
sv 1:6799c07fe510 652
sv 1:6799c07fe510 653 /*
sv 1:6799c07fe510 654 * operator(Matrix<T1, Rows, Cols>, Matrix<T2, Rows, Cols>)
sv 1:6799c07fe510 655 * operator(XprMatrix<E, Rows, Cols>, Matrix<T, Rows, Cols>)
sv 1:6799c07fe510 656 * operator(Matrix<T, Rows, Cols>, XprMatrix<E, Rows, Cols>)
sv 1:6799c07fe510 657 * Note: per se element wise
sv 1:6799c07fe510 658 */
sv 1:6799c07fe510 659 #define TVMET_IMPLEMENT_MACRO(NAME, OP) \
sv 1:6799c07fe510 660 template<class T1, class T2, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 661 inline \
sv 1:6799c07fe510 662 XprMatrix< \
sv 1:6799c07fe510 663 XprBinOp< \
sv 1:6799c07fe510 664 Fcnl_##NAME<T1, T2>, \
sv 1:6799c07fe510 665 MatrixConstReference<T1, Rows, Cols>, \
sv 1:6799c07fe510 666 MatrixConstReference<T2, Rows, Cols> \
sv 1:6799c07fe510 667 >, \
sv 1:6799c07fe510 668 Rows, Cols \
sv 1:6799c07fe510 669 > \
sv 1:6799c07fe510 670 operator OP (const Matrix<T1, Rows, Cols>& lhs, const Matrix<T2, Rows, Cols>& rhs) { \
sv 1:6799c07fe510 671 return NAME(lhs, rhs); \
sv 1:6799c07fe510 672 } \
sv 1:6799c07fe510 673 \
sv 1:6799c07fe510 674 template<class E, class T, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 675 inline \
sv 1:6799c07fe510 676 XprMatrix< \
sv 1:6799c07fe510 677 XprBinOp< \
sv 1:6799c07fe510 678 Fcnl_##NAME<typename E::value_type, T>, \
sv 1:6799c07fe510 679 XprMatrix<E, Rows, Cols>, \
sv 1:6799c07fe510 680 MatrixConstReference<T, Rows, Cols> \
sv 1:6799c07fe510 681 >, \
sv 1:6799c07fe510 682 Rows, Cols \
sv 1:6799c07fe510 683 > \
sv 1:6799c07fe510 684 operator OP (const XprMatrix<E, Rows, Cols>& lhs, const Matrix<T, Rows, Cols>& rhs) { \
sv 1:6799c07fe510 685 return NAME(lhs, rhs); \
sv 1:6799c07fe510 686 } \
sv 1:6799c07fe510 687 \
sv 1:6799c07fe510 688 template<class T, class E, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 689 inline \
sv 1:6799c07fe510 690 XprMatrix< \
sv 1:6799c07fe510 691 XprBinOp< \
sv 1:6799c07fe510 692 Fcnl_##NAME<typename E::value_type, T>, \
sv 1:6799c07fe510 693 MatrixConstReference<T, Rows, Cols>, \
sv 1:6799c07fe510 694 XprMatrix<E, Rows, Cols> \
sv 1:6799c07fe510 695 >, \
sv 1:6799c07fe510 696 Rows, Cols \
sv 1:6799c07fe510 697 > \
sv 1:6799c07fe510 698 operator OP (const Matrix<T, Rows, Cols>& lhs, const XprMatrix<E, Rows, Cols>& rhs) { \
sv 1:6799c07fe510 699 return NAME(lhs, rhs); \
sv 1:6799c07fe510 700 }
sv 1:6799c07fe510 701
sv 1:6799c07fe510 702 TVMET_IMPLEMENT_MACRO(add, +) // per se element wise
sv 1:6799c07fe510 703 TVMET_IMPLEMENT_MACRO(sub, -) // per se element wise
sv 1:6799c07fe510 704 namespace element_wise {
sv 1:6799c07fe510 705 TVMET_IMPLEMENT_MACRO(mul, *) // see as prod()
sv 1:6799c07fe510 706 TVMET_IMPLEMENT_MACRO(div, /) // not defined for matrizes
sv 1:6799c07fe510 707 }
sv 1:6799c07fe510 708 #undef TVMET_IMPLEMENT_MACRO
sv 1:6799c07fe510 709
sv 1:6799c07fe510 710
sv 1:6799c07fe510 711 /*
sv 1:6799c07fe510 712 * operator(Matrix<T, Rows, Cols>, POD)
sv 1:6799c07fe510 713 * operator(POD, Matrix<T, Rows, Cols>)
sv 1:6799c07fe510 714 * Note: operations +,-,*,/ are per se element wise
sv 1:6799c07fe510 715 */
sv 1:6799c07fe510 716 #define TVMET_IMPLEMENT_MACRO(NAME, OP, POD) \
sv 1:6799c07fe510 717 template<class T, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 718 inline \
sv 1:6799c07fe510 719 XprMatrix< \
sv 1:6799c07fe510 720 XprBinOp< \
sv 1:6799c07fe510 721 Fcnl_##NAME<T, POD >, \
sv 1:6799c07fe510 722 MatrixConstReference<T, Rows, Cols>, \
sv 1:6799c07fe510 723 XprLiteral<POD > \
sv 1:6799c07fe510 724 >, \
sv 1:6799c07fe510 725 Rows, Cols \
sv 1:6799c07fe510 726 > \
sv 1:6799c07fe510 727 operator OP (const Matrix<T, Rows, Cols>& lhs, POD rhs) { \
sv 1:6799c07fe510 728 return NAME (lhs, rhs); \
sv 1:6799c07fe510 729 } \
sv 1:6799c07fe510 730 \
sv 1:6799c07fe510 731 template<class T, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 732 inline \
sv 1:6799c07fe510 733 XprMatrix< \
sv 1:6799c07fe510 734 XprBinOp< \
sv 1:6799c07fe510 735 Fcnl_##NAME< POD, T>, \
sv 1:6799c07fe510 736 XprLiteral< POD >, \
sv 1:6799c07fe510 737 MatrixConstReference<T, Rows, Cols> \
sv 1:6799c07fe510 738 >, \
sv 1:6799c07fe510 739 Rows, Cols \
sv 1:6799c07fe510 740 > \
sv 1:6799c07fe510 741 operator OP (POD lhs, const Matrix<T, Rows, Cols>& rhs) { \
sv 1:6799c07fe510 742 return NAME (lhs, rhs); \
sv 1:6799c07fe510 743 }
sv 1:6799c07fe510 744
sv 1:6799c07fe510 745 TVMET_IMPLEMENT_MACRO(add, +, int)
sv 1:6799c07fe510 746 TVMET_IMPLEMENT_MACRO(sub, -, int)
sv 1:6799c07fe510 747 TVMET_IMPLEMENT_MACRO(mul, *, int)
sv 1:6799c07fe510 748 TVMET_IMPLEMENT_MACRO(div, /, int)
sv 1:6799c07fe510 749
sv 1:6799c07fe510 750 #if defined(TVMET_HAVE_LONG_LONG)
sv 1:6799c07fe510 751 TVMET_IMPLEMENT_MACRO(add, +, long long int)
sv 1:6799c07fe510 752 TVMET_IMPLEMENT_MACRO(sub, -, long long int)
sv 1:6799c07fe510 753 TVMET_IMPLEMENT_MACRO(mul, *, long long int)
sv 1:6799c07fe510 754 TVMET_IMPLEMENT_MACRO(div, /, long long int)
sv 1:6799c07fe510 755 #endif // defined(TVMET_HAVE_LONG_LONG)
sv 1:6799c07fe510 756
sv 1:6799c07fe510 757 TVMET_IMPLEMENT_MACRO(add, +, float)
sv 1:6799c07fe510 758 TVMET_IMPLEMENT_MACRO(sub, -, float)
sv 1:6799c07fe510 759 TVMET_IMPLEMENT_MACRO(mul, *, float)
sv 1:6799c07fe510 760 TVMET_IMPLEMENT_MACRO(div, /, float)
sv 1:6799c07fe510 761
sv 1:6799c07fe510 762 TVMET_IMPLEMENT_MACRO(add, +, double)
sv 1:6799c07fe510 763 TVMET_IMPLEMENT_MACRO(sub, -, double)
sv 1:6799c07fe510 764 TVMET_IMPLEMENT_MACRO(mul, *, double)
sv 1:6799c07fe510 765 TVMET_IMPLEMENT_MACRO(div, /, double)
sv 1:6799c07fe510 766
sv 1:6799c07fe510 767 #if defined(TVMET_HAVE_LONG_DOUBLE)
sv 1:6799c07fe510 768 TVMET_IMPLEMENT_MACRO(add, +, long double)
sv 1:6799c07fe510 769 TVMET_IMPLEMENT_MACRO(sub, -, long double)
sv 1:6799c07fe510 770 TVMET_IMPLEMENT_MACRO(mul, *, long double)
sv 1:6799c07fe510 771 TVMET_IMPLEMENT_MACRO(div, /, long double)
sv 1:6799c07fe510 772 #endif // defined(TVMET_HAVE_LONG_DOUBLE)
sv 1:6799c07fe510 773
sv 1:6799c07fe510 774 #undef TVMET_IMPLEMENT_MACRO
sv 1:6799c07fe510 775
sv 1:6799c07fe510 776
sv 1:6799c07fe510 777 #if defined(TVMET_HAVE_COMPLEX)
sv 1:6799c07fe510 778 /*
sv 1:6799c07fe510 779 * operator(Matrix<T, Rows, Cols>, complex<T>)
sv 1:6799c07fe510 780 * operator(complex<T>, Matrix<T, Rows, Cols>)
sv 1:6799c07fe510 781 * Note: operations +,-,*,/ are per se element wise
sv 1:6799c07fe510 782 * \todo type promotion
sv 1:6799c07fe510 783 */
sv 1:6799c07fe510 784 #define TVMET_IMPLEMENT_MACRO(NAME, OP) \
sv 1:6799c07fe510 785 template<class T, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 786 inline \
sv 1:6799c07fe510 787 XprMatrix< \
sv 1:6799c07fe510 788 XprBinOp< \
sv 1:6799c07fe510 789 Fcnl_##NAME< std::complex<T>, std::complex<T> >, \
sv 1:6799c07fe510 790 MatrixConstReference< std::complex<T>, Rows, Cols>, \
sv 1:6799c07fe510 791 XprLiteral<std::complex<T> > \
sv 1:6799c07fe510 792 >, \
sv 1:6799c07fe510 793 Rows, Cols \
sv 1:6799c07fe510 794 > \
sv 1:6799c07fe510 795 operator OP (const Matrix< std::complex<T>, Rows, Cols>& lhs, \
sv 1:6799c07fe510 796 const std::complex<T>& rhs) { \
sv 1:6799c07fe510 797 return NAME (lhs, rhs); \
sv 1:6799c07fe510 798 } \
sv 1:6799c07fe510 799 \
sv 1:6799c07fe510 800 template<class T, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 801 inline \
sv 1:6799c07fe510 802 XprMatrix< \
sv 1:6799c07fe510 803 XprBinOp< \
sv 1:6799c07fe510 804 Fcnl_##NAME< std::complex<T>, std::complex<T> >, \
sv 1:6799c07fe510 805 XprLiteral< std::complex<T> >, \
sv 1:6799c07fe510 806 MatrixConstReference< std::complex<T>, Rows, Cols> \
sv 1:6799c07fe510 807 >, \
sv 1:6799c07fe510 808 Rows, Cols \
sv 1:6799c07fe510 809 > \
sv 1:6799c07fe510 810 operator OP (const std::complex<T>& lhs, \
sv 1:6799c07fe510 811 const Matrix< std::complex<T>, Rows, Cols>& rhs) { \
sv 1:6799c07fe510 812 return NAME (lhs, rhs); \
sv 1:6799c07fe510 813 }
sv 1:6799c07fe510 814
sv 1:6799c07fe510 815 TVMET_IMPLEMENT_MACRO(add, +)
sv 1:6799c07fe510 816 TVMET_IMPLEMENT_MACRO(sub, -)
sv 1:6799c07fe510 817 TVMET_IMPLEMENT_MACRO(mul, *)
sv 1:6799c07fe510 818 TVMET_IMPLEMENT_MACRO(div, /)
sv 1:6799c07fe510 819
sv 1:6799c07fe510 820 #undef TVMET_IMPLEMENT_MACRO
sv 1:6799c07fe510 821
sv 1:6799c07fe510 822 #endif // defined(TVMET_HAVE_COMPLEX)
sv 1:6799c07fe510 823
sv 1:6799c07fe510 824
sv 1:6799c07fe510 825 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sv 1:6799c07fe510 826 * matrix specific operator*() = prod() operations
sv 1:6799c07fe510 827 *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
sv 1:6799c07fe510 828
sv 1:6799c07fe510 829
sv 1:6799c07fe510 830 /**
sv 1:6799c07fe510 831 * \fn operator*(const Matrix<T1, Rows1, Cols1>& lhs, const Matrix<T2, Cols1, Cols2>& rhs)
sv 1:6799c07fe510 832 * \brief multiply two Matrices.
sv 1:6799c07fe510 833 * \ingroup _binary_operator
sv 1:6799c07fe510 834 * \note The rows2 has to be equal to cols1.
sv 1:6799c07fe510 835 * \sa prod(const Matrix<T1, Rows1, Cols1>& lhs, const Matrix<T2, Cols1, Cols2>& rhs)
sv 1:6799c07fe510 836 */
sv 1:6799c07fe510 837 template<class T1, std::size_t Rows1, std::size_t Cols1,
sv 1:6799c07fe510 838 class T2, std::size_t Cols2>
sv 1:6799c07fe510 839 inline
sv 1:6799c07fe510 840 XprMatrix<
sv 1:6799c07fe510 841 XprMMProduct<
sv 1:6799c07fe510 842 MatrixConstReference<T1, Rows1, Cols1>, Rows1, Cols1,
sv 1:6799c07fe510 843 MatrixConstReference<T2, Cols1, Cols2>, Cols2
sv 1:6799c07fe510 844 >,
sv 1:6799c07fe510 845 Rows1, Cols2
sv 1:6799c07fe510 846 >
sv 1:6799c07fe510 847 operator*(const Matrix<T1, Rows1, Cols1>& lhs, const Matrix<T2, Cols1, Cols2>& rhs) {
sv 1:6799c07fe510 848 return prod(lhs, rhs);
sv 1:6799c07fe510 849 }
sv 1:6799c07fe510 850
sv 1:6799c07fe510 851
sv 1:6799c07fe510 852 /**
sv 1:6799c07fe510 853 * \fn operator*(const XprMatrix<E1, Rows1, Cols1>& lhs, const Matrix<T2, Cols1, Cols2>& rhs)
sv 1:6799c07fe510 854 * \brief Evaluate the product of XprMatrix and Matrix.
sv 1:6799c07fe510 855 * \ingroup _binary_operator
sv 1:6799c07fe510 856 * \sa prod(const XprMatrix<E1, Rows1, Cols1>& lhs, const Matrix<T2, Cols1, Cols2>& rhs)
sv 1:6799c07fe510 857 */
sv 1:6799c07fe510 858 template<class E1, std::size_t Rows1, std::size_t Cols1,
sv 1:6799c07fe510 859 class T2, std::size_t Cols2>
sv 1:6799c07fe510 860 inline
sv 1:6799c07fe510 861 XprMatrix<
sv 1:6799c07fe510 862 XprMMProduct<
sv 1:6799c07fe510 863 XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1,
sv 1:6799c07fe510 864 MatrixConstReference<T2, Cols1, Cols2>, Cols2
sv 1:6799c07fe510 865 >,
sv 1:6799c07fe510 866 Rows1, Cols2
sv 1:6799c07fe510 867 >
sv 1:6799c07fe510 868 operator*(const XprMatrix<E1, Rows1, Cols1>& lhs, const Matrix<T2, Cols1, Cols2>& rhs) {
sv 1:6799c07fe510 869 return prod(lhs, rhs);
sv 1:6799c07fe510 870 }
sv 1:6799c07fe510 871
sv 1:6799c07fe510 872
sv 1:6799c07fe510 873 /**
sv 1:6799c07fe510 874 * \fn operator*(const Matrix<T1, Rows1, Cols1>& lhs, const XprMatrix<E2, Cols1, Cols2>& rhs)
sv 1:6799c07fe510 875 * \brief Evaluate the product of Matrix and XprMatrix.
sv 1:6799c07fe510 876 * \ingroup _binary_operator
sv 1:6799c07fe510 877 * \sa prod(const Matrix<T, Rows1, Cols1>& lhs, const XprMatrix<E, Cols1, Cols2>& rhs)
sv 1:6799c07fe510 878 */
sv 1:6799c07fe510 879 template<class T1, std::size_t Rows1, std::size_t Cols1,
sv 1:6799c07fe510 880 class E2, std::size_t Cols2>
sv 1:6799c07fe510 881 inline
sv 1:6799c07fe510 882 XprMatrix<
sv 1:6799c07fe510 883 XprMMProduct<
sv 1:6799c07fe510 884 MatrixConstReference<T1, Rows1, Cols1>, Rows1, Cols1,
sv 1:6799c07fe510 885 XprMatrix<E2, Cols1, Cols2>, Cols2
sv 1:6799c07fe510 886 >,
sv 1:6799c07fe510 887 Rows1, Cols2
sv 1:6799c07fe510 888 >
sv 1:6799c07fe510 889 operator*(const Matrix<T1, Rows1, Cols1>& lhs, const XprMatrix<E2, Cols1, Cols2>& rhs) {
sv 1:6799c07fe510 890 return prod(lhs, rhs);
sv 1:6799c07fe510 891 }
sv 1:6799c07fe510 892
sv 1:6799c07fe510 893
sv 1:6799c07fe510 894 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sv 1:6799c07fe510 895 * matrix-vector specific prod( ... ) operators
sv 1:6799c07fe510 896 *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
sv 1:6799c07fe510 897
sv 1:6799c07fe510 898
sv 1:6799c07fe510 899 /**
sv 1:6799c07fe510 900 * \fn operator*(const Matrix<T1, Rows, Cols>& lhs, const Vector<T2, Cols>& rhs)
sv 1:6799c07fe510 901 * \brief multiply a Matrix with a Vector.
sv 1:6799c07fe510 902 * \ingroup _binary_operator
sv 1:6799c07fe510 903 * \note The length of the Vector has to be equal to the number of Columns.
sv 1:6799c07fe510 904 * \sa prod(const Matrix<T1, Rows, Cols>& m, const Vector<T2, Cols>& v)
sv 1:6799c07fe510 905 */
sv 1:6799c07fe510 906 template<class T1, std::size_t Rows, std::size_t Cols, class T2>
sv 1:6799c07fe510 907 inline
sv 1:6799c07fe510 908 XprVector<
sv 1:6799c07fe510 909 XprMVProduct<
sv 1:6799c07fe510 910 MatrixConstReference<T1, Rows, Cols>, Rows, Cols,
sv 1:6799c07fe510 911 VectorConstReference<T2, Cols>
sv 1:6799c07fe510 912 >,
sv 1:6799c07fe510 913 Rows
sv 1:6799c07fe510 914 >
sv 1:6799c07fe510 915 operator*(const Matrix<T1, Rows, Cols>& lhs, const Vector<T2, Cols>& rhs) {
sv 1:6799c07fe510 916 return prod(lhs, rhs);
sv 1:6799c07fe510 917 }
sv 1:6799c07fe510 918
sv 1:6799c07fe510 919
sv 1:6799c07fe510 920 /**
sv 1:6799c07fe510 921 * \fn operator*(const Matrix<T1, Rows, Cols>& lhs, const XprVector<E2, Cols>& rhs)
sv 1:6799c07fe510 922 * \brief Function for the matrix-vector-product
sv 1:6799c07fe510 923 * \ingroup _binary_operator
sv 1:6799c07fe510 924 * \sa prod(const Matrix<T, Rows, Cols>& lhs, const XprVector<E, Cols>& rhs)
sv 1:6799c07fe510 925 */
sv 1:6799c07fe510 926 template<class T1, class E2, std::size_t Rows, std::size_t Cols>
sv 1:6799c07fe510 927 inline
sv 1:6799c07fe510 928 XprVector<
sv 1:6799c07fe510 929 XprMVProduct<
sv 1:6799c07fe510 930 MatrixConstReference<T1, Rows, Cols>, Rows, Cols,
sv 1:6799c07fe510 931 XprVector<E2, Cols>
sv 1:6799c07fe510 932 >,
sv 1:6799c07fe510 933 Rows
sv 1:6799c07fe510 934 >
sv 1:6799c07fe510 935 operator*(const Matrix<T1, Rows, Cols>& lhs, const XprVector<E2, Cols>& rhs) {
sv 1:6799c07fe510 936 return prod(lhs, rhs);
sv 1:6799c07fe510 937 }
sv 1:6799c07fe510 938
sv 1:6799c07fe510 939
sv 1:6799c07fe510 940 /**
sv 1:6799c07fe510 941 * \fn operator*(const XprMatrix<E1, Rows, Cols>& lhs, const Vector<T2, Cols>& rhs)
sv 1:6799c07fe510 942 * \brief Compute the product of an XprMatrix with a Vector.
sv 1:6799c07fe510 943 * \ingroup _binary_operator
sv 1:6799c07fe510 944 * \sa prod(const XprMatrix<E, Rows, Cols>& lhs, const Vector<T, Cols>& rhs)
sv 1:6799c07fe510 945 */
sv 1:6799c07fe510 946 template<class E1, class T2, std::size_t Rows, std::size_t Cols>
sv 1:6799c07fe510 947 inline
sv 1:6799c07fe510 948 XprVector<
sv 1:6799c07fe510 949 XprMVProduct<
sv 1:6799c07fe510 950 XprMatrix<E1, Rows, Cols>, Rows, Cols,
sv 1:6799c07fe510 951 VectorConstReference<T2, Cols>
sv 1:6799c07fe510 952 >,
sv 1:6799c07fe510 953 Rows
sv 1:6799c07fe510 954 >
sv 1:6799c07fe510 955 operator*(const XprMatrix<E1, Rows, Cols>& lhs, const Vector<T2, Cols>& rhs) {
sv 1:6799c07fe510 956 return prod(lhs, rhs);
sv 1:6799c07fe510 957 }
sv 1:6799c07fe510 958
sv 1:6799c07fe510 959
sv 1:6799c07fe510 960 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sv 1:6799c07fe510 961 * Matrix integer and compare operators
sv 1:6799c07fe510 962 *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
sv 1:6799c07fe510 963
sv 1:6799c07fe510 964
sv 1:6799c07fe510 965 /*
sv 1:6799c07fe510 966 * operator(Matrix<T1, Rows, Cols>, Matrix<T2, Rows, Cols>)
sv 1:6799c07fe510 967 * operator(XprMatrix<E>, Matrix<T, Rows, Cols>)
sv 1:6799c07fe510 968 * operator(Matrix<T, Rows, Cols>, XprMatrix<E>)
sv 1:6799c07fe510 969 * Note: operations are per se element wise
sv 1:6799c07fe510 970 */
sv 1:6799c07fe510 971 #define TVMET_IMPLEMENT_MACRO(NAME, OP) \
sv 1:6799c07fe510 972 template<class T1, std::size_t Rows, std::size_t Cols, \
sv 1:6799c07fe510 973 class T2> \
sv 1:6799c07fe510 974 inline \
sv 1:6799c07fe510 975 XprMatrix< \
sv 1:6799c07fe510 976 XprBinOp< \
sv 1:6799c07fe510 977 Fcnl_##NAME<T1, T2>, \
sv 1:6799c07fe510 978 MatrixConstReference<T1, Rows, Cols>, \
sv 1:6799c07fe510 979 MatrixConstReference<T2, Rows, Cols> \
sv 1:6799c07fe510 980 >, \
sv 1:6799c07fe510 981 Rows, Cols \
sv 1:6799c07fe510 982 > \
sv 1:6799c07fe510 983 operator OP (const Matrix<T1, Rows, Cols>& lhs, \
sv 1:6799c07fe510 984 const Matrix<T2, Rows, Cols>& rhs) { \
sv 1:6799c07fe510 985 typedef XprBinOp < \
sv 1:6799c07fe510 986 Fcnl_##NAME<T1, T2>, \
sv 1:6799c07fe510 987 MatrixConstReference<T1, Rows, Cols>, \
sv 1:6799c07fe510 988 MatrixConstReference<T2, Rows, Cols> \
sv 1:6799c07fe510 989 > expr_type; \
sv 1:6799c07fe510 990 return XprMatrix<expr_type, Rows, Cols>(expr_type(lhs.const_ref(), rhs.const_ref())); \
sv 1:6799c07fe510 991 } \
sv 1:6799c07fe510 992 \
sv 1:6799c07fe510 993 template<class E, \
sv 1:6799c07fe510 994 class T, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 995 inline \
sv 1:6799c07fe510 996 XprMatrix< \
sv 1:6799c07fe510 997 XprBinOp< \
sv 1:6799c07fe510 998 Fcnl_##NAME<typename E::value_type, T>, \
sv 1:6799c07fe510 999 XprMatrix<E, Rows, Cols>, \
sv 1:6799c07fe510 1000 MatrixConstReference<T, Rows, Cols> \
sv 1:6799c07fe510 1001 >, \
sv 1:6799c07fe510 1002 Rows, Cols \
sv 1:6799c07fe510 1003 > \
sv 1:6799c07fe510 1004 operator OP (const XprMatrix<E, Rows, Cols>& lhs, const Matrix<T, Rows, Cols>& rhs) { \
sv 1:6799c07fe510 1005 typedef XprBinOp< \
sv 1:6799c07fe510 1006 Fcnl_##NAME<typename E::value_type, T>, \
sv 1:6799c07fe510 1007 XprMatrix<E, Rows, Cols>, \
sv 1:6799c07fe510 1008 MatrixConstReference<T, Rows, Cols> \
sv 1:6799c07fe510 1009 > expr_type; \
sv 1:6799c07fe510 1010 return XprMatrix<expr_type, Rows, Cols>(expr_type(lhs, rhs.const_ref())); \
sv 1:6799c07fe510 1011 } \
sv 1:6799c07fe510 1012 \
sv 1:6799c07fe510 1013 template<class T, std::size_t Rows, std::size_t Cols, \
sv 1:6799c07fe510 1014 class E> \
sv 1:6799c07fe510 1015 inline \
sv 1:6799c07fe510 1016 XprMatrix< \
sv 1:6799c07fe510 1017 XprBinOp< \
sv 1:6799c07fe510 1018 Fcnl_##NAME<typename E::value_type, T>, \
sv 1:6799c07fe510 1019 MatrixConstReference<T, Rows, Cols>, \
sv 1:6799c07fe510 1020 XprMatrix<E, Rows, Cols> \
sv 1:6799c07fe510 1021 >, \
sv 1:6799c07fe510 1022 Rows, Cols \
sv 1:6799c07fe510 1023 > \
sv 1:6799c07fe510 1024 operator OP (const Matrix<T, Rows, Cols>& lhs, const XprMatrix<E, Rows, Cols>& rhs) { \
sv 1:6799c07fe510 1025 typedef XprBinOp< \
sv 1:6799c07fe510 1026 Fcnl_##NAME<T, typename E::value_type>, \
sv 1:6799c07fe510 1027 MatrixConstReference<T, Rows, Cols>, \
sv 1:6799c07fe510 1028 XprMatrix<E, Rows, Cols> \
sv 1:6799c07fe510 1029 > expr_type; \
sv 1:6799c07fe510 1030 return XprMatrix<expr_type, Rows, Cols>(expr_type(lhs.const_ref(), rhs)); \
sv 1:6799c07fe510 1031 }
sv 1:6799c07fe510 1032
sv 1:6799c07fe510 1033 // integer operators only, e.g used on double you wil get an error
sv 1:6799c07fe510 1034 namespace element_wise {
sv 1:6799c07fe510 1035 TVMET_IMPLEMENT_MACRO(mod, %)
sv 1:6799c07fe510 1036 TVMET_IMPLEMENT_MACRO(bitxor, ^)
sv 1:6799c07fe510 1037 TVMET_IMPLEMENT_MACRO(bitand, &)
sv 1:6799c07fe510 1038 TVMET_IMPLEMENT_MACRO(bitor, |)
sv 1:6799c07fe510 1039 TVMET_IMPLEMENT_MACRO(shl, <<)
sv 1:6799c07fe510 1040 TVMET_IMPLEMENT_MACRO(shr, >>)
sv 1:6799c07fe510 1041 }
sv 1:6799c07fe510 1042
sv 1:6799c07fe510 1043 // necessary operators for eval functions
sv 1:6799c07fe510 1044 TVMET_IMPLEMENT_MACRO(greater, >)
sv 1:6799c07fe510 1045 TVMET_IMPLEMENT_MACRO(less, <)
sv 1:6799c07fe510 1046 TVMET_IMPLEMENT_MACRO(greater_eq, >=)
sv 1:6799c07fe510 1047 TVMET_IMPLEMENT_MACRO(less_eq, <=)
sv 1:6799c07fe510 1048 TVMET_IMPLEMENT_MACRO(eq, ==)
sv 1:6799c07fe510 1049 TVMET_IMPLEMENT_MACRO(not_eq, !=)
sv 1:6799c07fe510 1050 TVMET_IMPLEMENT_MACRO(and, &&)
sv 1:6799c07fe510 1051 TVMET_IMPLEMENT_MACRO(or, ||)
sv 1:6799c07fe510 1052
sv 1:6799c07fe510 1053 #undef TVMET_IMPLEMENT_MACRO
sv 1:6799c07fe510 1054
sv 1:6799c07fe510 1055
sv 1:6799c07fe510 1056 #if defined(TVMET_HAVE_COMPLEX)
sv 1:6799c07fe510 1057 /*
sv 1:6799c07fe510 1058 * operator(Matrix<T, Rows, Cols>, complex<T>)
sv 1:6799c07fe510 1059 * operator(complex<T>, Matrix<T, Rows, Cols>)
sv 1:6799c07fe510 1060 * Note: - per se element wise
sv 1:6799c07fe510 1061 * - bit ops on complex<int> doesn't make sense, stay away
sv 1:6799c07fe510 1062 * \todo type promotion
sv 1:6799c07fe510 1063 */
sv 1:6799c07fe510 1064 #define TVMET_IMPLEMENT_MACRO(NAME, OP) \
sv 1:6799c07fe510 1065 template<class T, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 1066 inline \
sv 1:6799c07fe510 1067 XprMatrix< \
sv 1:6799c07fe510 1068 XprBinOp< \
sv 1:6799c07fe510 1069 Fcnl_##NAME< std::complex<T>, std::complex<T> >, \
sv 1:6799c07fe510 1070 MatrixConstReference< std::complex<T>, Rows, Cols>, \
sv 1:6799c07fe510 1071 XprLiteral<std::complex<T> > \
sv 1:6799c07fe510 1072 >, \
sv 1:6799c07fe510 1073 Rows, Cols \
sv 1:6799c07fe510 1074 > \
sv 1:6799c07fe510 1075 operator OP (const Matrix< std::complex<T>, Rows, Cols>& lhs, \
sv 1:6799c07fe510 1076 const std::complex<T>& rhs) { \
sv 1:6799c07fe510 1077 typedef XprBinOp< \
sv 1:6799c07fe510 1078 Fcnl_##NAME< std::complex<T>, std::complex<T> >, \
sv 1:6799c07fe510 1079 MatrixConstReference< std::complex<T>, Rows, Cols>, \
sv 1:6799c07fe510 1080 XprLiteral< std::complex<T> > \
sv 1:6799c07fe510 1081 > expr_type; \
sv 1:6799c07fe510 1082 return XprMatrix<expr_type, Rows, Cols>( \
sv 1:6799c07fe510 1083 expr_type(lhs.const_ref(), XprLiteral< std::complex<T> >(rhs))); \
sv 1:6799c07fe510 1084 } \
sv 1:6799c07fe510 1085 \
sv 1:6799c07fe510 1086 template<class T, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 1087 inline \
sv 1:6799c07fe510 1088 XprMatrix< \
sv 1:6799c07fe510 1089 XprBinOp< \
sv 1:6799c07fe510 1090 Fcnl_##NAME< std::complex<T>, std::complex<T> >, \
sv 1:6799c07fe510 1091 XprLiteral< std::complex<T> >, \
sv 1:6799c07fe510 1092 MatrixConstReference< std::complex<T>, Rows, Cols> \
sv 1:6799c07fe510 1093 >, \
sv 1:6799c07fe510 1094 Rows, Cols \
sv 1:6799c07fe510 1095 > \
sv 1:6799c07fe510 1096 operator OP (const std::complex<T>& lhs, \
sv 1:6799c07fe510 1097 const Matrix< std::complex<T>, Rows, Cols>& rhs) { \
sv 1:6799c07fe510 1098 typedef XprBinOp< \
sv 1:6799c07fe510 1099 Fcnl_##NAME< std::complex<T>, std::complex<T> >, \
sv 1:6799c07fe510 1100 XprLiteral< std::complex<T> >, \
sv 1:6799c07fe510 1101 MatrixConstReference<T, Rows, Cols> \
sv 1:6799c07fe510 1102 > expr_type; \
sv 1:6799c07fe510 1103 return XprMatrix<expr_type, Rows, Cols>( \
sv 1:6799c07fe510 1104 expr_type(XprLiteral< std::complex<T> >(lhs), rhs.const_ref())); \
sv 1:6799c07fe510 1105 }
sv 1:6799c07fe510 1106
sv 1:6799c07fe510 1107 // necessary operators for eval functions
sv 1:6799c07fe510 1108 TVMET_IMPLEMENT_MACRO(greater, >)
sv 1:6799c07fe510 1109 TVMET_IMPLEMENT_MACRO(less, <)
sv 1:6799c07fe510 1110 TVMET_IMPLEMENT_MACRO(greater_eq, >=)
sv 1:6799c07fe510 1111 TVMET_IMPLEMENT_MACRO(less_eq, <=)
sv 1:6799c07fe510 1112 TVMET_IMPLEMENT_MACRO(eq, ==)
sv 1:6799c07fe510 1113 TVMET_IMPLEMENT_MACRO(not_eq, !=)
sv 1:6799c07fe510 1114 TVMET_IMPLEMENT_MACRO(and, &&)
sv 1:6799c07fe510 1115 TVMET_IMPLEMENT_MACRO(or, ||)
sv 1:6799c07fe510 1116
sv 1:6799c07fe510 1117 #undef TVMET_IMPLEMENT_MACRO
sv 1:6799c07fe510 1118
sv 1:6799c07fe510 1119 #endif // defined(TVMET_HAVE_COMPLEX)
sv 1:6799c07fe510 1120
sv 1:6799c07fe510 1121
sv 1:6799c07fe510 1122 /*
sv 1:6799c07fe510 1123 * operator(Matrix<T, Rows, Cols>, POD)
sv 1:6799c07fe510 1124 * operator(POD, Matrix<T, Rows, Cols>)
sv 1:6799c07fe510 1125 * Note: operations are per se element wise
sv 1:6799c07fe510 1126 */
sv 1:6799c07fe510 1127 #define TVMET_IMPLEMENT_MACRO(NAME, OP, TP) \
sv 1:6799c07fe510 1128 template<class T, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 1129 inline \
sv 1:6799c07fe510 1130 XprMatrix< \
sv 1:6799c07fe510 1131 XprBinOp< \
sv 1:6799c07fe510 1132 Fcnl_##NAME<T, TP >, \
sv 1:6799c07fe510 1133 MatrixConstReference<T, Rows, Cols>, \
sv 1:6799c07fe510 1134 XprLiteral<TP > \
sv 1:6799c07fe510 1135 >, \
sv 1:6799c07fe510 1136 Rows, Cols \
sv 1:6799c07fe510 1137 > \
sv 1:6799c07fe510 1138 operator OP (const Matrix<T, Rows, Cols>& lhs, TP rhs) { \
sv 1:6799c07fe510 1139 typedef XprBinOp< \
sv 1:6799c07fe510 1140 Fcnl_##NAME<T, TP >, \
sv 1:6799c07fe510 1141 MatrixConstReference<T, Rows, Cols>, \
sv 1:6799c07fe510 1142 XprLiteral< TP > \
sv 1:6799c07fe510 1143 > expr_type; \
sv 1:6799c07fe510 1144 return XprMatrix<expr_type, Rows, Cols>( \
sv 1:6799c07fe510 1145 expr_type(lhs.const_ref(), XprLiteral< TP >(rhs))); \
sv 1:6799c07fe510 1146 } \
sv 1:6799c07fe510 1147 \
sv 1:6799c07fe510 1148 template<class T, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 1149 inline \
sv 1:6799c07fe510 1150 XprMatrix< \
sv 1:6799c07fe510 1151 XprBinOp< \
sv 1:6799c07fe510 1152 Fcnl_##NAME< TP, T>, \
sv 1:6799c07fe510 1153 XprLiteral< TP >, \
sv 1:6799c07fe510 1154 MatrixConstReference<T, Rows, Cols> \
sv 1:6799c07fe510 1155 >, \
sv 1:6799c07fe510 1156 Rows, Cols \
sv 1:6799c07fe510 1157 > \
sv 1:6799c07fe510 1158 operator OP (TP lhs, const Matrix<T, Rows, Cols>& rhs) { \
sv 1:6799c07fe510 1159 typedef XprBinOp< \
sv 1:6799c07fe510 1160 Fcnl_##NAME< TP, T>, \
sv 1:6799c07fe510 1161 XprLiteral< TP >, \
sv 1:6799c07fe510 1162 MatrixConstReference<T, Rows, Cols> \
sv 1:6799c07fe510 1163 > expr_type; \
sv 1:6799c07fe510 1164 return XprMatrix<expr_type, Rows, Cols>( \
sv 1:6799c07fe510 1165 expr_type(XprLiteral< TP >(lhs), rhs.const_ref())); \
sv 1:6799c07fe510 1166 }
sv 1:6799c07fe510 1167
sv 1:6799c07fe510 1168 // integer operators only, e.g used on double you wil get an error
sv 1:6799c07fe510 1169 namespace element_wise {
sv 1:6799c07fe510 1170 TVMET_IMPLEMENT_MACRO(mod, %, int)
sv 1:6799c07fe510 1171 TVMET_IMPLEMENT_MACRO(bitxor, ^, int)
sv 1:6799c07fe510 1172 TVMET_IMPLEMENT_MACRO(bitand, &, int)
sv 1:6799c07fe510 1173 TVMET_IMPLEMENT_MACRO(bitor, |, int)
sv 1:6799c07fe510 1174 TVMET_IMPLEMENT_MACRO(shl, <<, int)
sv 1:6799c07fe510 1175 TVMET_IMPLEMENT_MACRO(shr, >>, int)
sv 1:6799c07fe510 1176 }
sv 1:6799c07fe510 1177
sv 1:6799c07fe510 1178 // necessary operators for eval functions
sv 1:6799c07fe510 1179 TVMET_IMPLEMENT_MACRO(greater, >, int)
sv 1:6799c07fe510 1180 TVMET_IMPLEMENT_MACRO(less, <, int)
sv 1:6799c07fe510 1181 TVMET_IMPLEMENT_MACRO(greater_eq, >=, int)
sv 1:6799c07fe510 1182 TVMET_IMPLEMENT_MACRO(less_eq, <=, int)
sv 1:6799c07fe510 1183 TVMET_IMPLEMENT_MACRO(eq, ==, int)
sv 1:6799c07fe510 1184 TVMET_IMPLEMENT_MACRO(not_eq, !=, int)
sv 1:6799c07fe510 1185 TVMET_IMPLEMENT_MACRO(and, &&, int)
sv 1:6799c07fe510 1186 TVMET_IMPLEMENT_MACRO(or, ||, int)
sv 1:6799c07fe510 1187
sv 1:6799c07fe510 1188 #if defined(TVMET_HAVE_LONG_LONG)
sv 1:6799c07fe510 1189 // integer operators only
sv 1:6799c07fe510 1190 namespace element_wise {
sv 1:6799c07fe510 1191 TVMET_IMPLEMENT_MACRO(mod, %, long long int)
sv 1:6799c07fe510 1192 TVMET_IMPLEMENT_MACRO(bitxor, ^, long long int)
sv 1:6799c07fe510 1193 TVMET_IMPLEMENT_MACRO(bitand, &, long long int)
sv 1:6799c07fe510 1194 TVMET_IMPLEMENT_MACRO(bitor, |, long long int)
sv 1:6799c07fe510 1195 TVMET_IMPLEMENT_MACRO(shl, <<, long long int)
sv 1:6799c07fe510 1196 TVMET_IMPLEMENT_MACRO(shr, >>, long long int)
sv 1:6799c07fe510 1197 }
sv 1:6799c07fe510 1198
sv 1:6799c07fe510 1199 // necessary operators for eval functions
sv 1:6799c07fe510 1200 TVMET_IMPLEMENT_MACRO(greater, >, long long int)
sv 1:6799c07fe510 1201 TVMET_IMPLEMENT_MACRO(less, <, long long int)
sv 1:6799c07fe510 1202 TVMET_IMPLEMENT_MACRO(greater_eq, >=, long long int)
sv 1:6799c07fe510 1203 TVMET_IMPLEMENT_MACRO(less_eq, <=, long long int)
sv 1:6799c07fe510 1204 TVMET_IMPLEMENT_MACRO(eq, ==, long long int)
sv 1:6799c07fe510 1205 TVMET_IMPLEMENT_MACRO(not_eq, !=, long long int)
sv 1:6799c07fe510 1206 TVMET_IMPLEMENT_MACRO(and, &&, long long int)
sv 1:6799c07fe510 1207 TVMET_IMPLEMENT_MACRO(or, ||, long long int)
sv 1:6799c07fe510 1208 #endif // defined(TVMET_HAVE_LONG_LONG)
sv 1:6799c07fe510 1209
sv 1:6799c07fe510 1210 // necessary operators for eval functions
sv 1:6799c07fe510 1211 TVMET_IMPLEMENT_MACRO(greater, >, float)
sv 1:6799c07fe510 1212 TVMET_IMPLEMENT_MACRO(less, <, float)
sv 1:6799c07fe510 1213 TVMET_IMPLEMENT_MACRO(greater_eq, >=, float)
sv 1:6799c07fe510 1214 TVMET_IMPLEMENT_MACRO(less_eq, <=, float)
sv 1:6799c07fe510 1215 TVMET_IMPLEMENT_MACRO(eq, ==, float)
sv 1:6799c07fe510 1216 TVMET_IMPLEMENT_MACRO(not_eq, !=, float)
sv 1:6799c07fe510 1217 TVMET_IMPLEMENT_MACRO(and, &&, float)
sv 1:6799c07fe510 1218 TVMET_IMPLEMENT_MACRO(or, ||, float)
sv 1:6799c07fe510 1219
sv 1:6799c07fe510 1220 // necessary operators for eval functions
sv 1:6799c07fe510 1221 TVMET_IMPLEMENT_MACRO(greater, >, double)
sv 1:6799c07fe510 1222 TVMET_IMPLEMENT_MACRO(less, <, double)
sv 1:6799c07fe510 1223 TVMET_IMPLEMENT_MACRO(greater_eq, >=, double)
sv 1:6799c07fe510 1224 TVMET_IMPLEMENT_MACRO(less_eq, <=, double)
sv 1:6799c07fe510 1225 TVMET_IMPLEMENT_MACRO(eq, ==, double)
sv 1:6799c07fe510 1226 TVMET_IMPLEMENT_MACRO(not_eq, !=, double)
sv 1:6799c07fe510 1227 TVMET_IMPLEMENT_MACRO(and, &&, double)
sv 1:6799c07fe510 1228 TVMET_IMPLEMENT_MACRO(or, ||, double)
sv 1:6799c07fe510 1229
sv 1:6799c07fe510 1230 #if defined(TVMET_HAVE_LONG_DOUBLE)
sv 1:6799c07fe510 1231 // necessary operators for eval functions
sv 1:6799c07fe510 1232 TVMET_IMPLEMENT_MACRO(greater, >, long double)
sv 1:6799c07fe510 1233 TVMET_IMPLEMENT_MACRO(less, <, long double)
sv 1:6799c07fe510 1234 TVMET_IMPLEMENT_MACRO(greater_eq, >=, long double)
sv 1:6799c07fe510 1235 TVMET_IMPLEMENT_MACRO(less_eq, <=, long double)
sv 1:6799c07fe510 1236 TVMET_IMPLEMENT_MACRO(eq, ==, long double)
sv 1:6799c07fe510 1237 TVMET_IMPLEMENT_MACRO(not_eq, !=, long double)
sv 1:6799c07fe510 1238 TVMET_IMPLEMENT_MACRO(and, &&, long double)
sv 1:6799c07fe510 1239 TVMET_IMPLEMENT_MACRO(or, ||, long double)
sv 1:6799c07fe510 1240 #endif // defined(TVMET_HAVE_LONG_DOUBLE)
sv 1:6799c07fe510 1241
sv 1:6799c07fe510 1242 #undef TVMET_IMPLEMENT_MACRO
sv 1:6799c07fe510 1243
sv 1:6799c07fe510 1244
sv 1:6799c07fe510 1245
sv 1:6799c07fe510 1246
sv 1:6799c07fe510 1247 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sv 1:6799c07fe510 1248 * global unary operators
sv 1:6799c07fe510 1249 *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
sv 1:6799c07fe510 1250
sv 1:6799c07fe510 1251
sv 1:6799c07fe510 1252 /*
sv 1:6799c07fe510 1253 * unary_operator(Matrix<T, Rows, Cols>)
sv 1:6799c07fe510 1254 * Note: per se element wise
sv 1:6799c07fe510 1255 */
sv 1:6799c07fe510 1256 #define TVMET_IMPLEMENT_MACRO(NAME, OP) \
sv 1:6799c07fe510 1257 template <class T, std::size_t Rows, std::size_t Cols> \
sv 1:6799c07fe510 1258 inline \
sv 1:6799c07fe510 1259 XprMatrix< \
sv 1:6799c07fe510 1260 XprUnOp< \
sv 1:6799c07fe510 1261 Fcnl_##NAME<T>, \
sv 1:6799c07fe510 1262 MatrixConstReference<T, Rows, Cols> \
sv 1:6799c07fe510 1263 >, \
sv 1:6799c07fe510 1264 Rows, Cols \
sv 1:6799c07fe510 1265 > \
sv 1:6799c07fe510 1266 operator OP (const Matrix<T, Rows, Cols>& rhs) { \
sv 1:6799c07fe510 1267 typedef XprUnOp< \
sv 1:6799c07fe510 1268 Fcnl_##NAME<T>, \
sv 1:6799c07fe510 1269 MatrixConstReference<T, Rows, Cols> \
sv 1:6799c07fe510 1270 > expr_type; \
sv 1:6799c07fe510 1271 return XprMatrix<expr_type, Rows, Cols>(expr_type(rhs.const_ref())); \
sv 1:6799c07fe510 1272 }
sv 1:6799c07fe510 1273
sv 1:6799c07fe510 1274 TVMET_IMPLEMENT_MACRO(not, !)
sv 1:6799c07fe510 1275 TVMET_IMPLEMENT_MACRO(compl, ~)
sv 1:6799c07fe510 1276 TVMET_IMPLEMENT_MACRO(neg, -)
sv 1:6799c07fe510 1277 #undef TVMET_IMPLEMENT_MACRO
sv 1:6799c07fe510 1278
sv 1:6799c07fe510 1279
sv 1:6799c07fe510 1280 } // namespace tvmet
sv 1:6799c07fe510 1281
sv 1:6799c07fe510 1282 #endif // TVMET_MATRIX_OPERATORS_H
sv 1:6799c07fe510 1283
sv 1:6799c07fe510 1284 // Local Variables:
sv 1:6799c07fe510 1285 // mode:C++
sv 1:6799c07fe510 1286 // tab-width:8
sv 1:6799c07fe510 1287 // End: