This is the Tiny Vector Matrix Expression Templates library found at http://tvmet.sourceforge.net. It is the fastest and most compact matrix lib out there (for < 10x10 matricies). I have done some minor tweaks to make it compile for mbed. For examples and hints on how to use, see: http://tvmet.sourceforge.net/usage.html

Dependents:   Eurobot_2012_Secondary

Committer:
madcowswe
Date:
Wed Mar 28 15:53:45 2012 +0000
Revision:
0:feb4117d16d8

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
madcowswe 0:feb4117d16d8 1 /*
madcowswe 0:feb4117d16d8 2 * Tiny Vector Matrix Library
madcowswe 0:feb4117d16d8 3 * Dense Vector Matrix Libary of Tiny size using Expression Templates
madcowswe 0:feb4117d16d8 4 *
madcowswe 0:feb4117d16d8 5 * Copyright (C) 2001 - 2007 Olaf Petzold <opetzold@users.sourceforge.net>
madcowswe 0:feb4117d16d8 6 *
madcowswe 0:feb4117d16d8 7 * This library is free software; you can redistribute it and/or
madcowswe 0:feb4117d16d8 8 * modify it under the terms of the GNU Lesser General Public
madcowswe 0:feb4117d16d8 9 * License as published by the Free Software Foundation; either
madcowswe 0:feb4117d16d8 10 * version 2.1 of the License, or (at your option) any later version.
madcowswe 0:feb4117d16d8 11 *
madcowswe 0:feb4117d16d8 12 * This library is distributed in the hope that it will be useful,
madcowswe 0:feb4117d16d8 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
madcowswe 0:feb4117d16d8 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
madcowswe 0:feb4117d16d8 15 * Lesser General Public License for more details.
madcowswe 0:feb4117d16d8 16 *
madcowswe 0:feb4117d16d8 17 * You should have received a copy of the GNU Lesser General Public
madcowswe 0:feb4117d16d8 18 * License along with this library; if not, write to the Free Software
madcowswe 0:feb4117d16d8 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
madcowswe 0:feb4117d16d8 20 *
madcowswe 0:feb4117d16d8 21 * $Id: Io.h,v 1.8 2007-06-23 15:58:58 opetzold Exp $
madcowswe 0:feb4117d16d8 22 */
madcowswe 0:feb4117d16d8 23
madcowswe 0:feb4117d16d8 24 #ifndef TVMET_IO_H
madcowswe 0:feb4117d16d8 25 #define TVMET_IO_H
madcowswe 0:feb4117d16d8 26
madcowswe 0:feb4117d16d8 27 namespace tvmet {
madcowswe 0:feb4117d16d8 28
madcowswe 0:feb4117d16d8 29 /**
madcowswe 0:feb4117d16d8 30 * \class IoPrintHelper Io.h "tvmet/Io.h"
madcowswe 0:feb4117d16d8 31 * \brief Determines the number of digits regarding the sign of the
madcowswe 0:feb4117d16d8 32 * container.
madcowswe 0:feb4117d16d8 33 * This class is nesessary due to the complex type and the
madcowswe 0:feb4117d16d8 34 * function min(), which are not defined for this type.
madcowswe 0:feb4117d16d8 35 * So we have to dispatch between pod and complex types
madcowswe 0:feb4117d16d8 36 * to get an information about the extra space for signs.
madcowswe 0:feb4117d16d8 37 */
madcowswe 0:feb4117d16d8 38 template<class C>
madcowswe 0:feb4117d16d8 39 class IoPrintHelper {
madcowswe 0:feb4117d16d8 40 IoPrintHelper();
madcowswe 0:feb4117d16d8 41 IoPrintHelper(const IoPrintHelper&);
madcowswe 0:feb4117d16d8 42 IoPrintHelper& operator=(const IoPrintHelper&);
madcowswe 0:feb4117d16d8 43
madcowswe 0:feb4117d16d8 44 private:
madcowswe 0:feb4117d16d8 45 static std::streamsize width(const C& e) {
madcowswe 0:feb4117d16d8 46 std::streamsize w = static_cast<std::streamsize>(std::log10(max(abs(e)))+1);
madcowswe 0:feb4117d16d8 47 return w > 0 ? w : 0;
madcowswe 0:feb4117d16d8 48 }
madcowswe 0:feb4117d16d8 49
madcowswe 0:feb4117d16d8 50 public:
madcowswe 0:feb4117d16d8 51 static std::streamsize width(dispatch<true>, const C& e) {
madcowswe 0:feb4117d16d8 52 return width(e);
madcowswe 0:feb4117d16d8 53 }
madcowswe 0:feb4117d16d8 54 static std::streamsize width(dispatch<false>, const C& e) {
madcowswe 0:feb4117d16d8 55 std::streamsize w = width(e);
madcowswe 0:feb4117d16d8 56 if(min(e) < 0) return w+1;
madcowswe 0:feb4117d16d8 57 else return w;
madcowswe 0:feb4117d16d8 58 }
madcowswe 0:feb4117d16d8 59 };
madcowswe 0:feb4117d16d8 60
madcowswe 0:feb4117d16d8 61
madcowswe 0:feb4117d16d8 62 }
madcowswe 0:feb4117d16d8 63
madcowswe 0:feb4117d16d8 64 #endif /* TVMET_IO_H */
madcowswe 0:feb4117d16d8 65
madcowswe 0:feb4117d16d8 66 // Local Variables:
madcowswe 0:feb4117d16d8 67 // mode:C++
madcowswe 0:feb4117d16d8 68 // tab-width:8
madcowswe 0:feb4117d16d8 69 // End: