00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef TOON_INCLUDE_TOON_H
00033 #define TOON_INCLUDE_TOON_H
00034 #include <iostream>
00035 #include <cstdlib>
00036 #include <limits>
00037 #include <new>
00038 #include <utility>
00039 #include <vector>
00040 #include <TooN/internal/config.hh>
00041 #include <TooN/internal/typeof.hh>
00042 #include <TooN/internal/deprecated.hh>
00043
00044 #if defined TOON_NDEBUG || defined NDEBUG
00045 #define TOON_NDEBUG_MISMATCH
00046 #define TOON_NDEBUG_SLICE
00047 #define TOON_NDEBUG_SIZE
00048 #define TOON_NDEBUG_FILL
00049 #endif
00050
00051 #ifdef TOON_INITIALIZE_RANDOM
00052 #include <ctime>
00053 #endif
00054
00055 #ifdef TOON_USE_LAPACK
00056 #ifndef TOON_DETERMINANT_LAPACK
00057 #define TOON_DETERMINANT_LAPACK 35
00058 #endif
00059 #endif
00060
00061
00062 namespace TooN {
00063
00064 #ifdef TOON_TEST_INTERNALS
00065 namespace Internal
00066 {
00067 struct BadIndex{};
00068 struct SliceError{};
00069 struct StaticSliceError{};
00070 struct SizeMismatch{};
00071 struct StaticSizeMismatch{};
00072 struct VectorOverfill{};
00073 struct StaticVectorOverfill{};
00074 struct MatrixOverfill{};
00075 struct StaticMatrixOverfill{};
00076 struct Underfill{};
00077 }
00078 #endif
00079
00080 using std::numeric_limits;
00081
00082
00083
00084
00085
00086 template<class C> struct IsField
00087 {
00088 static const int value = numeric_limits<C>::is_specialized;
00089 };
00090
00091
00092
00093 namespace Internal
00094 {
00095
00096
00097
00098 static const unsigned int max_bytes_on_stack=1000;
00099
00100
00101
00102 struct Slicing{};
00103 template<int RowStride, int ColStride> struct Slice;
00104 template<int Size, typename Precision, int Stride, typename Mem> struct GenericVBase;
00105 }
00106
00107 template<int Size, class Precision, class Base> struct Vector;
00108 template<int Rows, int Cols, class Precision, class Base> struct Matrix;
00109 template<int Size, class Precision, class Base> struct DiagonalMatrix;
00110
00111
00112 #ifdef DOXYGEN_INCLUDE_ONLY_FOR_DOCS
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139 template<typename T> struct Operator{
00140
00141
00142
00143
00144 int size() const;
00145
00146 int num_rows() const;
00147
00148 int num_cols() const;
00149
00150
00151
00152
00153
00154
00155
00156 template<int Size, class Precision, class Base>
00157 void eval(Vector<Size, Precision, Base>& v) const;
00158
00159
00160 template <int Size, typename P1, typename B1>
00161 void plusequals(Vector<Size, P1, B1>& v) const;
00162
00163
00164 template <int Size, typename P1, typename B1>
00165 void minusequals(Vector<Size, P1, B1>& v) const;
00166
00167
00168
00169 template <int Size, typename P1, typename B1>
00170 Operator<T> add(const Vector<Size, P1, B1>& v) const;
00171
00172
00173 template <int Size, typename P1, typename B1>
00174 Operator<T> rsubtract(const Vector<Size, P1, B1>& v) const;
00175
00176
00177 template <int Size, typename P1, typename B1>
00178 Operator<T> lsubtract(const Vector<Size, P1, B1>& v) const;
00179
00180
00181
00182
00183
00184
00185
00186 template<int R, int C, class P, class B>
00187 void eval(Matrix<R,C,P,B>& m) const;
00188
00189
00190
00191 template <int Rows, int Cols, typename P1, typename B1>
00192 Operator<T> add(const Matrix<Rows,Cols, P1, B1>& m) const;
00193
00194
00195
00196 template <int Rows, int Cols, typename P1, typename B1>
00197 Operator<T> rsubtract(const Matrix<Rows,Cols, P1, B1>& m) const;
00198
00199
00200 template <int Rows, int Cols, typename P1, typename B1>
00201 Operator<T> lsubtract(const Matrix<Rows,Cols, P1, B1>& m) const;
00202
00203
00204 template <int Rows, int Cols, typename P1, typename B1>
00205 void plusequals(Matrix<Rows,Cols, P1, B1>& m) const;
00206
00207
00208 template <int Rows, int Cols, typename P1, typename B1>
00209 void minusequals(Matrix<Rows,Cols, P1, B1>& m) const;
00210
00211
00212
00213
00214
00215
00216
00217
00218 Operator<T> operator()(int size) const;
00219
00220
00221 Operator<T> operator()(int num_rows, int num_cols) const;
00222
00223
00224
00225
00226 typedef T Precision;
00227
00228
00229 template<class Pout, class Pmult> Operator<Internal::Identity<Pout> > scale_me(const Pmult& m) const
00230 {
00231 return Operator<Internal::Identity<Pout> >(val*m);
00232 }
00233
00234
00235 };
00236 #else
00237 template<typename T> struct Operator;
00238 #endif
00239
00240
00241 static const int Dynamic = -1;
00242 static const int Resizable = -0x7fffffff;
00243
00244 namespace Internal
00245 {
00246
00247
00248
00249
00250 template<int I> struct StaticEndMarker
00251 {
00252 static const int End=I;
00253 };
00254
00255
00256
00257
00258
00259 struct DynamicEndMarker
00260 {
00261 DynamicEndMarker(int e_)
00262 :e(e_){}
00263 int e;
00264 };
00265 };
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276 template<int I> Internal::StaticEndMarker<I> End();
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286 inline Internal::DynamicEndMarker End()
00287 {
00288 return 0;
00289 }
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299 inline Internal::DynamicEndMarker End(int e)
00300 {
00301 return e;
00302 }
00303
00304
00305 typedef double DefaultPrecision;
00306 }
00307
00308 #include <TooN/internal/dchecktest.hh>
00309 #include <TooN/internal/allocator.hh>
00310
00311 #include <TooN/internal/size_mismatch.hh>
00312 #include <TooN/internal/overfill_error.hh>
00313 #include <TooN/internal/slice_error.hh>
00314 #include <TooN/internal/debug.hh>
00315
00316 #include <TooN/internal/comma.hh>
00317
00318 #include <TooN/internal/vbase.hh>
00319 #include <TooN/internal/vector.hh>
00320
00321 #include <TooN/internal/mbase.hh>
00322 #include <TooN/internal/matrix.hh>
00323 #include <TooN/internal/reference.hh>
00324
00325 #include <TooN/internal/make_vector.hh>
00326 #include <TooN/internal/operators.hh>
00327
00328 #include <TooN/internal/objects.h>
00329
00330 #include <TooN/internal/diagmatrix.h>
00331
00332 #include <TooN/internal/data.hh>
00333 #include <TooN/internal/data_functions.hh>
00334
00335 #include <TooN/helpers.h>
00336
00337 #endif