00001 #ifndef _theplu_yat_classifier_matrix_lookup_weighted_
00002 #define _theplu_yat_classifier_matrix_lookup_weighted_
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 #include "yat/utility/Container2DIterator.h"
00028 #include "yat/utility/DataWeight.h"
00029 #include "yat/utility/deprecate.h"
00030 #include "yat/utility/Index.h"
00031 #include "yat/utility/MatrixWeighted.h"
00032 #include "yat/utility/SmartPtr.h"
00033 #include "yat/utility/StrideIterator.h"
00034
00035 #include <boost/iterator/permutation_iterator.hpp>
00036
00037 #include <iosfwd>
00038 #include <utility>
00039 #include <vector>
00040
00041 namespace theplu {
00042 namespace yat {
00043 namespace classifier {
00044
00045 class MatrixLookup;
00046
00063 class MatrixLookupWeighted
00064 {
00065 public:
00071 typedef utility::DataWeight value_type;
00072
00078 typedef const utility::DataWeight& const_reference;
00079
00081 typedef utility::StrideIterator<
00082 utility::Container2DIterator<const MatrixLookupWeighted,
00083 const value_type, const_reference> >
00084 const_iterator;
00085
00089 typedef boost::permutation_iterator<
00090 utility::MatrixWeighted::const_column_iterator,
00091 utility::Index::const_iterator> const_column_iterator;
00092
00096 typedef boost::permutation_iterator<
00097 utility::MatrixWeighted::const_row_iterator,
00098 utility::Index::const_iterator> const_row_iterator;
00099
00106 MatrixLookupWeighted(const utility::MatrixWeighted& matrix,
00107 const utility::Index& rows,
00108 const utility::Index& columns);
00109
00113 explicit MatrixLookupWeighted(const utility::MatrixWeighted& matrix,
00114 bool owner=false);
00115
00125 explicit MatrixLookupWeighted(const MatrixLookup& matrix);
00126
00127
00138 MatrixLookupWeighted(const MatrixLookupWeighted& other);
00139
00159 MatrixLookupWeighted(const MatrixLookupWeighted& ml,
00160 const utility::Index& row,
00161 const utility::Index& column);
00162
00189 MatrixLookupWeighted(const MatrixLookupWeighted& ml,
00190 const utility::Index&,
00191 const bool row_vectors) YAT_DEPRECATE;
00192
00198 MatrixLookupWeighted(const size_t rows, const size_t columns,
00199 const double value=0, const double weight=1);
00200
00210 MatrixLookupWeighted(std::istream&, char sep='\0');
00211
00216 virtual ~MatrixLookupWeighted();
00217
00224 const_iterator begin(void) const;
00225
00231 const_column_iterator begin_column(size_t) const;
00232
00238 const_row_iterator begin_row(size_t) const;
00239
00243 size_t columns(void) const;
00244
00248 double data(size_t row, size_t column) const;
00249
00253 const_iterator end(void) const;
00254
00258 const_column_iterator end_column(size_t) const;
00259
00263 const_row_iterator end_row(size_t) const;
00264
00268 size_t rows(void) const;
00269
00273 double weight(size_t row, size_t column) const;
00274
00278 bool weighted(void) const;
00279
00285 const_reference operator()(const size_t row, const size_t column) const;
00286
00295 const MatrixLookupWeighted& operator=(const MatrixLookupWeighted&);
00296
00297 private:
00298 typedef utility::SmartPtr<const utility::MatrixWeighted> MatrixWP;
00299 utility::Index column_index_;
00300 MatrixWP data_;
00301 utility::Index row_index_;
00302
00303
00304 bool validate(void) const;
00305 };
00306
00315 std::ostream& operator<< (std::ostream& s, const MatrixLookupWeighted&);
00316
00317 }}}
00318
00319 #endif