![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
This is some awesome robot code
Dependencies: mbed-rtos mbed QEI
Fork of ICRSEurobot13 by
tvmet/xpr/MatrixFunctions.h@90:e4164bb8c60e, 2013-04-17 (annotated)
- Committer:
- madcowswe
- Date:
- Wed Apr 17 23:16:25 2013 +0000
- Revision:
- 90:e4164bb8c60e
- Parent:
- 15:9c5aaeda36dc
final state at end of competition. Includes avoid wooden team hack
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
madcowswe | 15:9c5aaeda36dc | 1 | /* |
madcowswe | 15:9c5aaeda36dc | 2 | * Tiny Vector Matrix Library |
madcowswe | 15:9c5aaeda36dc | 3 | * Dense Vector Matrix Libary of Tiny size using Expression Templates |
madcowswe | 15:9c5aaeda36dc | 4 | * |
madcowswe | 15:9c5aaeda36dc | 5 | * Copyright (C) 2001 - 2007 Olaf Petzold <opetzold@users.sourceforge.net> |
madcowswe | 15:9c5aaeda36dc | 6 | * |
madcowswe | 15:9c5aaeda36dc | 7 | * This library is free software; you can redistribute it and/or |
madcowswe | 15:9c5aaeda36dc | 8 | * modify it under the terms of the GNU lesser General Public |
madcowswe | 15:9c5aaeda36dc | 9 | * License as published by the Free Software Foundation; either |
madcowswe | 15:9c5aaeda36dc | 10 | * version 2.1 of the License, or (at your option) any later version. |
madcowswe | 15:9c5aaeda36dc | 11 | * |
madcowswe | 15:9c5aaeda36dc | 12 | * This library is distributed in the hope that it will be useful, |
madcowswe | 15:9c5aaeda36dc | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
madcowswe | 15:9c5aaeda36dc | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
madcowswe | 15:9c5aaeda36dc | 15 | * lesser General Public License for more details. |
madcowswe | 15:9c5aaeda36dc | 16 | * |
madcowswe | 15:9c5aaeda36dc | 17 | * You should have received a copy of the GNU lesser General Public |
madcowswe | 15:9c5aaeda36dc | 18 | * License along with this library; if not, write to the Free Software |
madcowswe | 15:9c5aaeda36dc | 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
madcowswe | 15:9c5aaeda36dc | 20 | * |
madcowswe | 15:9c5aaeda36dc | 21 | * $Id: MatrixFunctions.h,v 1.44 2007-06-23 15:59:00 opetzold Exp $ |
madcowswe | 15:9c5aaeda36dc | 22 | */ |
madcowswe | 15:9c5aaeda36dc | 23 | |
madcowswe | 15:9c5aaeda36dc | 24 | #ifndef TVMET_XPR_MATRIX_FUNCTIONS_H |
madcowswe | 15:9c5aaeda36dc | 25 | #define TVMET_XPR_MATRIX_FUNCTIONS_H |
madcowswe | 15:9c5aaeda36dc | 26 | |
madcowswe | 15:9c5aaeda36dc | 27 | namespace tvmet { |
madcowswe | 15:9c5aaeda36dc | 28 | |
madcowswe | 15:9c5aaeda36dc | 29 | |
madcowswe | 15:9c5aaeda36dc | 30 | /* forwards */ |
madcowswe | 15:9c5aaeda36dc | 31 | template<class T, std::size_t Rows, std::size_t Cols> class Matrix; |
madcowswe | 15:9c5aaeda36dc | 32 | template<class T, std::size_t Sz> class Vector; |
madcowswe | 15:9c5aaeda36dc | 33 | template<class E, std::size_t Sz> class XprVector; |
madcowswe | 15:9c5aaeda36dc | 34 | template<class E> class XprMatrixTranspose; |
madcowswe | 15:9c5aaeda36dc | 35 | template<class E, std::size_t Sz> class XprMatrixDiag; |
madcowswe | 15:9c5aaeda36dc | 36 | template<class E, std::size_t Rows, std::size_t Cols> class XprMatrixRow; |
madcowswe | 15:9c5aaeda36dc | 37 | template<class E, std::size_t Rows, std::size_t Cols> class XprMatrixCol; |
madcowswe | 15:9c5aaeda36dc | 38 | |
madcowswe | 15:9c5aaeda36dc | 39 | |
madcowswe | 15:9c5aaeda36dc | 40 | /********************************************************* |
madcowswe | 15:9c5aaeda36dc | 41 | * PART I: DECLARATION |
madcowswe | 15:9c5aaeda36dc | 42 | *********************************************************/ |
madcowswe | 15:9c5aaeda36dc | 43 | |
madcowswe | 15:9c5aaeda36dc | 44 | |
madcowswe | 15:9c5aaeda36dc | 45 | /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
madcowswe | 15:9c5aaeda36dc | 46 | * Matrix arithmetic functions add, sub, mul and div |
madcowswe | 15:9c5aaeda36dc | 47 | *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
madcowswe | 15:9c5aaeda36dc | 48 | |
madcowswe | 15:9c5aaeda36dc | 49 | |
madcowswe | 15:9c5aaeda36dc | 50 | /* |
madcowswe | 15:9c5aaeda36dc | 51 | * function(XprMatrix<E1, Rows, Cols>, XprMatrix<E2, Rows, Cols>) |
madcowswe | 15:9c5aaeda36dc | 52 | */ |
madcowswe | 15:9c5aaeda36dc | 53 | #define TVMET_DECLARE_MACRO(NAME) \ |
madcowswe | 15:9c5aaeda36dc | 54 | template<class E1, class E2, std::size_t Rows, std::size_t Cols> \ |
madcowswe | 15:9c5aaeda36dc | 55 | XprMatrix< \ |
madcowswe | 15:9c5aaeda36dc | 56 | XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 57 | Fcnl_##NAME<typename E1::value_type, typename E2::value_type>, \ |
madcowswe | 15:9c5aaeda36dc | 58 | XprMatrix<E1, Rows, Cols>, \ |
madcowswe | 15:9c5aaeda36dc | 59 | XprMatrix<E2, Rows, Cols> \ |
madcowswe | 15:9c5aaeda36dc | 60 | >, \ |
madcowswe | 15:9c5aaeda36dc | 61 | Rows, Cols \ |
madcowswe | 15:9c5aaeda36dc | 62 | > \ |
madcowswe | 15:9c5aaeda36dc | 63 | NAME (const XprMatrix<E1, Rows, Cols>& lhs, \ |
madcowswe | 15:9c5aaeda36dc | 64 | const XprMatrix<E2, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE; |
madcowswe | 15:9c5aaeda36dc | 65 | |
madcowswe | 15:9c5aaeda36dc | 66 | TVMET_DECLARE_MACRO(add) // per se element wise |
madcowswe | 15:9c5aaeda36dc | 67 | TVMET_DECLARE_MACRO(sub) // per se element wise |
madcowswe | 15:9c5aaeda36dc | 68 | namespace element_wise { |
madcowswe | 15:9c5aaeda36dc | 69 | TVMET_DECLARE_MACRO(mul) // not defined for matrizes |
madcowswe | 15:9c5aaeda36dc | 70 | TVMET_DECLARE_MACRO(div) // not defined for matrizes |
madcowswe | 15:9c5aaeda36dc | 71 | } |
madcowswe | 15:9c5aaeda36dc | 72 | |
madcowswe | 15:9c5aaeda36dc | 73 | #undef TVMET_DECLARE_MACRO |
madcowswe | 15:9c5aaeda36dc | 74 | |
madcowswe | 15:9c5aaeda36dc | 75 | |
madcowswe | 15:9c5aaeda36dc | 76 | /* |
madcowswe | 15:9c5aaeda36dc | 77 | * function(XprMatrix<E, Rows, Cols>, POD) |
madcowswe | 15:9c5aaeda36dc | 78 | * function(POD, XprMatrix<E, Rows, Cols>) |
madcowswe | 15:9c5aaeda36dc | 79 | * Note: - operations +,-,*,/ are per se element wise |
madcowswe | 15:9c5aaeda36dc | 80 | */ |
madcowswe | 15:9c5aaeda36dc | 81 | #define TVMET_DECLARE_MACRO(NAME, POD) \ |
madcowswe | 15:9c5aaeda36dc | 82 | template<class E, std::size_t Rows, std::size_t Cols> \ |
madcowswe | 15:9c5aaeda36dc | 83 | XprMatrix< \ |
madcowswe | 15:9c5aaeda36dc | 84 | XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 85 | Fcnl_##NAME<typename E::value_type, POD >, \ |
madcowswe | 15:9c5aaeda36dc | 86 | XprMatrix<E, Rows, Cols>, \ |
madcowswe | 15:9c5aaeda36dc | 87 | XprLiteral< POD > \ |
madcowswe | 15:9c5aaeda36dc | 88 | >, \ |
madcowswe | 15:9c5aaeda36dc | 89 | Rows, Cols \ |
madcowswe | 15:9c5aaeda36dc | 90 | > \ |
madcowswe | 15:9c5aaeda36dc | 91 | NAME (const XprMatrix<E, Rows, Cols>& lhs, \ |
madcowswe | 15:9c5aaeda36dc | 92 | POD rhs) TVMET_CXX_ALWAYS_INLINE; \ |
madcowswe | 15:9c5aaeda36dc | 93 | \ |
madcowswe | 15:9c5aaeda36dc | 94 | template<class E, std::size_t Rows, std::size_t Cols> \ |
madcowswe | 15:9c5aaeda36dc | 95 | XprMatrix< \ |
madcowswe | 15:9c5aaeda36dc | 96 | XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 97 | Fcnl_##NAME< POD, typename E::value_type>, \ |
madcowswe | 15:9c5aaeda36dc | 98 | XprLiteral< POD >, \ |
madcowswe | 15:9c5aaeda36dc | 99 | XprMatrix<E, Rows, Cols> \ |
madcowswe | 15:9c5aaeda36dc | 100 | >, \ |
madcowswe | 15:9c5aaeda36dc | 101 | Rows, Cols \ |
madcowswe | 15:9c5aaeda36dc | 102 | > \ |
madcowswe | 15:9c5aaeda36dc | 103 | NAME (POD lhs, \ |
madcowswe | 15:9c5aaeda36dc | 104 | const XprMatrix<E, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE; |
madcowswe | 15:9c5aaeda36dc | 105 | |
madcowswe | 15:9c5aaeda36dc | 106 | TVMET_DECLARE_MACRO(add, int) |
madcowswe | 15:9c5aaeda36dc | 107 | TVMET_DECLARE_MACRO(sub, int) |
madcowswe | 15:9c5aaeda36dc | 108 | TVMET_DECLARE_MACRO(mul, int) |
madcowswe | 15:9c5aaeda36dc | 109 | TVMET_DECLARE_MACRO(div, int) |
madcowswe | 15:9c5aaeda36dc | 110 | |
madcowswe | 15:9c5aaeda36dc | 111 | #if defined(TVMET_HAVE_LONG_LONG) |
madcowswe | 15:9c5aaeda36dc | 112 | TVMET_DECLARE_MACRO(add, long long int) |
madcowswe | 15:9c5aaeda36dc | 113 | TVMET_DECLARE_MACRO(sub, long long int) |
madcowswe | 15:9c5aaeda36dc | 114 | TVMET_DECLARE_MACRO(mul, long long int) |
madcowswe | 15:9c5aaeda36dc | 115 | TVMET_DECLARE_MACRO(div, long long int) |
madcowswe | 15:9c5aaeda36dc | 116 | #endif |
madcowswe | 15:9c5aaeda36dc | 117 | |
madcowswe | 15:9c5aaeda36dc | 118 | TVMET_DECLARE_MACRO(add, float) |
madcowswe | 15:9c5aaeda36dc | 119 | TVMET_DECLARE_MACRO(sub, float) |
madcowswe | 15:9c5aaeda36dc | 120 | TVMET_DECLARE_MACRO(mul, float) |
madcowswe | 15:9c5aaeda36dc | 121 | TVMET_DECLARE_MACRO(div, float) |
madcowswe | 15:9c5aaeda36dc | 122 | |
madcowswe | 15:9c5aaeda36dc | 123 | TVMET_DECLARE_MACRO(add, double) |
madcowswe | 15:9c5aaeda36dc | 124 | TVMET_DECLARE_MACRO(sub, double) |
madcowswe | 15:9c5aaeda36dc | 125 | TVMET_DECLARE_MACRO(mul, double) |
madcowswe | 15:9c5aaeda36dc | 126 | TVMET_DECLARE_MACRO(div, double) |
madcowswe | 15:9c5aaeda36dc | 127 | |
madcowswe | 15:9c5aaeda36dc | 128 | #if defined(TVMET_HAVE_LONG_DOUBLE) |
madcowswe | 15:9c5aaeda36dc | 129 | TVMET_DECLARE_MACRO(add, long double) |
madcowswe | 15:9c5aaeda36dc | 130 | TVMET_DECLARE_MACRO(sub, long double) |
madcowswe | 15:9c5aaeda36dc | 131 | TVMET_DECLARE_MACRO(mul, long double) |
madcowswe | 15:9c5aaeda36dc | 132 | TVMET_DECLARE_MACRO(div, long double) |
madcowswe | 15:9c5aaeda36dc | 133 | #endif |
madcowswe | 15:9c5aaeda36dc | 134 | |
madcowswe | 15:9c5aaeda36dc | 135 | #undef TVMET_DECLARE_MACRO |
madcowswe | 15:9c5aaeda36dc | 136 | |
madcowswe | 15:9c5aaeda36dc | 137 | |
madcowswe | 15:9c5aaeda36dc | 138 | #if defined(TVMET_HAVE_COMPLEX) |
madcowswe | 15:9c5aaeda36dc | 139 | /* |
madcowswe | 15:9c5aaeda36dc | 140 | * function(XprMatrix<E, Rows, Cols>, complex<T>) |
madcowswe | 15:9c5aaeda36dc | 141 | * function(complex<T>, XprMatrix<E, Rows, Cols>) |
madcowswe | 15:9c5aaeda36dc | 142 | * Note: - operations +,-,*,/ are per se element wise |
madcowswe | 15:9c5aaeda36dc | 143 | * \todo type promotion |
madcowswe | 15:9c5aaeda36dc | 144 | */ |
madcowswe | 15:9c5aaeda36dc | 145 | #define TVMET_DECLARE_MACRO(NAME) \ |
madcowswe | 15:9c5aaeda36dc | 146 | template<class E, class T, std::size_t Rows, std::size_t Cols> \ |
madcowswe | 15:9c5aaeda36dc | 147 | XprMatrix< \ |
madcowswe | 15:9c5aaeda36dc | 148 | XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 149 | Fcnl_##NAME<typename E::value_type, std::complex<T> >, \ |
madcowswe | 15:9c5aaeda36dc | 150 | XprMatrix<E, Rows, Cols>, \ |
madcowswe | 15:9c5aaeda36dc | 151 | XprLiteral< std::complex<T> > \ |
madcowswe | 15:9c5aaeda36dc | 152 | >, \ |
madcowswe | 15:9c5aaeda36dc | 153 | Rows, Cols \ |
madcowswe | 15:9c5aaeda36dc | 154 | > \ |
madcowswe | 15:9c5aaeda36dc | 155 | NAME (const XprMatrix<E, Rows, Cols>& lhs, \ |
madcowswe | 15:9c5aaeda36dc | 156 | const std::complex<T>& rhs) TVMET_CXX_ALWAYS_INLINE; \ |
madcowswe | 15:9c5aaeda36dc | 157 | \ |
madcowswe | 15:9c5aaeda36dc | 158 | template<class T, class E, std::size_t Rows, std::size_t Cols> \ |
madcowswe | 15:9c5aaeda36dc | 159 | XprMatrix< \ |
madcowswe | 15:9c5aaeda36dc | 160 | XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 161 | Fcnl_##NAME< std::complex<T>, typename E::value_type>, \ |
madcowswe | 15:9c5aaeda36dc | 162 | XprLiteral< std::complex<T> >, \ |
madcowswe | 15:9c5aaeda36dc | 163 | XprMatrix<E, Rows, Cols> \ |
madcowswe | 15:9c5aaeda36dc | 164 | >, \ |
madcowswe | 15:9c5aaeda36dc | 165 | Rows, Cols \ |
madcowswe | 15:9c5aaeda36dc | 166 | > \ |
madcowswe | 15:9c5aaeda36dc | 167 | NAME (const std::complex<T>& lhs, \ |
madcowswe | 15:9c5aaeda36dc | 168 | const XprMatrix<E, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE; |
madcowswe | 15:9c5aaeda36dc | 169 | |
madcowswe | 15:9c5aaeda36dc | 170 | TVMET_DECLARE_MACRO(add) |
madcowswe | 15:9c5aaeda36dc | 171 | TVMET_DECLARE_MACRO(sub) |
madcowswe | 15:9c5aaeda36dc | 172 | TVMET_DECLARE_MACRO(mul) |
madcowswe | 15:9c5aaeda36dc | 173 | TVMET_DECLARE_MACRO(div) |
madcowswe | 15:9c5aaeda36dc | 174 | |
madcowswe | 15:9c5aaeda36dc | 175 | #undef TVMET_DECLARE_MACRO |
madcowswe | 15:9c5aaeda36dc | 176 | |
madcowswe | 15:9c5aaeda36dc | 177 | #endif // defined(TVMET_HAVE_COMPLEX) |
madcowswe | 15:9c5aaeda36dc | 178 | |
madcowswe | 15:9c5aaeda36dc | 179 | |
madcowswe | 15:9c5aaeda36dc | 180 | /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
madcowswe | 15:9c5aaeda36dc | 181 | * matrix prod( ... ) functions |
madcowswe | 15:9c5aaeda36dc | 182 | *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
madcowswe | 15:9c5aaeda36dc | 183 | |
madcowswe | 15:9c5aaeda36dc | 184 | |
madcowswe | 15:9c5aaeda36dc | 185 | template<class E1, std::size_t Rows1, std::size_t Cols1, |
madcowswe | 15:9c5aaeda36dc | 186 | class E2, std::size_t Cols2> |
madcowswe | 15:9c5aaeda36dc | 187 | XprMatrix< |
madcowswe | 15:9c5aaeda36dc | 188 | XprMMProduct< |
madcowswe | 15:9c5aaeda36dc | 189 | XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) |
madcowswe | 15:9c5aaeda36dc | 190 | XprMatrix<E2, Cols1, Cols2>, Cols2 |
madcowswe | 15:9c5aaeda36dc | 191 | >, |
madcowswe | 15:9c5aaeda36dc | 192 | Rows1, Cols2 // return Dim |
madcowswe | 15:9c5aaeda36dc | 193 | > |
madcowswe | 15:9c5aaeda36dc | 194 | prod(const XprMatrix<E1, Rows1, Cols1>& lhs, |
madcowswe | 15:9c5aaeda36dc | 195 | const XprMatrix<E2, Cols1, Cols2>& rhs) TVMET_CXX_ALWAYS_INLINE; |
madcowswe | 15:9c5aaeda36dc | 196 | |
madcowswe | 15:9c5aaeda36dc | 197 | |
madcowswe | 15:9c5aaeda36dc | 198 | template<class E1, std::size_t Rows1, std::size_t Cols1, |
madcowswe | 15:9c5aaeda36dc | 199 | class E2, std::size_t Cols2> |
madcowswe | 15:9c5aaeda36dc | 200 | XprMatrix< |
madcowswe | 15:9c5aaeda36dc | 201 | XprMMProductTransposed< |
madcowswe | 15:9c5aaeda36dc | 202 | XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) |
madcowswe | 15:9c5aaeda36dc | 203 | XprMatrix<E2, Cols1, Cols2>, Cols2 // M2(Cols1, Cols2) |
madcowswe | 15:9c5aaeda36dc | 204 | >, |
madcowswe | 15:9c5aaeda36dc | 205 | Cols2, Rows1 // return Dim |
madcowswe | 15:9c5aaeda36dc | 206 | > |
madcowswe | 15:9c5aaeda36dc | 207 | trans_prod(const XprMatrix<E1, Rows1, Cols1>& lhs, |
madcowswe | 15:9c5aaeda36dc | 208 | const XprMatrix<E2, Cols1, Cols2>& rhs) TVMET_CXX_ALWAYS_INLINE; |
madcowswe | 15:9c5aaeda36dc | 209 | |
madcowswe | 15:9c5aaeda36dc | 210 | |
madcowswe | 15:9c5aaeda36dc | 211 | template<class E1, std::size_t Rows1, std::size_t Cols1, |
madcowswe | 15:9c5aaeda36dc | 212 | class E2, std::size_t Cols2> // Rows2 = Rows1 |
madcowswe | 15:9c5aaeda36dc | 213 | XprMatrix< |
madcowswe | 15:9c5aaeda36dc | 214 | XprMtMProduct< |
madcowswe | 15:9c5aaeda36dc | 215 | XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) |
madcowswe | 15:9c5aaeda36dc | 216 | XprMatrix<E2, Rows1, Cols2>, Cols2 // M2(Rows1, Cols2) |
madcowswe | 15:9c5aaeda36dc | 217 | >, |
madcowswe | 15:9c5aaeda36dc | 218 | Cols1, Cols2 // return Dim |
madcowswe | 15:9c5aaeda36dc | 219 | > |
madcowswe | 15:9c5aaeda36dc | 220 | MtM_prod(const XprMatrix<E1, Rows1, Cols1>& lhs, |
madcowswe | 15:9c5aaeda36dc | 221 | const XprMatrix<E2, Rows1, Cols2>& rhs) TVMET_CXX_ALWAYS_INLINE; |
madcowswe | 15:9c5aaeda36dc | 222 | |
madcowswe | 15:9c5aaeda36dc | 223 | |
madcowswe | 15:9c5aaeda36dc | 224 | template<class E1, std::size_t Rows1, std::size_t Cols1, |
madcowswe | 15:9c5aaeda36dc | 225 | class E2, std::size_t Rows2> // Cols2 = Cols1 |
madcowswe | 15:9c5aaeda36dc | 226 | XprMatrix< |
madcowswe | 15:9c5aaeda36dc | 227 | XprMMtProduct< |
madcowswe | 15:9c5aaeda36dc | 228 | XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) |
madcowswe | 15:9c5aaeda36dc | 229 | XprMatrix<E2, Rows2, Cols1>, Cols1 // M2(Rows2, Cols1) |
madcowswe | 15:9c5aaeda36dc | 230 | >, |
madcowswe | 15:9c5aaeda36dc | 231 | Rows1, Rows2 // return Dim |
madcowswe | 15:9c5aaeda36dc | 232 | > |
madcowswe | 15:9c5aaeda36dc | 233 | MMt_prod(const XprMatrix<E1, Rows1, Cols1>& lhs, |
madcowswe | 15:9c5aaeda36dc | 234 | const XprMatrix<E2, Rows2, Cols1>& rhs) TVMET_CXX_ALWAYS_INLINE; |
madcowswe | 15:9c5aaeda36dc | 235 | |
madcowswe | 15:9c5aaeda36dc | 236 | |
madcowswe | 15:9c5aaeda36dc | 237 | /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
madcowswe | 15:9c5aaeda36dc | 238 | * matrix-vector specific prod( ... ) functions |
madcowswe | 15:9c5aaeda36dc | 239 | *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
madcowswe | 15:9c5aaeda36dc | 240 | |
madcowswe | 15:9c5aaeda36dc | 241 | |
madcowswe | 15:9c5aaeda36dc | 242 | template<class E1, std::size_t Rows, std::size_t Cols, |
madcowswe | 15:9c5aaeda36dc | 243 | class E2> |
madcowswe | 15:9c5aaeda36dc | 244 | XprVector< |
madcowswe | 15:9c5aaeda36dc | 245 | XprMVProduct< |
madcowswe | 15:9c5aaeda36dc | 246 | XprMatrix<E1, Rows, Cols>, Rows, Cols, |
madcowswe | 15:9c5aaeda36dc | 247 | XprVector<E2, Cols> |
madcowswe | 15:9c5aaeda36dc | 248 | >, |
madcowswe | 15:9c5aaeda36dc | 249 | Rows |
madcowswe | 15:9c5aaeda36dc | 250 | > |
madcowswe | 15:9c5aaeda36dc | 251 | prod(const XprMatrix<E1, Rows, Cols>& lhs, |
madcowswe | 15:9c5aaeda36dc | 252 | const XprVector<E2, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE; |
madcowswe | 15:9c5aaeda36dc | 253 | |
madcowswe | 15:9c5aaeda36dc | 254 | |
madcowswe | 15:9c5aaeda36dc | 255 | /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
madcowswe | 15:9c5aaeda36dc | 256 | * matrix specific functions |
madcowswe | 15:9c5aaeda36dc | 257 | *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
madcowswe | 15:9c5aaeda36dc | 258 | |
madcowswe | 15:9c5aaeda36dc | 259 | |
madcowswe | 15:9c5aaeda36dc | 260 | template<class E, std::size_t Rows, std::size_t Cols> |
madcowswe | 15:9c5aaeda36dc | 261 | XprMatrix< |
madcowswe | 15:9c5aaeda36dc | 262 | XprMatrixTranspose< |
madcowswe | 15:9c5aaeda36dc | 263 | XprMatrix<E, Rows, Cols> |
madcowswe | 15:9c5aaeda36dc | 264 | >, |
madcowswe | 15:9c5aaeda36dc | 265 | Cols, Rows |
madcowswe | 15:9c5aaeda36dc | 266 | > |
madcowswe | 15:9c5aaeda36dc | 267 | trans(const XprMatrix<E, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE; |
madcowswe | 15:9c5aaeda36dc | 268 | |
madcowswe | 15:9c5aaeda36dc | 269 | |
madcowswe | 15:9c5aaeda36dc | 270 | template<class E, std::size_t Sz> |
madcowswe | 15:9c5aaeda36dc | 271 | typename NumericTraits<typename E::value_type>::sum_type |
madcowswe | 15:9c5aaeda36dc | 272 | trace(const XprMatrix<E, Sz, Sz>& m) TVMET_CXX_ALWAYS_INLINE; |
madcowswe | 15:9c5aaeda36dc | 273 | |
madcowswe | 15:9c5aaeda36dc | 274 | |
madcowswe | 15:9c5aaeda36dc | 275 | template<class E, std::size_t Rows, std::size_t Cols> |
madcowswe | 15:9c5aaeda36dc | 276 | XprVector< |
madcowswe | 15:9c5aaeda36dc | 277 | XprMatrixRow< |
madcowswe | 15:9c5aaeda36dc | 278 | XprMatrix<E, Rows, Cols>, |
madcowswe | 15:9c5aaeda36dc | 279 | Rows, Cols |
madcowswe | 15:9c5aaeda36dc | 280 | >, |
madcowswe | 15:9c5aaeda36dc | 281 | Cols |
madcowswe | 15:9c5aaeda36dc | 282 | > |
madcowswe | 15:9c5aaeda36dc | 283 | row(const XprMatrix<E, Rows, Cols>& m, |
madcowswe | 15:9c5aaeda36dc | 284 | std::size_t no) TVMET_CXX_ALWAYS_INLINE; |
madcowswe | 15:9c5aaeda36dc | 285 | |
madcowswe | 15:9c5aaeda36dc | 286 | |
madcowswe | 15:9c5aaeda36dc | 287 | template<class E, std::size_t Rows, std::size_t Cols> |
madcowswe | 15:9c5aaeda36dc | 288 | XprVector< |
madcowswe | 15:9c5aaeda36dc | 289 | XprMatrixCol< |
madcowswe | 15:9c5aaeda36dc | 290 | XprMatrix<E, Rows, Cols>, |
madcowswe | 15:9c5aaeda36dc | 291 | Rows, Cols |
madcowswe | 15:9c5aaeda36dc | 292 | >, |
madcowswe | 15:9c5aaeda36dc | 293 | Rows |
madcowswe | 15:9c5aaeda36dc | 294 | > |
madcowswe | 15:9c5aaeda36dc | 295 | col(const XprMatrix<E, Rows, Cols>& m, std::size_t no) TVMET_CXX_ALWAYS_INLINE; |
madcowswe | 15:9c5aaeda36dc | 296 | |
madcowswe | 15:9c5aaeda36dc | 297 | |
madcowswe | 15:9c5aaeda36dc | 298 | template<class E, std::size_t Sz> |
madcowswe | 15:9c5aaeda36dc | 299 | XprVector< |
madcowswe | 15:9c5aaeda36dc | 300 | XprMatrixDiag< |
madcowswe | 15:9c5aaeda36dc | 301 | XprMatrix<E, Sz, Sz>, |
madcowswe | 15:9c5aaeda36dc | 302 | Sz |
madcowswe | 15:9c5aaeda36dc | 303 | >, |
madcowswe | 15:9c5aaeda36dc | 304 | Sz |
madcowswe | 15:9c5aaeda36dc | 305 | > |
madcowswe | 15:9c5aaeda36dc | 306 | diag(const XprMatrix<E, Sz, Sz>& m) TVMET_CXX_ALWAYS_INLINE; |
madcowswe | 15:9c5aaeda36dc | 307 | |
madcowswe | 15:9c5aaeda36dc | 308 | |
madcowswe | 15:9c5aaeda36dc | 309 | /********************************************************* |
madcowswe | 15:9c5aaeda36dc | 310 | * PART II: IMPLEMENTATION |
madcowswe | 15:9c5aaeda36dc | 311 | *********************************************************/ |
madcowswe | 15:9c5aaeda36dc | 312 | |
madcowswe | 15:9c5aaeda36dc | 313 | |
madcowswe | 15:9c5aaeda36dc | 314 | /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
madcowswe | 15:9c5aaeda36dc | 315 | * Matrix arithmetic functions add, sub, mul and div |
madcowswe | 15:9c5aaeda36dc | 316 | *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
madcowswe | 15:9c5aaeda36dc | 317 | |
madcowswe | 15:9c5aaeda36dc | 318 | |
madcowswe | 15:9c5aaeda36dc | 319 | /* |
madcowswe | 15:9c5aaeda36dc | 320 | * function(XprMatrix<E1, Rows, Cols>, XprMatrix<E2, Rows, Cols>) |
madcowswe | 15:9c5aaeda36dc | 321 | */ |
madcowswe | 15:9c5aaeda36dc | 322 | #define TVMET_IMPLEMENT_MACRO(NAME) \ |
madcowswe | 15:9c5aaeda36dc | 323 | template<class E1, class E2, std::size_t Rows, std::size_t Cols> \ |
madcowswe | 15:9c5aaeda36dc | 324 | inline \ |
madcowswe | 15:9c5aaeda36dc | 325 | XprMatrix< \ |
madcowswe | 15:9c5aaeda36dc | 326 | XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 327 | Fcnl_##NAME<typename E1::value_type, typename E2::value_type>, \ |
madcowswe | 15:9c5aaeda36dc | 328 | XprMatrix<E1, Rows, Cols>, \ |
madcowswe | 15:9c5aaeda36dc | 329 | XprMatrix<E2, Rows, Cols> \ |
madcowswe | 15:9c5aaeda36dc | 330 | >, \ |
madcowswe | 15:9c5aaeda36dc | 331 | Rows, Cols \ |
madcowswe | 15:9c5aaeda36dc | 332 | > \ |
madcowswe | 15:9c5aaeda36dc | 333 | NAME (const XprMatrix<E1, Rows, Cols>& lhs, \ |
madcowswe | 15:9c5aaeda36dc | 334 | const XprMatrix<E2, Rows, Cols>& rhs) { \ |
madcowswe | 15:9c5aaeda36dc | 335 | typedef XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 336 | Fcnl_##NAME<typename E1::value_type, typename E2::value_type>, \ |
madcowswe | 15:9c5aaeda36dc | 337 | XprMatrix<E1, Rows, Cols>, \ |
madcowswe | 15:9c5aaeda36dc | 338 | XprMatrix<E2, Rows, Cols> \ |
madcowswe | 15:9c5aaeda36dc | 339 | > expr_type; \ |
madcowswe | 15:9c5aaeda36dc | 340 | return XprMatrix<expr_type, Rows, Cols>(expr_type(lhs, rhs)); \ |
madcowswe | 15:9c5aaeda36dc | 341 | } |
madcowswe | 15:9c5aaeda36dc | 342 | |
madcowswe | 15:9c5aaeda36dc | 343 | TVMET_IMPLEMENT_MACRO(add) // per se element wise |
madcowswe | 15:9c5aaeda36dc | 344 | TVMET_IMPLEMENT_MACRO(sub) // per se element wise |
madcowswe | 15:9c5aaeda36dc | 345 | namespace element_wise { |
madcowswe | 15:9c5aaeda36dc | 346 | TVMET_IMPLEMENT_MACRO(mul) // not defined for matrizes |
madcowswe | 15:9c5aaeda36dc | 347 | TVMET_IMPLEMENT_MACRO(div) // not defined for matrizes |
madcowswe | 15:9c5aaeda36dc | 348 | } |
madcowswe | 15:9c5aaeda36dc | 349 | |
madcowswe | 15:9c5aaeda36dc | 350 | #undef TVMET_IMPLEMENT_MACRO |
madcowswe | 15:9c5aaeda36dc | 351 | |
madcowswe | 15:9c5aaeda36dc | 352 | |
madcowswe | 15:9c5aaeda36dc | 353 | /* |
madcowswe | 15:9c5aaeda36dc | 354 | * function(XprMatrix<E, Rows, Cols>, POD) |
madcowswe | 15:9c5aaeda36dc | 355 | * function(POD, XprMatrix<E, Rows, Cols>) |
madcowswe | 15:9c5aaeda36dc | 356 | * Note: - operations +,-,*,/ are per se element wise |
madcowswe | 15:9c5aaeda36dc | 357 | */ |
madcowswe | 15:9c5aaeda36dc | 358 | #define TVMET_IMPLEMENT_MACRO(NAME, POD) \ |
madcowswe | 15:9c5aaeda36dc | 359 | template<class E, std::size_t Rows, std::size_t Cols> \ |
madcowswe | 15:9c5aaeda36dc | 360 | inline \ |
madcowswe | 15:9c5aaeda36dc | 361 | XprMatrix< \ |
madcowswe | 15:9c5aaeda36dc | 362 | XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 363 | Fcnl_##NAME<typename E::value_type, POD >, \ |
madcowswe | 15:9c5aaeda36dc | 364 | XprMatrix<E, Rows, Cols>, \ |
madcowswe | 15:9c5aaeda36dc | 365 | XprLiteral< POD > \ |
madcowswe | 15:9c5aaeda36dc | 366 | >, \ |
madcowswe | 15:9c5aaeda36dc | 367 | Rows, Cols \ |
madcowswe | 15:9c5aaeda36dc | 368 | > \ |
madcowswe | 15:9c5aaeda36dc | 369 | NAME (const XprMatrix<E, Rows, Cols>& lhs, POD rhs) { \ |
madcowswe | 15:9c5aaeda36dc | 370 | typedef XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 371 | Fcnl_##NAME<typename E::value_type, POD >, \ |
madcowswe | 15:9c5aaeda36dc | 372 | XprMatrix<E, Rows, Cols>, \ |
madcowswe | 15:9c5aaeda36dc | 373 | XprLiteral< POD > \ |
madcowswe | 15:9c5aaeda36dc | 374 | > expr_type; \ |
madcowswe | 15:9c5aaeda36dc | 375 | return XprMatrix<expr_type, Rows, Cols>( \ |
madcowswe | 15:9c5aaeda36dc | 376 | expr_type(lhs, XprLiteral< POD >(rhs))); \ |
madcowswe | 15:9c5aaeda36dc | 377 | } \ |
madcowswe | 15:9c5aaeda36dc | 378 | \ |
madcowswe | 15:9c5aaeda36dc | 379 | template<class E, std::size_t Rows, std::size_t Cols> \ |
madcowswe | 15:9c5aaeda36dc | 380 | inline \ |
madcowswe | 15:9c5aaeda36dc | 381 | XprMatrix< \ |
madcowswe | 15:9c5aaeda36dc | 382 | XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 383 | Fcnl_##NAME< POD, typename E::value_type>, \ |
madcowswe | 15:9c5aaeda36dc | 384 | XprLiteral< POD >, \ |
madcowswe | 15:9c5aaeda36dc | 385 | XprMatrix<E, Rows, Cols> \ |
madcowswe | 15:9c5aaeda36dc | 386 | >, \ |
madcowswe | 15:9c5aaeda36dc | 387 | Rows, Cols \ |
madcowswe | 15:9c5aaeda36dc | 388 | > \ |
madcowswe | 15:9c5aaeda36dc | 389 | NAME (POD lhs, const XprMatrix<E, Rows, Cols>& rhs) { \ |
madcowswe | 15:9c5aaeda36dc | 390 | typedef XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 391 | Fcnl_##NAME< POD, typename E::value_type>, \ |
madcowswe | 15:9c5aaeda36dc | 392 | XprLiteral< POD >, \ |
madcowswe | 15:9c5aaeda36dc | 393 | XprMatrix<E, Rows, Cols> \ |
madcowswe | 15:9c5aaeda36dc | 394 | > expr_type; \ |
madcowswe | 15:9c5aaeda36dc | 395 | return XprMatrix<expr_type, Rows, Cols>( \ |
madcowswe | 15:9c5aaeda36dc | 396 | expr_type(XprLiteral< POD >(lhs), rhs)); \ |
madcowswe | 15:9c5aaeda36dc | 397 | } |
madcowswe | 15:9c5aaeda36dc | 398 | |
madcowswe | 15:9c5aaeda36dc | 399 | TVMET_IMPLEMENT_MACRO(add, int) |
madcowswe | 15:9c5aaeda36dc | 400 | TVMET_IMPLEMENT_MACRO(sub, int) |
madcowswe | 15:9c5aaeda36dc | 401 | TVMET_IMPLEMENT_MACRO(mul, int) |
madcowswe | 15:9c5aaeda36dc | 402 | TVMET_IMPLEMENT_MACRO(div, int) |
madcowswe | 15:9c5aaeda36dc | 403 | |
madcowswe | 15:9c5aaeda36dc | 404 | #if defined(TVMET_HAVE_LONG_LONG) |
madcowswe | 15:9c5aaeda36dc | 405 | TVMET_IMPLEMENT_MACRO(add, long long int) |
madcowswe | 15:9c5aaeda36dc | 406 | TVMET_IMPLEMENT_MACRO(sub, long long int) |
madcowswe | 15:9c5aaeda36dc | 407 | TVMET_IMPLEMENT_MACRO(mul, long long int) |
madcowswe | 15:9c5aaeda36dc | 408 | TVMET_IMPLEMENT_MACRO(div, long long int) |
madcowswe | 15:9c5aaeda36dc | 409 | #endif |
madcowswe | 15:9c5aaeda36dc | 410 | |
madcowswe | 15:9c5aaeda36dc | 411 | TVMET_IMPLEMENT_MACRO(add, float) |
madcowswe | 15:9c5aaeda36dc | 412 | TVMET_IMPLEMENT_MACRO(sub, float) |
madcowswe | 15:9c5aaeda36dc | 413 | TVMET_IMPLEMENT_MACRO(mul, float) |
madcowswe | 15:9c5aaeda36dc | 414 | TVMET_IMPLEMENT_MACRO(div, float) |
madcowswe | 15:9c5aaeda36dc | 415 | |
madcowswe | 15:9c5aaeda36dc | 416 | TVMET_IMPLEMENT_MACRO(add, double) |
madcowswe | 15:9c5aaeda36dc | 417 | TVMET_IMPLEMENT_MACRO(sub, double) |
madcowswe | 15:9c5aaeda36dc | 418 | TVMET_IMPLEMENT_MACRO(mul, double) |
madcowswe | 15:9c5aaeda36dc | 419 | TVMET_IMPLEMENT_MACRO(div, double) |
madcowswe | 15:9c5aaeda36dc | 420 | |
madcowswe | 15:9c5aaeda36dc | 421 | #if defined(TVMET_HAVE_LONG_DOUBLE) |
madcowswe | 15:9c5aaeda36dc | 422 | TVMET_IMPLEMENT_MACRO(add, long double) |
madcowswe | 15:9c5aaeda36dc | 423 | TVMET_IMPLEMENT_MACRO(sub, long double) |
madcowswe | 15:9c5aaeda36dc | 424 | TVMET_IMPLEMENT_MACRO(mul, long double) |
madcowswe | 15:9c5aaeda36dc | 425 | TVMET_IMPLEMENT_MACRO(div, long double) |
madcowswe | 15:9c5aaeda36dc | 426 | #endif |
madcowswe | 15:9c5aaeda36dc | 427 | |
madcowswe | 15:9c5aaeda36dc | 428 | #undef TVMET_IMPLEMENT_MACRO |
madcowswe | 15:9c5aaeda36dc | 429 | |
madcowswe | 15:9c5aaeda36dc | 430 | |
madcowswe | 15:9c5aaeda36dc | 431 | #if defined(TVMET_HAVE_COMPLEX) |
madcowswe | 15:9c5aaeda36dc | 432 | /* |
madcowswe | 15:9c5aaeda36dc | 433 | * function(XprMatrix<E, Rows, Cols>, complex<T>) |
madcowswe | 15:9c5aaeda36dc | 434 | * function(complex<T>, XprMatrix<E, Rows, Cols>) |
madcowswe | 15:9c5aaeda36dc | 435 | * Note: - operations +,-,*,/ are per se element wise |
madcowswe | 15:9c5aaeda36dc | 436 | * \todo type promotion |
madcowswe | 15:9c5aaeda36dc | 437 | */ |
madcowswe | 15:9c5aaeda36dc | 438 | #define TVMET_IMPLEMENT_MACRO(NAME) \ |
madcowswe | 15:9c5aaeda36dc | 439 | template<class E, class T, std::size_t Rows, std::size_t Cols> \ |
madcowswe | 15:9c5aaeda36dc | 440 | inline \ |
madcowswe | 15:9c5aaeda36dc | 441 | XprMatrix< \ |
madcowswe | 15:9c5aaeda36dc | 442 | XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 443 | Fcnl_##NAME<typename E::value_type, std::complex<T> >, \ |
madcowswe | 15:9c5aaeda36dc | 444 | XprMatrix<E, Rows, Cols>, \ |
madcowswe | 15:9c5aaeda36dc | 445 | XprLiteral< std::complex<T> > \ |
madcowswe | 15:9c5aaeda36dc | 446 | >, \ |
madcowswe | 15:9c5aaeda36dc | 447 | Rows, Cols \ |
madcowswe | 15:9c5aaeda36dc | 448 | > \ |
madcowswe | 15:9c5aaeda36dc | 449 | NAME (const XprMatrix<E, Rows, Cols>& lhs, \ |
madcowswe | 15:9c5aaeda36dc | 450 | const std::complex<T>& rhs) { \ |
madcowswe | 15:9c5aaeda36dc | 451 | typedef XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 452 | Fcnl_##NAME<typename E::value_type, std::complex<T> >, \ |
madcowswe | 15:9c5aaeda36dc | 453 | XprMatrix<E, Rows, Cols>, \ |
madcowswe | 15:9c5aaeda36dc | 454 | XprLiteral< std::complex<T> > \ |
madcowswe | 15:9c5aaeda36dc | 455 | > expr_type; \ |
madcowswe | 15:9c5aaeda36dc | 456 | return XprMatrix<expr_type, Rows, Cols>( \ |
madcowswe | 15:9c5aaeda36dc | 457 | expr_type(lhs, XprLiteral< std::complex<T> >(rhs))); \ |
madcowswe | 15:9c5aaeda36dc | 458 | } \ |
madcowswe | 15:9c5aaeda36dc | 459 | \ |
madcowswe | 15:9c5aaeda36dc | 460 | template<class T, class E, std::size_t Rows, std::size_t Cols> \ |
madcowswe | 15:9c5aaeda36dc | 461 | inline \ |
madcowswe | 15:9c5aaeda36dc | 462 | XprMatrix< \ |
madcowswe | 15:9c5aaeda36dc | 463 | XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 464 | Fcnl_##NAME< std::complex<T>, typename E::value_type>, \ |
madcowswe | 15:9c5aaeda36dc | 465 | XprLiteral< std::complex<T> >, \ |
madcowswe | 15:9c5aaeda36dc | 466 | XprMatrix<E, Rows, Cols> \ |
madcowswe | 15:9c5aaeda36dc | 467 | >, \ |
madcowswe | 15:9c5aaeda36dc | 468 | Rows, Cols \ |
madcowswe | 15:9c5aaeda36dc | 469 | > \ |
madcowswe | 15:9c5aaeda36dc | 470 | NAME (const std::complex<T>& lhs, \ |
madcowswe | 15:9c5aaeda36dc | 471 | const XprMatrix<E, Rows, Cols>& rhs) { \ |
madcowswe | 15:9c5aaeda36dc | 472 | typedef XprBinOp< \ |
madcowswe | 15:9c5aaeda36dc | 473 | Fcnl_##NAME< std::complex<T>, typename E::value_type>, \ |
madcowswe | 15:9c5aaeda36dc | 474 | XprLiteral< std::complex<T> >, \ |
madcowswe | 15:9c5aaeda36dc | 475 | XprMatrix<E, Rows, Cols> \ |
madcowswe | 15:9c5aaeda36dc | 476 | > expr_type; \ |
madcowswe | 15:9c5aaeda36dc | 477 | return XprMatrix<expr_type, Rows, Cols>( \ |
madcowswe | 15:9c5aaeda36dc | 478 | expr_type(XprLiteral< std::complex<T> >(lhs), rhs)); \ |
madcowswe | 15:9c5aaeda36dc | 479 | } |
madcowswe | 15:9c5aaeda36dc | 480 | |
madcowswe | 15:9c5aaeda36dc | 481 | TVMET_IMPLEMENT_MACRO(add) |
madcowswe | 15:9c5aaeda36dc | 482 | TVMET_IMPLEMENT_MACRO(sub) |
madcowswe | 15:9c5aaeda36dc | 483 | TVMET_IMPLEMENT_MACRO(mul) |
madcowswe | 15:9c5aaeda36dc | 484 | TVMET_IMPLEMENT_MACRO(div) |
madcowswe | 15:9c5aaeda36dc | 485 | |
madcowswe | 15:9c5aaeda36dc | 486 | #undef TVMET_IMPLEMENT_MACRO |
madcowswe | 15:9c5aaeda36dc | 487 | |
madcowswe | 15:9c5aaeda36dc | 488 | #endif // defined(TVMET_HAVE_COMPLEX) |
madcowswe | 15:9c5aaeda36dc | 489 | |
madcowswe | 15:9c5aaeda36dc | 490 | |
madcowswe | 15:9c5aaeda36dc | 491 | /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
madcowswe | 15:9c5aaeda36dc | 492 | * matrix prod( ... ) functions |
madcowswe | 15:9c5aaeda36dc | 493 | *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
madcowswe | 15:9c5aaeda36dc | 494 | |
madcowswe | 15:9c5aaeda36dc | 495 | |
madcowswe | 15:9c5aaeda36dc | 496 | /** |
madcowswe | 15:9c5aaeda36dc | 497 | * \fn prod(const XprMatrix<E1, Rows1, Cols1>& lhs, const XprMatrix<E2, Cols1, Cols2>& rhs) |
madcowswe | 15:9c5aaeda36dc | 498 | * \brief Evaluate the product of two XprMatrix. |
madcowswe | 15:9c5aaeda36dc | 499 | * Perform on given Matrix M1 and M2: |
madcowswe | 15:9c5aaeda36dc | 500 | * \f[ |
madcowswe | 15:9c5aaeda36dc | 501 | * M_1\,M_2 |
madcowswe | 15:9c5aaeda36dc | 502 | * \f] |
madcowswe | 15:9c5aaeda36dc | 503 | * \note The numer of Rows2 has to be equal to Cols1. |
madcowswe | 15:9c5aaeda36dc | 504 | * \ingroup _binary_function |
madcowswe | 15:9c5aaeda36dc | 505 | */ |
madcowswe | 15:9c5aaeda36dc | 506 | template<class E1, std::size_t Rows1, std::size_t Cols1, |
madcowswe | 15:9c5aaeda36dc | 507 | class E2, std::size_t Cols2> |
madcowswe | 15:9c5aaeda36dc | 508 | inline |
madcowswe | 15:9c5aaeda36dc | 509 | XprMatrix< |
madcowswe | 15:9c5aaeda36dc | 510 | XprMMProduct< |
madcowswe | 15:9c5aaeda36dc | 511 | XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) |
madcowswe | 15:9c5aaeda36dc | 512 | XprMatrix<E2, Cols1, Cols2>, Cols2 |
madcowswe | 15:9c5aaeda36dc | 513 | >, |
madcowswe | 15:9c5aaeda36dc | 514 | Rows1, Cols2 // return Dim |
madcowswe | 15:9c5aaeda36dc | 515 | > |
madcowswe | 15:9c5aaeda36dc | 516 | prod(const XprMatrix<E1, Rows1, Cols1>& lhs, const XprMatrix<E2, Cols1, Cols2>& rhs) { |
madcowswe | 15:9c5aaeda36dc | 517 | typedef XprMMProduct< |
madcowswe | 15:9c5aaeda36dc | 518 | XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, |
madcowswe | 15:9c5aaeda36dc | 519 | XprMatrix<E2, Cols1, Cols2>, Cols2 |
madcowswe | 15:9c5aaeda36dc | 520 | > expr_type; |
madcowswe | 15:9c5aaeda36dc | 521 | return XprMatrix<expr_type, Rows1, Cols2>(expr_type(lhs, rhs)); |
madcowswe | 15:9c5aaeda36dc | 522 | } |
madcowswe | 15:9c5aaeda36dc | 523 | |
madcowswe | 15:9c5aaeda36dc | 524 | |
madcowswe | 15:9c5aaeda36dc | 525 | /** |
madcowswe | 15:9c5aaeda36dc | 526 | * \fn trans_prod(const XprMatrix<E1, Rows1, Cols1>& lhs, const XprMatrix<E2, Cols1, Cols2>& rhs) |
madcowswe | 15:9c5aaeda36dc | 527 | * \brief Function for the trans(matrix-matrix-product) |
madcowswe | 15:9c5aaeda36dc | 528 | * Perform on given Matrix M1 and M2: |
madcowswe | 15:9c5aaeda36dc | 529 | * \f[ |
madcowswe | 15:9c5aaeda36dc | 530 | * (M_1\,M_2)^T |
madcowswe | 15:9c5aaeda36dc | 531 | * \f] |
madcowswe | 15:9c5aaeda36dc | 532 | * \note The numer of Rows2 has to be equal to Cols1. |
madcowswe | 15:9c5aaeda36dc | 533 | * \ingroup _binary_function |
madcowswe | 15:9c5aaeda36dc | 534 | */ |
madcowswe | 15:9c5aaeda36dc | 535 | template<class E1, std::size_t Rows1, std::size_t Cols1, |
madcowswe | 15:9c5aaeda36dc | 536 | class E2, std::size_t Cols2> |
madcowswe | 15:9c5aaeda36dc | 537 | inline |
madcowswe | 15:9c5aaeda36dc | 538 | XprMatrix< |
madcowswe | 15:9c5aaeda36dc | 539 | XprMMProductTransposed< |
madcowswe | 15:9c5aaeda36dc | 540 | XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) |
madcowswe | 15:9c5aaeda36dc | 541 | XprMatrix<E2, Cols1, Cols2>, Cols2 // M2(Cols1, Cols2) |
madcowswe | 15:9c5aaeda36dc | 542 | >, |
madcowswe | 15:9c5aaeda36dc | 543 | Cols2, Rows1 // return Dim |
madcowswe | 15:9c5aaeda36dc | 544 | > |
madcowswe | 15:9c5aaeda36dc | 545 | trans_prod(const XprMatrix<E1, Rows1, Cols1>& lhs, const XprMatrix<E2, Cols1, Cols2>& rhs) { |
madcowswe | 15:9c5aaeda36dc | 546 | typedef XprMMProductTransposed< |
madcowswe | 15:9c5aaeda36dc | 547 | XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, |
madcowswe | 15:9c5aaeda36dc | 548 | XprMatrix<E2, Cols1, Cols2>, Cols2 |
madcowswe | 15:9c5aaeda36dc | 549 | > expr_type; |
madcowswe | 15:9c5aaeda36dc | 550 | return XprMatrix<expr_type, Cols2, Rows1>(expr_type(lhs, rhs)); |
madcowswe | 15:9c5aaeda36dc | 551 | } |
madcowswe | 15:9c5aaeda36dc | 552 | |
madcowswe | 15:9c5aaeda36dc | 553 | |
madcowswe | 15:9c5aaeda36dc | 554 | /** |
madcowswe | 15:9c5aaeda36dc | 555 | * \fn MtM_prod(const XprMatrix<E1, Rows1, Cols1>& lhs, const XprMatrix<E2, Rows1, Cols2>& rhs) |
madcowswe | 15:9c5aaeda36dc | 556 | * \brief Function for the trans(matrix)-matrix-product. |
madcowswe | 15:9c5aaeda36dc | 557 | * using formula |
madcowswe | 15:9c5aaeda36dc | 558 | * \f[ |
madcowswe | 15:9c5aaeda36dc | 559 | * M_1^{T}\,M_2 |
madcowswe | 15:9c5aaeda36dc | 560 | * \f] |
madcowswe | 15:9c5aaeda36dc | 561 | * \note The number of cols of matrix 2 have to be equal to number of rows of |
madcowswe | 15:9c5aaeda36dc | 562 | * matrix 1, since matrix 1 is trans - the result is a (Cols1 x Cols2) |
madcowswe | 15:9c5aaeda36dc | 563 | * matrix. |
madcowswe | 15:9c5aaeda36dc | 564 | * \ingroup _binary_function |
madcowswe | 15:9c5aaeda36dc | 565 | */ |
madcowswe | 15:9c5aaeda36dc | 566 | template<class E1, std::size_t Rows1, std::size_t Cols1, |
madcowswe | 15:9c5aaeda36dc | 567 | class E2, std::size_t Cols2> // Rows2 = Rows1 |
madcowswe | 15:9c5aaeda36dc | 568 | inline |
madcowswe | 15:9c5aaeda36dc | 569 | XprMatrix< |
madcowswe | 15:9c5aaeda36dc | 570 | XprMtMProduct< |
madcowswe | 15:9c5aaeda36dc | 571 | XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) |
madcowswe | 15:9c5aaeda36dc | 572 | XprMatrix<E2, Rows1, Cols2>, Cols2 // M2(Rows1, Cols2) |
madcowswe | 15:9c5aaeda36dc | 573 | >, |
madcowswe | 15:9c5aaeda36dc | 574 | Cols1, Cols2 // return Dim |
madcowswe | 15:9c5aaeda36dc | 575 | > |
madcowswe | 15:9c5aaeda36dc | 576 | MtM_prod(const XprMatrix<E1, Rows1, Cols1>& lhs, const XprMatrix<E2, Rows1, Cols2>& rhs) { |
madcowswe | 15:9c5aaeda36dc | 577 | typedef XprMtMProduct< |
madcowswe | 15:9c5aaeda36dc | 578 | XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, |
madcowswe | 15:9c5aaeda36dc | 579 | XprMatrix<E2, Rows1, Cols2>, Cols2 |
madcowswe | 15:9c5aaeda36dc | 580 | > expr_type; |
madcowswe | 15:9c5aaeda36dc | 581 | return XprMatrix<expr_type, Cols1, Cols2>(expr_type(lhs, rhs)); |
madcowswe | 15:9c5aaeda36dc | 582 | } |
madcowswe | 15:9c5aaeda36dc | 583 | |
madcowswe | 15:9c5aaeda36dc | 584 | |
madcowswe | 15:9c5aaeda36dc | 585 | /** |
madcowswe | 15:9c5aaeda36dc | 586 | * \fn MMt_prod(const XprMatrix<E1, Rows1, Cols1>& lhs, const XprMatrix<E2, Rows2, Cols1>& rhs) |
madcowswe | 15:9c5aaeda36dc | 587 | * \brief Function for the matrix-trans(matrix)-product. |
madcowswe | 15:9c5aaeda36dc | 588 | * \ingroup _binary_function |
madcowswe | 15:9c5aaeda36dc | 589 | * \note The cols2 has to be equal to cols1. |
madcowswe | 15:9c5aaeda36dc | 590 | */ |
madcowswe | 15:9c5aaeda36dc | 591 | template<class E1, std::size_t Rows1, std::size_t Cols1, |
madcowswe | 15:9c5aaeda36dc | 592 | class E2, std::size_t Rows2> // Cols2 = Cols1 |
madcowswe | 15:9c5aaeda36dc | 593 | inline |
madcowswe | 15:9c5aaeda36dc | 594 | XprMatrix< |
madcowswe | 15:9c5aaeda36dc | 595 | XprMMtProduct< |
madcowswe | 15:9c5aaeda36dc | 596 | XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) |
madcowswe | 15:9c5aaeda36dc | 597 | XprMatrix<E2, Rows2, Cols1>, Cols1 // M2(Rows2, Cols1) |
madcowswe | 15:9c5aaeda36dc | 598 | >, |
madcowswe | 15:9c5aaeda36dc | 599 | Rows1, Rows2 // return Dim |
madcowswe | 15:9c5aaeda36dc | 600 | > |
madcowswe | 15:9c5aaeda36dc | 601 | MMt_prod(const XprMatrix<E1, Rows1, Cols1>& lhs, const XprMatrix<E2, Rows2, Cols1>& rhs) { |
madcowswe | 15:9c5aaeda36dc | 602 | typedef XprMMtProduct< |
madcowswe | 15:9c5aaeda36dc | 603 | XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, |
madcowswe | 15:9c5aaeda36dc | 604 | XprMatrix<E2, Rows2, Cols1>, Cols1 |
madcowswe | 15:9c5aaeda36dc | 605 | > expr_type; |
madcowswe | 15:9c5aaeda36dc | 606 | return XprMatrix<expr_type, Rows1, Rows2>(expr_type(lhs, rhs)); |
madcowswe | 15:9c5aaeda36dc | 607 | } |
madcowswe | 15:9c5aaeda36dc | 608 | |
madcowswe | 15:9c5aaeda36dc | 609 | |
madcowswe | 15:9c5aaeda36dc | 610 | /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
madcowswe | 15:9c5aaeda36dc | 611 | * matrix-vector specific prod( ... ) functions |
madcowswe | 15:9c5aaeda36dc | 612 | *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
madcowswe | 15:9c5aaeda36dc | 613 | |
madcowswe | 15:9c5aaeda36dc | 614 | |
madcowswe | 15:9c5aaeda36dc | 615 | /** |
madcowswe | 15:9c5aaeda36dc | 616 | * \fn prod(const XprMatrix<E1, Rows, Cols>& lhs, const XprVector<E2, Cols>& rhs) |
madcowswe | 15:9c5aaeda36dc | 617 | * \brief Evaluate the product of XprMatrix and XprVector. |
madcowswe | 15:9c5aaeda36dc | 618 | * \ingroup _binary_function |
madcowswe | 15:9c5aaeda36dc | 619 | */ |
madcowswe | 15:9c5aaeda36dc | 620 | template<class E1, std::size_t Rows, std::size_t Cols, |
madcowswe | 15:9c5aaeda36dc | 621 | class E2> |
madcowswe | 15:9c5aaeda36dc | 622 | inline |
madcowswe | 15:9c5aaeda36dc | 623 | XprVector< |
madcowswe | 15:9c5aaeda36dc | 624 | XprMVProduct< |
madcowswe | 15:9c5aaeda36dc | 625 | XprMatrix<E1, Rows, Cols>, Rows, Cols, |
madcowswe | 15:9c5aaeda36dc | 626 | XprVector<E2, Cols> |
madcowswe | 15:9c5aaeda36dc | 627 | >, |
madcowswe | 15:9c5aaeda36dc | 628 | Rows |
madcowswe | 15:9c5aaeda36dc | 629 | > |
madcowswe | 15:9c5aaeda36dc | 630 | prod(const XprMatrix<E1, Rows, Cols>& lhs, const XprVector<E2, Cols>& rhs) { |
madcowswe | 15:9c5aaeda36dc | 631 | typedef XprMVProduct< |
madcowswe | 15:9c5aaeda36dc | 632 | XprMatrix<E1, Rows, Cols>, Rows, Cols, |
madcowswe | 15:9c5aaeda36dc | 633 | XprVector<E2, Cols> |
madcowswe | 15:9c5aaeda36dc | 634 | > expr_type; |
madcowswe | 15:9c5aaeda36dc | 635 | return XprVector<expr_type, Rows>(expr_type(lhs, rhs)); |
madcowswe | 15:9c5aaeda36dc | 636 | } |
madcowswe | 15:9c5aaeda36dc | 637 | |
madcowswe | 15:9c5aaeda36dc | 638 | |
madcowswe | 15:9c5aaeda36dc | 639 | /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
madcowswe | 15:9c5aaeda36dc | 640 | * matrix specific functions |
madcowswe | 15:9c5aaeda36dc | 641 | *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
madcowswe | 15:9c5aaeda36dc | 642 | |
madcowswe | 15:9c5aaeda36dc | 643 | |
madcowswe | 15:9c5aaeda36dc | 644 | /** |
madcowswe | 15:9c5aaeda36dc | 645 | * \fn trans(const XprMatrix<E, Rows, Cols>& rhs) |
madcowswe | 15:9c5aaeda36dc | 646 | * \brief Transpose an expression matrix. |
madcowswe | 15:9c5aaeda36dc | 647 | * \ingroup _unary_function |
madcowswe | 15:9c5aaeda36dc | 648 | */ |
madcowswe | 15:9c5aaeda36dc | 649 | template<class E, std::size_t Rows, std::size_t Cols> |
madcowswe | 15:9c5aaeda36dc | 650 | inline |
madcowswe | 15:9c5aaeda36dc | 651 | XprMatrix< |
madcowswe | 15:9c5aaeda36dc | 652 | XprMatrixTranspose< |
madcowswe | 15:9c5aaeda36dc | 653 | XprMatrix<E, Rows, Cols> |
madcowswe | 15:9c5aaeda36dc | 654 | >, |
madcowswe | 15:9c5aaeda36dc | 655 | Cols, Rows |
madcowswe | 15:9c5aaeda36dc | 656 | > |
madcowswe | 15:9c5aaeda36dc | 657 | trans(const XprMatrix<E, Rows, Cols>& rhs) { |
madcowswe | 15:9c5aaeda36dc | 658 | typedef XprMatrixTranspose< |
madcowswe | 15:9c5aaeda36dc | 659 | XprMatrix<E, Rows, Cols> |
madcowswe | 15:9c5aaeda36dc | 660 | > expr_type; |
madcowswe | 15:9c5aaeda36dc | 661 | return XprMatrix<expr_type, Cols, Rows>(expr_type(rhs)); |
madcowswe | 15:9c5aaeda36dc | 662 | } |
madcowswe | 15:9c5aaeda36dc | 663 | |
madcowswe | 15:9c5aaeda36dc | 664 | |
madcowswe | 15:9c5aaeda36dc | 665 | /* |
madcowswe | 15:9c5aaeda36dc | 666 | * \fn trace(const XprMatrix<E, Sz, Sz>& m) |
madcowswe | 15:9c5aaeda36dc | 667 | * \brief Compute the trace of a square matrix. |
madcowswe | 15:9c5aaeda36dc | 668 | * \ingroup _unary_function |
madcowswe | 15:9c5aaeda36dc | 669 | * |
madcowswe | 15:9c5aaeda36dc | 670 | * Simply compute the trace of the given matrix expression as: |
madcowswe | 15:9c5aaeda36dc | 671 | * \f[ |
madcowswe | 15:9c5aaeda36dc | 672 | * \sum_{k = 0}^{Sz-1} m(k, k) |
madcowswe | 15:9c5aaeda36dc | 673 | * \f] |
madcowswe | 15:9c5aaeda36dc | 674 | */ |
madcowswe | 15:9c5aaeda36dc | 675 | template<class E, std::size_t Sz> |
madcowswe | 15:9c5aaeda36dc | 676 | inline |
madcowswe | 15:9c5aaeda36dc | 677 | typename NumericTraits<typename E::value_type>::sum_type |
madcowswe | 15:9c5aaeda36dc | 678 | trace(const XprMatrix<E, Sz, Sz>& m) { |
madcowswe | 15:9c5aaeda36dc | 679 | return meta::Matrix<Sz, Sz, 0, 0>::trace(m); |
madcowswe | 15:9c5aaeda36dc | 680 | } |
madcowswe | 15:9c5aaeda36dc | 681 | |
madcowswe | 15:9c5aaeda36dc | 682 | |
madcowswe | 15:9c5aaeda36dc | 683 | /** |
madcowswe | 15:9c5aaeda36dc | 684 | * \fn row(const XprMatrix<E, Rows, Cols>& m, std::size_t no) |
madcowswe | 15:9c5aaeda36dc | 685 | * \brief Returns a row vector of the given matrix. |
madcowswe | 15:9c5aaeda36dc | 686 | * \ingroup _binary_function |
madcowswe | 15:9c5aaeda36dc | 687 | */ |
madcowswe | 15:9c5aaeda36dc | 688 | template<class E, std::size_t Rows, std::size_t Cols> |
madcowswe | 15:9c5aaeda36dc | 689 | inline |
madcowswe | 15:9c5aaeda36dc | 690 | XprVector< |
madcowswe | 15:9c5aaeda36dc | 691 | XprMatrixRow< |
madcowswe | 15:9c5aaeda36dc | 692 | XprMatrix<E, Rows, Cols>, |
madcowswe | 15:9c5aaeda36dc | 693 | Rows, Cols |
madcowswe | 15:9c5aaeda36dc | 694 | >, |
madcowswe | 15:9c5aaeda36dc | 695 | Cols |
madcowswe | 15:9c5aaeda36dc | 696 | > |
madcowswe | 15:9c5aaeda36dc | 697 | row(const XprMatrix<E, Rows, Cols>& m, std::size_t no) { |
madcowswe | 15:9c5aaeda36dc | 698 | typedef XprMatrixRow< |
madcowswe | 15:9c5aaeda36dc | 699 | XprMatrix<E, Rows, Cols>, |
madcowswe | 15:9c5aaeda36dc | 700 | Rows, Cols |
madcowswe | 15:9c5aaeda36dc | 701 | > expr_type; |
madcowswe | 15:9c5aaeda36dc | 702 | |
madcowswe | 15:9c5aaeda36dc | 703 | return XprVector<expr_type, Cols>(expr_type(m, no)); |
madcowswe | 15:9c5aaeda36dc | 704 | } |
madcowswe | 15:9c5aaeda36dc | 705 | |
madcowswe | 15:9c5aaeda36dc | 706 | |
madcowswe | 15:9c5aaeda36dc | 707 | /** |
madcowswe | 15:9c5aaeda36dc | 708 | * \fn col(const XprMatrix<E, Rows, Cols>& m, std::size_t no) |
madcowswe | 15:9c5aaeda36dc | 709 | * \brief Returns a column vector of the given matrix. |
madcowswe | 15:9c5aaeda36dc | 710 | * \ingroup _binary_function |
madcowswe | 15:9c5aaeda36dc | 711 | */ |
madcowswe | 15:9c5aaeda36dc | 712 | template<class E, std::size_t Rows, std::size_t Cols> |
madcowswe | 15:9c5aaeda36dc | 713 | inline |
madcowswe | 15:9c5aaeda36dc | 714 | XprVector< |
madcowswe | 15:9c5aaeda36dc | 715 | XprMatrixCol< |
madcowswe | 15:9c5aaeda36dc | 716 | XprMatrix<E, Rows, Cols>, |
madcowswe | 15:9c5aaeda36dc | 717 | Rows, Cols |
madcowswe | 15:9c5aaeda36dc | 718 | >, |
madcowswe | 15:9c5aaeda36dc | 719 | Rows |
madcowswe | 15:9c5aaeda36dc | 720 | > |
madcowswe | 15:9c5aaeda36dc | 721 | col(const XprMatrix<E, Rows, Cols>& m, std::size_t no) { |
madcowswe | 15:9c5aaeda36dc | 722 | typedef XprMatrixCol< |
madcowswe | 15:9c5aaeda36dc | 723 | XprMatrix<E, Rows, Cols>, |
madcowswe | 15:9c5aaeda36dc | 724 | Rows, Cols |
madcowswe | 15:9c5aaeda36dc | 725 | > expr_type; |
madcowswe | 15:9c5aaeda36dc | 726 | |
madcowswe | 15:9c5aaeda36dc | 727 | return XprVector<expr_type, Cols>(expr_type(m, no)); |
madcowswe | 15:9c5aaeda36dc | 728 | } |
madcowswe | 15:9c5aaeda36dc | 729 | |
madcowswe | 15:9c5aaeda36dc | 730 | |
madcowswe | 15:9c5aaeda36dc | 731 | /** |
madcowswe | 15:9c5aaeda36dc | 732 | * \fn diag(const XprMatrix<E, Sz, Sz>& m) |
madcowswe | 15:9c5aaeda36dc | 733 | * \brief Returns the diagonal vector of the given square matrix. |
madcowswe | 15:9c5aaeda36dc | 734 | * \ingroup _unary_function |
madcowswe | 15:9c5aaeda36dc | 735 | */ |
madcowswe | 15:9c5aaeda36dc | 736 | template<class E, std::size_t Sz> |
madcowswe | 15:9c5aaeda36dc | 737 | inline |
madcowswe | 15:9c5aaeda36dc | 738 | XprVector< |
madcowswe | 15:9c5aaeda36dc | 739 | XprMatrixDiag< |
madcowswe | 15:9c5aaeda36dc | 740 | XprMatrix<E, Sz, Sz>, |
madcowswe | 15:9c5aaeda36dc | 741 | Sz |
madcowswe | 15:9c5aaeda36dc | 742 | >, |
madcowswe | 15:9c5aaeda36dc | 743 | Sz |
madcowswe | 15:9c5aaeda36dc | 744 | > |
madcowswe | 15:9c5aaeda36dc | 745 | diag(const XprMatrix<E, Sz, Sz>& m) { |
madcowswe | 15:9c5aaeda36dc | 746 | typedef XprMatrixDiag< |
madcowswe | 15:9c5aaeda36dc | 747 | XprMatrix<E, Sz, Sz>, |
madcowswe | 15:9c5aaeda36dc | 748 | Sz> expr_type; |
madcowswe | 15:9c5aaeda36dc | 749 | |
madcowswe | 15:9c5aaeda36dc | 750 | return XprVector<expr_type, Sz>(expr_type(m)); |
madcowswe | 15:9c5aaeda36dc | 751 | } |
madcowswe | 15:9c5aaeda36dc | 752 | |
madcowswe | 15:9c5aaeda36dc | 753 | |
madcowswe | 15:9c5aaeda36dc | 754 | } // namespace tvmet |
madcowswe | 15:9c5aaeda36dc | 755 | |
madcowswe | 15:9c5aaeda36dc | 756 | #endif // TVMET_XPR_MATRIX_FUNCTIONS_H |
madcowswe | 15:9c5aaeda36dc | 757 | |
madcowswe | 15:9c5aaeda36dc | 758 | // Local Variables: |
madcowswe | 15:9c5aaeda36dc | 759 | // mode:C++ |
madcowswe | 15:9c5aaeda36dc | 760 | // tab-width:8 |
madcowswe | 15:9c5aaeda36dc | 761 | // End: |