working version with calibration done

Fork of Eurobot2013 by Oskar Weigl

Committer:
xiaxia686
Date:
Tue Apr 09 15:32:47 2013 +0000
Revision:
11:5ba926692210
Parent:
1:6799c07fe510
woking version (calibrated)

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: tvmet.h,v 1.21 2007-06-23 15:58:59 opetzold Exp $
sv 1:6799c07fe510 22 */
sv 1:6799c07fe510 23
sv 1:6799c07fe510 24 #ifndef TVMET_H
sv 1:6799c07fe510 25 #define TVMET_H
sv 1:6799c07fe510 26
sv 1:6799c07fe510 27 #include <tvmet/config.h>
sv 1:6799c07fe510 28
sv 1:6799c07fe510 29
sv 1:6799c07fe510 30 /***********************************************************************
sv 1:6799c07fe510 31 * Compiler specifics
sv 1:6799c07fe510 32 ***********************************************************************/
sv 1:6799c07fe510 33 #if defined(__GNUC__)
sv 1:6799c07fe510 34 # include <tvmet/config/config-gcc.h>
sv 1:6799c07fe510 35 #endif
sv 1:6799c07fe510 36
sv 1:6799c07fe510 37 #if defined(__ICC)
sv 1:6799c07fe510 38 # include <tvmet/config/config-icc.h>
sv 1:6799c07fe510 39 #endif
sv 1:6799c07fe510 40
sv 1:6799c07fe510 41 #if defined(__KCC)
sv 1:6799c07fe510 42 # include <tvmet/config/config-kcc.h>
sv 1:6799c07fe510 43 #endif
sv 1:6799c07fe510 44
sv 1:6799c07fe510 45 #if defined(__PGI)
sv 1:6799c07fe510 46 # include <tvmet/config/config-pgi.h>
sv 1:6799c07fe510 47 #endif
sv 1:6799c07fe510 48
sv 1:6799c07fe510 49 // vc7.1: 1310 and vc7.0 1300
sv 1:6799c07fe510 50 #if defined(_MSC_VER) && (_MSC_VER >= 1310)
sv 1:6799c07fe510 51 # include <tvmet/config/config-vc71.h>
sv 1:6799c07fe510 52 #endif
sv 1:6799c07fe510 53
sv 1:6799c07fe510 54
sv 1:6799c07fe510 55 // give up for these cases
sv 1:6799c07fe510 56 #if !defined(TVMET_HAVE_MUTABLE)
sv 1:6799c07fe510 57 # error "Your compiler doesn't support the mutable keyword! Giving up."
sv 1:6799c07fe510 58 #endif
sv 1:6799c07fe510 59
sv 1:6799c07fe510 60 #if !defined(TVMET_HAVE_TYPENAME)
sv 1:6799c07fe510 61 # error "Your compiler doesn't support the typename keyword! Giving up."
sv 1:6799c07fe510 62 #endif
sv 1:6799c07fe510 63
sv 1:6799c07fe510 64 #if !defined(TVMET_HAVE_NAMESPACES)
sv 1:6799c07fe510 65 # error "Your compiler doesn't support the namespace concept! Giving up."
sv 1:6799c07fe510 66 #endif
sv 1:6799c07fe510 67
sv 1:6799c07fe510 68 #if !defined(TVMET_HAVE_PARTIAL_SPECIALIZATION)
sv 1:6799c07fe510 69 # error "Your compiler doesn't support partial specialization! Giving up."
sv 1:6799c07fe510 70 #endif
sv 1:6799c07fe510 71
sv 1:6799c07fe510 72
sv 1:6799c07fe510 73 /*
sv 1:6799c07fe510 74 * other compiler specific stuff
sv 1:6799c07fe510 75 */
sv 1:6799c07fe510 76
sv 1:6799c07fe510 77 /**
sv 1:6799c07fe510 78 * \def TVMET_CXX_ALWAYS_INLINE
sv 1:6799c07fe510 79 * \brief Compiler specific stuff to force inline code if supported.
sv 1:6799c07fe510 80 *
sv 1:6799c07fe510 81 * Mainly, this declares the functions using g++'s
sv 1:6799c07fe510 82 * __attribute__((always_inline)). This features is enabled
sv 1:6799c07fe510 83 * on defined TVMET_OPTIMIZE.
sv 1:6799c07fe510 84 */
sv 1:6799c07fe510 85 #if !defined(TVMET_CXX_ALWAYS_INLINE)
sv 1:6799c07fe510 86 #define TVMET_CXX_ALWAYS_INLINE
sv 1:6799c07fe510 87 #endif
sv 1:6799c07fe510 88
sv 1:6799c07fe510 89
sv 1:6799c07fe510 90 /*
sv 1:6799c07fe510 91 * Complexity triggers, compiler and architecture specific.
sv 1:6799c07fe510 92 * If not defined, use defaults.
sv 1:6799c07fe510 93 */
sv 1:6799c07fe510 94
sv 1:6799c07fe510 95 /**
sv 1:6799c07fe510 96 * \def TVMET_COMPLEXITY_DEFAULT_TRIGGER
sv 1:6799c07fe510 97 * \brief Trigger for changing the matrix-product strategy.
sv 1:6799c07fe510 98 */
sv 1:6799c07fe510 99 #if !defined(TVMET_COMPLEXITY_DEFAULT_TRIGGER)
sv 1:6799c07fe510 100 # define TVMET_COMPLEXITY_DEFAULT_TRIGGER 1000
sv 1:6799c07fe510 101 #endif
sv 1:6799c07fe510 102
sv 1:6799c07fe510 103 /**
sv 1:6799c07fe510 104 * \def TVMET_COMPLEXITY_M_ASSIGN_TRIGGER
sv 1:6799c07fe510 105 * \brief Trigger for changing the matrix assign strategy.
sv 1:6799c07fe510 106 */
sv 1:6799c07fe510 107 #if !defined(TVMET_COMPLEXITY_M_ASSIGN_TRIGGER)
sv 1:6799c07fe510 108 # define TVMET_COMPLEXITY_M_ASSIGN_TRIGGER 8*8
sv 1:6799c07fe510 109 #endif
sv 1:6799c07fe510 110
sv 1:6799c07fe510 111 /**
sv 1:6799c07fe510 112 * \def TVMET_COMPLEXITY_MM_TRIGGER
sv 1:6799c07fe510 113 * \brief Trigger for changing the matrix-matrix-product strategy.
sv 1:6799c07fe510 114 * One strategy to build the matrix-matrix-product is to use
sv 1:6799c07fe510 115 * meta templates. The other to use looping.
sv 1:6799c07fe510 116 */
sv 1:6799c07fe510 117 #if !defined(TVMET_COMPLEXITY_MM_TRIGGER)
sv 1:6799c07fe510 118 # define TVMET_COMPLEXITY_MM_TRIGGER 8*8
sv 1:6799c07fe510 119 #endif
sv 1:6799c07fe510 120
sv 1:6799c07fe510 121 /**
sv 1:6799c07fe510 122 * \def TVMET_COMPLEXITY_V_ASSIGN_TRIGGER
sv 1:6799c07fe510 123 * \brief Trigger for changing the vector assign strategy.
sv 1:6799c07fe510 124 */
sv 1:6799c07fe510 125 #if !defined(TVMET_COMPLEXITY_V_ASSIGN_TRIGGER)
sv 1:6799c07fe510 126 # define TVMET_COMPLEXITY_V_ASSIGN_TRIGGER 8
sv 1:6799c07fe510 127 #endif
sv 1:6799c07fe510 128
sv 1:6799c07fe510 129 /**
sv 1:6799c07fe510 130 * \def TVMET_COMPLEXITY_MV_TRIGGER
sv 1:6799c07fe510 131 * \brief Trigger for changing the matrix-vector strategy.
sv 1:6799c07fe510 132 * One strategy to build the matrix-vector-product is to use
sv 1:6799c07fe510 133 * meta templates. The other to use looping.
sv 1:6799c07fe510 134 */
sv 1:6799c07fe510 135 #if !defined(TVMET_COMPLEXITY_MV_TRIGGER)
sv 1:6799c07fe510 136 # define TVMET_COMPLEXITY_MV_TRIGGER 8*8
sv 1:6799c07fe510 137 #endif
sv 1:6799c07fe510 138
sv 1:6799c07fe510 139
sv 1:6799c07fe510 140 /***********************************************************************
sv 1:6799c07fe510 141 * other specials
sv 1:6799c07fe510 142 ***********************************************************************/
sv 1:6799c07fe510 143 #if defined(TVMET_HAVE_IEEE_MATH)
sv 1:6799c07fe510 144 # define _ALL_SOURCE
sv 1:6799c07fe510 145 # if !defined(_XOPEN_SOURCE)
sv 1:6799c07fe510 146 # define _XOPEN_SOURCE
sv 1:6799c07fe510 147 # endif
sv 1:6799c07fe510 148 # if !defined(_XOPEN_SOURCE_EXTENDED)
sv 1:6799c07fe510 149 # define _XOPEN_SOURCE_EXTENDED
sv 1:6799c07fe510 150 # endif
sv 1:6799c07fe510 151 #endif
sv 1:6799c07fe510 152
sv 1:6799c07fe510 153
sv 1:6799c07fe510 154 /**
sv 1:6799c07fe510 155 * \def TVMET_DEBUG
sv 1:6799c07fe510 156 * This is defined if <code>DEBUG</code> is defined. This enables runtime error
sv 1:6799c07fe510 157 * bounds checking. If you compile %tvmet from another source directory
sv 1:6799c07fe510 158 * which defines <code>DEBUG</code>, then <code>TVMET_DEBUG</code> will be
sv 1:6799c07fe510 159 * <b>not</b> defined (This behavior differs from release less than 0.6.0).
sv 1:6799c07fe510 160 */
sv 1:6799c07fe510 161
sv 1:6799c07fe510 162
sv 1:6799c07fe510 163 /**
sv 1:6799c07fe510 164 * \def TVMET_OPTIMIZE
sv 1:6799c07fe510 165 * If this is defined tvmet uses some compiler specific keywords.
sv 1:6799c07fe510 166 * Mainly, this declares the functions using gcc's
sv 1:6799c07fe510 167 * <tt>__attribute__((always_inline))</tt>. This allows the
sv 1:6799c07fe510 168 * compiler to produce high efficient code even on less
sv 1:6799c07fe510 169 * optimization levels, like gcc's -O2 or even -O!
sv 1:6799c07fe510 170 * This is known to work with gcc v3.3.3 (and higher).
sv 1:6799c07fe510 171 * Using icc's v8 gnuc compatibility mode this may work, I've read
sv 1:6799c07fe510 172 * that it's using as an hint, this means you can have static inline
sv 1:6799c07fe510 173 * functions inside left.
sv 1:6799c07fe510 174 */
sv 1:6799c07fe510 175 #if !defined(TVMET_OPTIMIZE)
sv 1:6799c07fe510 176 # undef TVMET_CXX_ALWAYS_INLINE
sv 1:6799c07fe510 177 # define TVMET_CXX_ALWAYS_INLINE
sv 1:6799c07fe510 178 #endif
sv 1:6799c07fe510 179
sv 1:6799c07fe510 180
sv 1:6799c07fe510 181 /***********************************************************************
sv 1:6799c07fe510 182 * Namespaces
sv 1:6799c07fe510 183 ***********************************************************************/
sv 1:6799c07fe510 184
sv 1:6799c07fe510 185
sv 1:6799c07fe510 186 /**
sv 1:6799c07fe510 187 * \namespace std
sv 1:6799c07fe510 188 * \brief Imported ISO/IEC 14882:1998 functions from std namespace.
sv 1:6799c07fe510 189 */
sv 1:6799c07fe510 190
sv 1:6799c07fe510 191 /**
sv 1:6799c07fe510 192 * \namespace tvmet
sv 1:6799c07fe510 193 * \brief The namespace for the Tiny %Vector %Matrix using Expression Templates Libary.
sv 1:6799c07fe510 194 */
sv 1:6799c07fe510 195
sv 1:6799c07fe510 196 /**
sv 1:6799c07fe510 197 * \namespace tvmet::meta
sv 1:6799c07fe510 198 * \brief Meta stuff inside here.
sv 1:6799c07fe510 199 */
sv 1:6799c07fe510 200
sv 1:6799c07fe510 201 /**
sv 1:6799c07fe510 202 * \namespace tvmet::loop
sv 1:6799c07fe510 203 * \brief Loop stuff inside here.
sv 1:6799c07fe510 204 */
sv 1:6799c07fe510 205
sv 1:6799c07fe510 206 /**
sv 1:6799c07fe510 207 * \namespace tvmet::element_wise
sv 1:6799c07fe510 208 * \brief Operators inside this namespace does elementwise operations.
sv 1:6799c07fe510 209 */
sv 1:6799c07fe510 210
sv 1:6799c07fe510 211 /**
sv 1:6799c07fe510 212 * \namespace tvmet::util
sv 1:6799c07fe510 213 * \brief Miscellaneous utility functions used.
sv 1:6799c07fe510 214 */
sv 1:6799c07fe510 215
sv 1:6799c07fe510 216
sv 1:6799c07fe510 217 /***********************************************************************
sv 1:6799c07fe510 218 * forwards
sv 1:6799c07fe510 219 ***********************************************************************/
sv 1:6799c07fe510 220 #if defined(TVMET_HAVE_COMPLEX)
sv 1:6799c07fe510 221 namespace std {
sv 1:6799c07fe510 222 template<class T> class complex;
sv 1:6799c07fe510 223 }
sv 1:6799c07fe510 224 #endif
sv 1:6799c07fe510 225
sv 1:6799c07fe510 226
sv 1:6799c07fe510 227 /***********************************************************************
sv 1:6799c07fe510 228 * other stuff
sv 1:6799c07fe510 229 ***********************************************************************/
sv 1:6799c07fe510 230 #include <tvmet/TvmetBase.h>
sv 1:6799c07fe510 231
sv 1:6799c07fe510 232
sv 1:6799c07fe510 233 #endif // TVMET_H
sv 1:6799c07fe510 234
sv 1:6799c07fe510 235 // Local Variables:
sv 1:6799c07fe510 236 // mode:C++
sv 1:6799c07fe510 237 // tab-width:8
sv 1:6799c07fe510 238 // End:
sv 1:6799c07fe510 239 // LocalWords: gnuc gcc's icc's std