00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __TOON_H
00021 #define __TOON_H
00022
00023
00024 #include <string.h>
00025 #include <cmath>
00026 #include <iomanip>
00027 #include <cassert>
00028 #include <iostream>
00029
00030 #include <TooN/util.h>
00031 #ifndef TOON_NO_NAMESPACE
00032 namespace TooN {
00033 #endif
00034
00035 static const int General=-1;
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 struct RowMajor{
00046 static bool is_rowmajor(){return true;}
00047 };
00048 struct ColMajor{
00049 static bool is_rowmajor(){return false;}
00050 };
00051
00052 struct NUMERICS {
00053
00054 enum{Owner,Reference};
00055
00056
00057
00058 typedef RowMajor DefaultLayout;
00059
00060
00061 enum{BlasMult,CPPMult};
00062
00063
00064
00065
00066 static const int MaxCPPMultCount = 100;
00067
00068
00069
00070 static const int MaxStackSize=100;
00071 };
00072
00073
00074
00075
00076
00078
00079
00080 template<int Size>
00081 class Stack;
00082
00083 template<int Size>
00084 class Heap;
00085
00087
00088 template <int Size, class AllocZone>
00089 class FixedVAccessor;
00090
00091 template <int Size, int Skip>
00092 class SkipAccessor;
00093
00094 class DynamicVAccessor;
00095 class RefSkipAccessor;
00096
00097 template <class Accessor>
00098 class VectorBase;
00099
00100 template <int Size, class Accessor>
00101 class FixedVector;
00102
00103 template <class Accessor>
00104 class DynamicVector;
00105
00106
00107
00108
00109
00110
00111 template <int Size=General>
00112 class Vector;
00113
00114
00116
00117 template <int Rows, int Cols, class Layout, class AllocZone>
00118 class FixedMAccessor;
00119
00120 template<int Rows, int Cols, int Skip, class Layout>
00121 class SkipMAccessor;
00122
00123 template<class Layout>
00124 class DynamicMAccessor;
00125
00126 template <class Layout>
00127 class RefSkipMAccessor;
00128
00129 template <class Accessor>
00130 class MatrixBase;
00131
00132 template<int Rows, int Cols, class Accessor>
00133 struct FixedMatrix;
00134
00135 template<class Accessor>
00136 struct DynamicMatrix;
00137
00138 template<class Layout>
00139 class RefMatrix;
00140 template<class Layout>
00141 class ConstRefMatrix;
00142
00143 template<class Layout>
00144 class RefSkipMatrix;
00145 template<class Layout>
00146 class ConstRefSkipMatrix;
00147
00148 template <int Rows=General,
00149 int Cols=Rows,
00150 class Layout = typename NUMERICS::DefaultLayout >
00151 class Matrix;
00152
00153
00154
00155
00156
00157
00158 template <class T>
00159 class Operator {};
00160
00161 template <int Size, int I>
00162 class ZoneHandler;
00163
00164 template<int Size>
00165 class ZoneHandler<Size,0> {
00166 public:
00167 typedef Stack<Size> get_zone;
00168 };
00169
00170 template<int Size>
00171 class ZoneHandler<Size,1> {
00172 public:
00173 typedef Heap<Size> get_zone;
00174 };
00175
00176 template <int Size>
00177 class SizeTraits : public ZoneHandler<Size,(Size > NUMERICS::MaxStackSize ? 1 : 0)> {
00178 };
00179
00180
00181 #ifdef TOON_DEBUG
00182 #define TOON_ASSERT(X,Y) if(!(X)) throw Y()
00183 #define TOON_THROW
00184 #include <TooN/accessorexceptions.hh>
00185 #else
00186 #define TOON_ASSERT(X,Y)
00187 #define TOON_THROW throw()
00188 #endif
00189
00190 #include <TooN/vmagic.hh>
00191
00192 #include <TooN/membase.hh>
00193 #include <TooN/vbase.hh>
00194 #include <TooN/vaccessor.hh>
00195 #include <TooN/mbase.hh>
00196 #include <TooN/maccessor.hh>
00197 #include <TooN/vclasses.hh>
00198 #include <TooN/mclasses.hh>
00199 #include <TooN/blasoperators.hh>
00200 #include <TooN/linoperators.hh>
00201
00202 namespace util {
00203 #include <TooN/generated.h>
00204 }
00205
00206 #ifndef TOON_NO_NAMESPACE
00207 }
00208 #endif
00209
00210 #ifdef TOON_USING_NAMESPACE
00211 using namespace TooN;
00212 #endif
00213
00214 #endif
00215