Eurobot2012_Primary

Dependencies:   mbed Eurobot_2012_Primary

Committer:
narshu
Date:
Wed Oct 17 22:22:47 2012 +0000
Revision:
26:0995f61cb7b8
Parent:
25:143b19c1fb05
Eurobot 2012 Primary;

Who changed what in which revision?

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