Colour sensors calibrated
Dependencies: mbed-rtos mbed Servo QEI
Fork of ICRSEurobot13 by
tvmet/meta/Gemm.h@46:adcd57a5e402, 2013-04-12 (annotated)
- Committer:
- xiaxia686
- Date:
- Fri Apr 12 20:59:18 2013 +0000
- Revision:
- 46:adcd57a5e402
- Parent:
- 15:9c5aaeda36dc
Colours Sensors fixed
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: Gemm.h,v 1.15 2007-06-23 15:58:59 opetzold Exp $ |
madcowswe | 15:9c5aaeda36dc | 22 | */ |
madcowswe | 15:9c5aaeda36dc | 23 | |
madcowswe | 15:9c5aaeda36dc | 24 | #ifndef TVMET_META_GEMM_H |
madcowswe | 15:9c5aaeda36dc | 25 | #define TVMET_META_GEMM_H |
madcowswe | 15:9c5aaeda36dc | 26 | |
madcowswe | 15:9c5aaeda36dc | 27 | #include <tvmet/xpr/Null.h> |
madcowswe | 15:9c5aaeda36dc | 28 | |
madcowswe | 15:9c5aaeda36dc | 29 | namespace tvmet { |
madcowswe | 15:9c5aaeda36dc | 30 | |
madcowswe | 15:9c5aaeda36dc | 31 | namespace meta { |
madcowswe | 15:9c5aaeda36dc | 32 | |
madcowswe | 15:9c5aaeda36dc | 33 | |
madcowswe | 15:9c5aaeda36dc | 34 | /** |
madcowswe | 15:9c5aaeda36dc | 35 | * \class gemm Gemm.h "tvmet/meta/Gemm.h" |
madcowswe | 15:9c5aaeda36dc | 36 | * \brief Meta class for matrix-matrix operations, like product |
madcowswe | 15:9c5aaeda36dc | 37 | * using formula |
madcowswe | 15:9c5aaeda36dc | 38 | * \f[ |
madcowswe | 15:9c5aaeda36dc | 39 | * M_1\,M_2 |
madcowswe | 15:9c5aaeda36dc | 40 | * \f] |
madcowswe | 15:9c5aaeda36dc | 41 | * \note The rows of matrix 2 have to be equal to cols of matrix 1. |
madcowswe | 15:9c5aaeda36dc | 42 | */ |
madcowswe | 15:9c5aaeda36dc | 43 | template<std::size_t Rows1, std::size_t Cols1, |
madcowswe | 15:9c5aaeda36dc | 44 | std::size_t Cols2, |
madcowswe | 15:9c5aaeda36dc | 45 | std::size_t K> |
madcowswe | 15:9c5aaeda36dc | 46 | class gemm |
madcowswe | 15:9c5aaeda36dc | 47 | { |
madcowswe | 15:9c5aaeda36dc | 48 | gemm(); |
madcowswe | 15:9c5aaeda36dc | 49 | gemm(const gemm&); |
madcowswe | 15:9c5aaeda36dc | 50 | gemm& operator=(const gemm&); |
madcowswe | 15:9c5aaeda36dc | 51 | |
madcowswe | 15:9c5aaeda36dc | 52 | private: |
madcowswe | 15:9c5aaeda36dc | 53 | enum { |
madcowswe | 15:9c5aaeda36dc | 54 | doIt = (K != Cols1 - 1) /**< recursive counter */ |
madcowswe | 15:9c5aaeda36dc | 55 | }; |
madcowswe | 15:9c5aaeda36dc | 56 | |
madcowswe | 15:9c5aaeda36dc | 57 | public: |
madcowswe | 15:9c5aaeda36dc | 58 | template<class E1, class E2> |
madcowswe | 15:9c5aaeda36dc | 59 | static inline |
madcowswe | 15:9c5aaeda36dc | 60 | typename PromoteTraits< |
madcowswe | 15:9c5aaeda36dc | 61 | typename E1::value_type, |
madcowswe | 15:9c5aaeda36dc | 62 | typename E2::value_type |
madcowswe | 15:9c5aaeda36dc | 63 | >::value_type |
madcowswe | 15:9c5aaeda36dc | 64 | prod(const E1& lhs, const E2& rhs, std::size_t i, std::size_t j) { |
madcowswe | 15:9c5aaeda36dc | 65 | return lhs(i, K) * rhs(K, j) |
madcowswe | 15:9c5aaeda36dc | 66 | + gemm<Rows1 * doIt, Cols1 * doIt, |
madcowswe | 15:9c5aaeda36dc | 67 | Cols2 * doIt, |
madcowswe | 15:9c5aaeda36dc | 68 | (K+1) * doIt>::prod(lhs, rhs, i, j); |
madcowswe | 15:9c5aaeda36dc | 69 | } |
madcowswe | 15:9c5aaeda36dc | 70 | }; |
madcowswe | 15:9c5aaeda36dc | 71 | |
madcowswe | 15:9c5aaeda36dc | 72 | |
madcowswe | 15:9c5aaeda36dc | 73 | /** |
madcowswe | 15:9c5aaeda36dc | 74 | * \class gemm<0,0,0,0> Gemm.h "tvmet/meta/Gemm.h" |
madcowswe | 15:9c5aaeda36dc | 75 | * \brief gemm Specialized for recursion. |
madcowswe | 15:9c5aaeda36dc | 76 | */ |
madcowswe | 15:9c5aaeda36dc | 77 | template<> |
madcowswe | 15:9c5aaeda36dc | 78 | class gemm<0,0,0,0> |
madcowswe | 15:9c5aaeda36dc | 79 | { |
madcowswe | 15:9c5aaeda36dc | 80 | gemm(); |
madcowswe | 15:9c5aaeda36dc | 81 | gemm(const gemm&); |
madcowswe | 15:9c5aaeda36dc | 82 | gemm& operator=(const gemm&); |
madcowswe | 15:9c5aaeda36dc | 83 | |
madcowswe | 15:9c5aaeda36dc | 84 | public: |
madcowswe | 15:9c5aaeda36dc | 85 | template<class E1, class E2> |
madcowswe | 15:9c5aaeda36dc | 86 | static inline |
madcowswe | 15:9c5aaeda36dc | 87 | XprNull prod(const E1&, const E2&, std::size_t, std::size_t) { |
madcowswe | 15:9c5aaeda36dc | 88 | return XprNull(); |
madcowswe | 15:9c5aaeda36dc | 89 | } |
madcowswe | 15:9c5aaeda36dc | 90 | }; |
madcowswe | 15:9c5aaeda36dc | 91 | |
madcowswe | 15:9c5aaeda36dc | 92 | |
madcowswe | 15:9c5aaeda36dc | 93 | } // namespace meta |
madcowswe | 15:9c5aaeda36dc | 94 | |
madcowswe | 15:9c5aaeda36dc | 95 | } // namespace tvmet |
madcowswe | 15:9c5aaeda36dc | 96 | |
madcowswe | 15:9c5aaeda36dc | 97 | #endif /* TVMET_META_GEMM_H */ |
madcowswe | 15:9c5aaeda36dc | 98 | |
madcowswe | 15:9c5aaeda36dc | 99 | // Local Variables: |
madcowswe | 15:9c5aaeda36dc | 100 | // mode:C++ |
madcowswe | 15:9c5aaeda36dc | 101 | // tab-width:8 |
madcowswe | 15:9c5aaeda36dc | 102 | // End: |