ICRS Eurobot 2013
Dependencies: mbed mbed-rtos Servo QEI
tvmet/loop/Matrix.h@15:9c5aaeda36dc, 2013-04-06 (annotated)
- Committer:
- madcowswe
- Date:
- Sat Apr 06 20:57:54 2013 +0000
- Revision:
- 15:9c5aaeda36dc
Encoders fairly tuned, still has random noise in it
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: Matrix.h,v 1.11 2007-06-23 15:58:59 opetzold Exp $ |
madcowswe | 15:9c5aaeda36dc | 22 | */ |
madcowswe | 15:9c5aaeda36dc | 23 | |
madcowswe | 15:9c5aaeda36dc | 24 | #ifndef TVMET_LOOP_MATRIX_H |
madcowswe | 15:9c5aaeda36dc | 25 | #define TVMET_LOOP_MATRIX_H |
madcowswe | 15:9c5aaeda36dc | 26 | |
madcowswe | 15:9c5aaeda36dc | 27 | namespace tvmet { |
madcowswe | 15:9c5aaeda36dc | 28 | |
madcowswe | 15:9c5aaeda36dc | 29 | namespace loop { |
madcowswe | 15:9c5aaeda36dc | 30 | |
madcowswe | 15:9c5aaeda36dc | 31 | |
madcowswe | 15:9c5aaeda36dc | 32 | /** |
madcowswe | 15:9c5aaeda36dc | 33 | * \class Matrix Matrix.h "tvmet/loop/Matrix.h" |
madcowswe | 15:9c5aaeda36dc | 34 | * \brief Loop %Matrix class using expression and loop templates. |
madcowswe | 15:9c5aaeda36dc | 35 | */ |
madcowswe | 15:9c5aaeda36dc | 36 | template<std::size_t Rows, std::size_t Cols> |
madcowswe | 15:9c5aaeda36dc | 37 | class Matrix |
madcowswe | 15:9c5aaeda36dc | 38 | { |
madcowswe | 15:9c5aaeda36dc | 39 | Matrix(const Matrix&); |
madcowswe | 15:9c5aaeda36dc | 40 | Matrix& operator=(const Matrix&); |
madcowswe | 15:9c5aaeda36dc | 41 | |
madcowswe | 15:9c5aaeda36dc | 42 | public: |
madcowswe | 15:9c5aaeda36dc | 43 | Matrix() { } |
madcowswe | 15:9c5aaeda36dc | 44 | |
madcowswe | 15:9c5aaeda36dc | 45 | public: |
madcowswe | 15:9c5aaeda36dc | 46 | /** assign an expression on columns on given row using the functional fn. */ |
madcowswe | 15:9c5aaeda36dc | 47 | template<class E1, class E2, class Assign> |
madcowswe | 15:9c5aaeda36dc | 48 | static inline |
madcowswe | 15:9c5aaeda36dc | 49 | void assign(E1& lhs, const E2& rhs, const Assign& assign_fn) { |
madcowswe | 15:9c5aaeda36dc | 50 | for(std::size_t i = 0; i != Rows; ++i) |
madcowswe | 15:9c5aaeda36dc | 51 | for(std::size_t j = 0; j != Cols; ++j) |
madcowswe | 15:9c5aaeda36dc | 52 | assign_fn.apply_on(lhs(i, j), rhs(i, j)); |
madcowswe | 15:9c5aaeda36dc | 53 | } |
madcowswe | 15:9c5aaeda36dc | 54 | }; |
madcowswe | 15:9c5aaeda36dc | 55 | |
madcowswe | 15:9c5aaeda36dc | 56 | |
madcowswe | 15:9c5aaeda36dc | 57 | } // namespace loop |
madcowswe | 15:9c5aaeda36dc | 58 | |
madcowswe | 15:9c5aaeda36dc | 59 | } // namespace tvmet |
madcowswe | 15:9c5aaeda36dc | 60 | |
madcowswe | 15:9c5aaeda36dc | 61 | #endif /* TVMET_LOOP_MATRIX_H */ |
madcowswe | 15:9c5aaeda36dc | 62 | |
madcowswe | 15:9c5aaeda36dc | 63 | // Local Variables: |
madcowswe | 15:9c5aaeda36dc | 64 | // mode:C++ |
madcowswe | 15:9c5aaeda36dc | 65 | // tab-width:8 |
madcowswe | 15:9c5aaeda36dc | 66 | // End: |