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
tvmet.h
00001 /* 00002 * Tiny Vector Matrix Library 00003 * Dense Vector Matrix Libary of Tiny size using Expression Templates 00004 * 00005 * Copyright (C) 2001 - 2007 Olaf Petzold <opetzold@users.sourceforge.net> 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 * $Id: tvmet.h,v 1.21 2007-06-23 15:58:59 opetzold Exp $ 00022 */ 00023 00024 #ifndef TVMET_H 00025 #define TVMET_H 00026 00027 #include <tvmet/config.h> 00028 00029 00030 /*********************************************************************** 00031 * Compiler specifics 00032 ***********************************************************************/ 00033 #if defined(__GNUC__) 00034 # include <tvmet/config/config-gcc.h> 00035 #endif 00036 00037 #if defined(__ICC) 00038 # include <tvmet/config/config-icc.h> 00039 #endif 00040 00041 #if defined(__KCC) 00042 # include <tvmet/config/config-kcc.h> 00043 #endif 00044 00045 #if defined(__PGI) 00046 # include <tvmet/config/config-pgi.h> 00047 #endif 00048 00049 // vc7.1: 1310 and vc7.0 1300 00050 #if defined(_MSC_VER) && (_MSC_VER >= 1310) 00051 # include <tvmet/config/config-vc71.h> 00052 #endif 00053 00054 00055 // give up for these cases 00056 #if !defined(TVMET_HAVE_MUTABLE) 00057 # error "Your compiler doesn't support the mutable keyword! Giving up." 00058 #endif 00059 00060 #if !defined(TVMET_HAVE_TYPENAME) 00061 # error "Your compiler doesn't support the typename keyword! Giving up." 00062 #endif 00063 00064 #if !defined(TVMET_HAVE_NAMESPACES) 00065 # error "Your compiler doesn't support the namespace concept! Giving up." 00066 #endif 00067 00068 #if !defined(TVMET_HAVE_PARTIAL_SPECIALIZATION) 00069 # error "Your compiler doesn't support partial specialization! Giving up." 00070 #endif 00071 00072 00073 /* 00074 * other compiler specific stuff 00075 */ 00076 00077 /** 00078 * \def TVMET_CXX_ALWAYS_INLINE 00079 * \brief Compiler specific stuff to force inline code if supported. 00080 * 00081 * Mainly, this declares the functions using g++'s 00082 * __attribute__((always_inline)). This features is enabled 00083 * on defined TVMET_OPTIMIZE. 00084 */ 00085 #if !defined(TVMET_CXX_ALWAYS_INLINE) 00086 #define TVMET_CXX_ALWAYS_INLINE 00087 #endif 00088 00089 00090 /* 00091 * Complexity triggers, compiler and architecture specific. 00092 * If not defined, use defaults. 00093 */ 00094 00095 /** 00096 * \def TVMET_COMPLEXITY_DEFAULT_TRIGGER 00097 * \brief Trigger for changing the matrix-product strategy. 00098 */ 00099 #if !defined(TVMET_COMPLEXITY_DEFAULT_TRIGGER) 00100 # define TVMET_COMPLEXITY_DEFAULT_TRIGGER 1000 00101 #endif 00102 00103 /** 00104 * \def TVMET_COMPLEXITY_M_ASSIGN_TRIGGER 00105 * \brief Trigger for changing the matrix assign strategy. 00106 */ 00107 #if !defined(TVMET_COMPLEXITY_M_ASSIGN_TRIGGER) 00108 # define TVMET_COMPLEXITY_M_ASSIGN_TRIGGER 8*8 00109 #endif 00110 00111 /** 00112 * \def TVMET_COMPLEXITY_MM_TRIGGER 00113 * \brief Trigger for changing the matrix-matrix-product strategy. 00114 * One strategy to build the matrix-matrix-product is to use 00115 * meta templates. The other to use looping. 00116 */ 00117 #if !defined(TVMET_COMPLEXITY_MM_TRIGGER) 00118 # define TVMET_COMPLEXITY_MM_TRIGGER 8*8 00119 #endif 00120 00121 /** 00122 * \def TVMET_COMPLEXITY_V_ASSIGN_TRIGGER 00123 * \brief Trigger for changing the vector assign strategy. 00124 */ 00125 #if !defined(TVMET_COMPLEXITY_V_ASSIGN_TRIGGER) 00126 # define TVMET_COMPLEXITY_V_ASSIGN_TRIGGER 8 00127 #endif 00128 00129 /** 00130 * \def TVMET_COMPLEXITY_MV_TRIGGER 00131 * \brief Trigger for changing the matrix-vector strategy. 00132 * One strategy to build the matrix-vector-product is to use 00133 * meta templates. The other to use looping. 00134 */ 00135 #if !defined(TVMET_COMPLEXITY_MV_TRIGGER) 00136 # define TVMET_COMPLEXITY_MV_TRIGGER 8*8 00137 #endif 00138 00139 00140 /*********************************************************************** 00141 * other specials 00142 ***********************************************************************/ 00143 #if defined(TVMET_HAVE_IEEE_MATH) 00144 # define _ALL_SOURCE 00145 # if !defined(_XOPEN_SOURCE) 00146 # define _XOPEN_SOURCE 00147 # endif 00148 # if !defined(_XOPEN_SOURCE_EXTENDED) 00149 # define _XOPEN_SOURCE_EXTENDED 00150 # endif 00151 #endif 00152 00153 00154 /** 00155 * \def TVMET_DEBUG 00156 * This is defined if <code>DEBUG</code> is defined. This enables runtime error 00157 * bounds checking. If you compile %tvmet from another source directory 00158 * which defines <code>DEBUG</code>, then <code>TVMET_DEBUG</code> will be 00159 * <b>not</b> defined (This behavior differs from release less than 0.6.0). 00160 */ 00161 00162 00163 /** 00164 * \def TVMET_OPTIMIZE 00165 * If this is defined tvmet uses some compiler specific keywords. 00166 * Mainly, this declares the functions using gcc's 00167 * <tt>__attribute__((always_inline))</tt>. This allows the 00168 * compiler to produce high efficient code even on less 00169 * optimization levels, like gcc's -O2 or even -O! 00170 * This is known to work with gcc v3.3.3 (and higher). 00171 * Using icc's v8 gnuc compatibility mode this may work, I've read 00172 * that it's using as an hint, this means you can have static inline 00173 * functions inside left. 00174 */ 00175 #if !defined(TVMET_OPTIMIZE) 00176 # undef TVMET_CXX_ALWAYS_INLINE 00177 # define TVMET_CXX_ALWAYS_INLINE 00178 #endif 00179 00180 00181 /*********************************************************************** 00182 * Namespaces 00183 ***********************************************************************/ 00184 00185 00186 /** 00187 * \namespace std 00188 * \brief Imported ISO/IEC 14882:1998 functions from std namespace. 00189 */ 00190 00191 /** 00192 * \namespace tvmet 00193 * \brief The namespace for the Tiny %Vector %Matrix using Expression Templates Libary. 00194 */ 00195 00196 /** 00197 * \namespace tvmet::meta 00198 * \brief Meta stuff inside here. 00199 */ 00200 00201 /** 00202 * \namespace tvmet::loop 00203 * \brief Loop stuff inside here. 00204 */ 00205 00206 /** 00207 * \namespace tvmet::element_wise 00208 * \brief Operators inside this namespace does elementwise operations. 00209 */ 00210 00211 /** 00212 * \namespace tvmet::util 00213 * \brief Miscellaneous utility functions used. 00214 */ 00215 00216 00217 /*********************************************************************** 00218 * forwards 00219 ***********************************************************************/ 00220 #if defined(TVMET_HAVE_COMPLEX) 00221 namespace std { 00222 template<class T> class complex; 00223 } 00224 #endif 00225 00226 00227 /*********************************************************************** 00228 * other stuff 00229 ***********************************************************************/ 00230 #include <tvmet/TvmetBase.h> 00231 00232 00233 #endif // TVMET_H 00234 00235 // Local Variables: 00236 // mode:C++ 00237 // tab-width:8 00238 // End: 00239 // LocalWords: gnuc gcc's icc's std
Generated on Tue Jul 12 2022 19:00:11 by 1.7.2