00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef MTL_MATRIX_CONCEPT_INCLUDE
00013 #define MTL_MATRIX_CONCEPT_INCLUDE
00014
00015 #include <boost/numeric/mtl/mtl_fwd.hpp>
00016 #include <boost/numeric/mtl/concept/collection.hpp>
00017
00018 #ifdef __GXX_CONCEPTS__
00019 # include <concepts>
00020 #else
00021 # include <boost/numeric/linear_algebra/pseudo_concept.hpp>
00022 #endif
00023
00024 namespace mtl {
00025
00030 #ifdef __GXX_CONCEPTS__
00031 concept Matrix<typename T>
00032 : AlgebraicCollection<T>
00033 {
00034 const_reference T::operator() (size_type row, size_type col) const;
00035
00036 size_type nnz(T);
00037
00038
00039 };
00040 #else
00041
00042
00064 template <typename T>
00065 struct Matrix
00066 : public AlgebraicCollection<T>
00067 {
00069 const_reference T::operator() (size_type row, size_type col) const;
00070 };
00071 #endif
00072
00073
00074
00075 #ifdef __GXX_CONCEPTS__
00076 concept MatrixInserter<typename T>
00077 {
00078 typename matrix_type;
00079
00080
00081 requires Matrix<matrix_type>;
00082
00083 typename proxy_type;
00084 proxy_type operator() (Matrix<matrix_type>::size_type row, Matrix<matrix_type>::size_type col);
00085
00086 T operator<< (proxy_type, Matrix<matrix_type>::value_type>);
00087 };
00088 #else
00089
00090
00116 template <typename T>
00117 struct MatrixInserter
00118 {
00120 typedef associated_type matrix_type;
00121
00123 typedef associated_type proxy_type;
00125 proxy_type operator() (Matrix<matrix_type>::size_type row, Matrix<matrix_type>::size_type col);
00126 };
00127 #endif
00128
00129 #ifdef __GXX_CONCEPTS__
00130 concept InsertableMatrix<typename T>
00131 : Matrix<T>
00132 {
00133 requires MatrixInserter<mtl::matrix::inserter<T> >;
00134 };
00135 #else
00136
00137
00147 template <typename T>
00148 struct InsertableMatrix
00149 : Matrix < T >
00150 {};
00151 #endif
00152
00153
00154 #ifdef __GXX_CONCEPTS__
00155 concept MutableMatrix<typename T>
00156 : Matrix<T>,
00157 MutableCollection<T>
00158 {
00159 reference T::operator() (size_type row, size_type col);
00160
00161
00162 };
00163 #else
00164
00165
00185 template <typename T>
00186 struct MutableMatrix
00187 : public Matrix<T>,
00188 public MutableCollection<T>
00189 {
00191 reference T::operator() (size_type row, size_type col);
00192 };
00193 #endif
00194
00195
00196 #ifdef __GXX_CONCEPTS__
00197 concept ConstantSizeMatrix<typename T>
00198 : Matrix<T>,
00199 ConstantSizeAlgebraicCollection<T>
00200 {};
00201 #else
00202
00203
00208 template <typename T>
00209 struct ConstantSizeMatrix
00210 : public Matrix<T>,
00211 public ConstantSizeAlgebraicCollection<T>
00212 {};
00213 #endif
00214
00215
00216 #ifdef __GXX_CONCEPTS__
00217 concept ResizeableMatrix<typename T>
00218 : Matrix<T>
00219 {
00220 void T::resize(size_type r, size_type c);
00221 };
00222 #else
00223
00224
00228 template <typename T>
00229 struct ResizeableMatrix
00230 : public Matrix<T>
00231 {
00233
00234 void resize(size_type r, size_type c);
00235 };
00236 #endif
00237
00238
00239 #ifdef __GXX_CONCEPTS__
00240 concept RowTraversableMatrix<typename M>
00241 : Matrix<M>,
00242 TraversableCollection<mtl::tag::row, M>
00243 {};
00244 #else
00245
00246
00251 template <typename M>
00252 struct RowTraversableMatrix
00253 : public Matrix<M>,
00254 public TraversableCollection<mtl::tag::row, M>
00255 {};
00256 #endif
00257
00258
00259 #ifdef __GXX_CONCEPTS__
00260 concept ColumnTraversableMatrix<typename M>
00261 : Matrix<M>,
00262 TraversableCollection<mtl::tag::col, M>
00263 {};
00264 #else
00265
00266
00271 template <typename M>
00272 struct ColumnTraversableMatrix
00273 : public Matrix<M>,
00274 public TraversableCollection<mtl::tag::col, M>
00275 {};
00276 #endif
00277
00278
00279 #ifdef __GXX_CONCEPTS__
00280 concept MajorTraversableMatrix<typename M>
00281 : Matrix<M>,
00282 TraversableCollection<mtl::tag::major, M>
00283 {};
00284 #else
00285
00286
00296 template <typename M>
00297 struct MajorTraversableMatrix
00298 : public Matrix<M>,
00299 public TraversableCollection<mtl::tag::major, M>
00300 {};
00301 #endif
00302
00303
00304 #ifdef __GXX_CONCEPTS__
00305 concept MinorTraversableMatrix<typename M>
00306 : Matrix<M>,
00307 TraversableCollection<mtl::tag::minor, M>
00308 {};
00309 #else
00310
00311
00321 template <typename M>
00322 struct MinorTraversableMatrix
00323 : public Matrix<M>,
00324 public TraversableCollection<mtl::tag::minor, M>
00325 {};
00326 #endif
00327
00328
00329 #ifdef __GXX_CONCEPTS__
00330 concept AllTraversableMatrix<typename M>
00331 : Matrix<M>,
00332 TraversableCollection<mtl::tag::all, M>
00333 {};
00334 #else
00335
00336
00346 template <typename M>
00347 struct AllTraversableMatrix
00348 : public Matrix<M>,
00349 public TraversableCollection<mtl::tag::all, M>
00350 {};
00351 #endif
00352
00353
00354 #ifdef __GXX_CONCEPTS__
00355 concept NonZeroTraversableMatrix<typename M>
00356 : Matrix<M>,
00357 TraversableCollection<mtl::tag::nz, M>
00358 {};
00359 #else
00360
00361
00371 template <typename M>
00372 struct AllTraversableMatrix
00373 : public Matrix<M>,
00374 public TraversableCollection<mtl::tag::all, M>
00375 {};
00376 #endif
00377
00378
00379 #ifdef __GXX_CONCEPTS__
00380 concept AllTraversableSubMatrix<typename Tag, typename M>
00381 : Matrix<M>,
00382 TraversableCollection<Tag, M>,
00383 TraversableCollection<mtl::tag::all, TraversableCollection<Tag, M>::result_type>
00384 {};
00385 #else
00386
00387
00395 template <typename Tag, typename M>
00396 struct AllTraversableMatrix
00397 : public Matrix<M>,
00398 public TraversableCollection<Tag, M>,
00399 public TraversableCollection<mtl::tag::all, TraversableCollection<Tag, M>::result_type>
00400 {};
00401 #endif
00402
00403
00404
00405 #ifdef __GXX_CONCEPTS__
00406 concept NonZeroTraversableSubMatrix<typename Tag, typename M>
00407 : Matrix<M>,
00408 TraversableCollection<Tag, M>,
00409 TraversableCollection<mtl::tag::nz, TraversableCollection<Tag, M>::result_type>
00410 {};
00411 #else
00412
00413
00421 template <typename Tag, typename M>
00422 struct NonZeroTraversableSubMatrix
00423 : public Matrix<M>,
00424 public TraversableCollection<Tag, M>,
00425 public TraversableCollection<mtl::tag::nz, TraversableCollection<Tag, M>::result_type>
00426 {};
00427 #endif
00428
00429
00430 #ifdef __GXX_CONCEPTS__
00431 concept IteratableSubMatrix<typename Tag, typename ITag, typename M>
00432 : Matrix<M>,
00433 TraversableCollection<Tag, M>,
00434 TraversableCollection<ITag, TraversableCollection<Tag, M>::result_type>
00435 {};
00436 #else
00437
00438
00450 template <typename Tag, typename ITag, typename M>
00451 struct IteratableSubMatrix
00452 : public Matrix<M>,
00453 public TraversableCollection<Tag, M>,
00454 public TraversableCollection<ITag, TraversableCollection<Tag, M>::result_type>
00455 {};
00456 #endif
00457
00458
00459
00460
00461
00462
00464
00465 }
00466
00467 #endif // MTL_MATRIX_CONCEPT_INCLUDE