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/Index.h"
00030 #include "yat/utility/MatrixWeighted.h"
00031 #include "yat/utility/SmartPtr.h"
00032 #include "yat/utility/StrideIterator.h"
00033
00034 #include <boost/iterator/permutation_iterator.hpp>
00035
00036 #include <iosfwd>
00037 #include <utility>
00038 #include <vector>
00039
00040 namespace theplu {
00041 namespace yat {
00042 namespace classifier {
00043
00044 class MatrixLookup;
00045
00062 class MatrixLookupWeighted
00063 {
00064 public:
00070 typedef utility::DataWeight value_type;
00071
00077 typedef const utility::DataWeight& const_reference;
00078
00080 typedef utility::StrideIterator<
00081 utility::Container2DIterator<const MatrixLookupWeighted,
00082 value_type, const_reference> >
00083 const_iterator;
00084
00088 typedef boost::permutation_iterator<
00089 utility::MatrixWeighted::const_column_iterator,
00090 utility::Index::const_iterator> const_column_iterator;
00091
00095 typedef boost::permutation_iterator<
00096 utility::MatrixWeighted::const_row_iterator,
00097 utility::Index::const_iterator> const_row_iterator;
00098
00105 MatrixLookupWeighted(const utility::MatrixWeighted& matrix,
00106 const utility::Index& rows,
00107 const utility::Index& columns);
00108
00112 explicit MatrixLookupWeighted(const utility::MatrixWeighted& matrix,
00113 bool owner=false);
00114
00124 explicit MatrixLookupWeighted(const MatrixLookup& matrix);
00125
00126
00137 MatrixLookupWeighted(const MatrixLookupWeighted& other);
00138
00158 MatrixLookupWeighted(const MatrixLookupWeighted& ml,
00159 const utility::Index& row,
00160 const utility::Index& column);
00161
00184 MatrixLookupWeighted(const MatrixLookupWeighted& ml,
00185 const utility::Index&,
00186 const bool row_vectors);
00187
00193 MatrixLookupWeighted(const size_t rows, const size_t columns,
00194 const double value=0, const double weight=1);
00195
00205 MatrixLookupWeighted(std::istream&, char sep='\0');
00206
00211 virtual ~MatrixLookupWeighted();
00212
00219 const_iterator begin(void) const;
00220
00226 const_column_iterator begin_column(size_t) const;
00227
00233 const_row_iterator begin_row(size_t) const;
00234
00238 size_t columns(void) const;
00239
00243 double data(size_t row, size_t column) const;
00244
00248 const_iterator end(void) const;
00249
00253 const_column_iterator end_column(size_t) const;
00254
00258 const_row_iterator end_row(size_t) const;
00259
00263 size_t rows(void) const;
00264
00268 double weight(size_t row, size_t column) const;
00269
00273 bool weighted(void) const;
00274
00280 const_reference operator()(const size_t row, const size_t column) const;
00281
00290 const MatrixLookupWeighted& operator=(const MatrixLookupWeighted&);
00291
00292 private:
00293 typedef utility::SmartPtr<const utility::MatrixWeighted> MatrixWP;
00294 utility::Index column_index_;
00295 MatrixWP data_;
00296 utility::Index row_index_;
00297
00298
00299 bool validate(void) const;
00300 };
00301
00310 std::ostream& operator<< (std::ostream& s, const MatrixLookupWeighted&);
00311
00312 }}}
00313
00314 #endif