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 #include "yat/utility/Container2DIterator.h"
00027 #include "yat/utility/DataWeight.h"
00028 #include "yat/utility/Index.h"
00029 #include "yat/utility/MatrixWeighted.h"
00030 #include "yat/utility/SmartPtr.h"
00031 #include "yat/utility/StrideIterator.h"
00032
00033 #include <boost/iterator/permutation_iterator.hpp>
00034
00035 #include <iostream>
00036 #include <utility>
00037 #include <vector>
00038
00039 namespace theplu {
00040 namespace yat {
00041 namespace classifier {
00042
00043 class MatrixLookup;
00044
00061 class MatrixLookupWeighted
00062 {
00063 public:
00069 typedef utility::DataWeight value_type;
00070
00076 typedef const utility::DataWeight& const_reference;
00077
00079 typedef utility::StrideIterator<
00080 utility::Container2DIterator<const MatrixLookupWeighted,
00081 value_type, const_reference> >
00082 const_iterator;
00083
00087 typedef boost::permutation_iterator<
00088 utility::MatrixWeighted::const_column_iterator,
00089 utility::Index::const_iterator> const_column_iterator;
00090
00094 typedef boost::permutation_iterator<
00095 utility::MatrixWeighted::const_row_iterator,
00096 utility::Index::const_iterator> const_row_iterator;
00097
00104 MatrixLookupWeighted(const utility::MatrixWeighted& matrix,
00105 const utility::Index& rows,
00106 const utility::Index& columns);
00107
00111 explicit MatrixLookupWeighted(const utility::MatrixWeighted& matrix,
00112 bool owner=false);
00113
00123 explicit MatrixLookupWeighted(const MatrixLookup& matrix);
00124
00125
00136 MatrixLookupWeighted(const MatrixLookupWeighted& other);
00137
00157 MatrixLookupWeighted(const MatrixLookupWeighted& ml,
00158 const utility::Index& row,
00159 const utility::Index& column);
00160
00183 MatrixLookupWeighted(const MatrixLookupWeighted& ml,
00184 const utility::Index&,
00185 const bool row_vectors);
00186
00192 MatrixLookupWeighted(const size_t rows, const size_t columns,
00193 const double value=0, const double weight=1);
00194
00204 MatrixLookupWeighted(std::istream&, char sep='\0');
00205
00210 virtual ~MatrixLookupWeighted();
00211
00218 const_iterator begin(void) const;
00219
00225 const_column_iterator begin_column(size_t) const;
00226
00232 const_row_iterator begin_row(size_t) const;
00233
00237 size_t columns(void) const;
00238
00242 double data(size_t row, size_t column) const;
00243
00247 const_iterator end(void) const;
00248
00252 const_column_iterator end_column(size_t) const;
00253
00257 const_row_iterator end_row(size_t) const;
00258
00262 size_t rows(void) const;
00263
00267 double weight(size_t row, size_t column) const;
00268
00272 bool weighted(void) const;
00273
00279 const_reference operator()(const size_t row, const size_t column) const;
00280
00289 const MatrixLookupWeighted& operator=(const MatrixLookupWeighted&);
00290
00291 private:
00292 typedef utility::SmartPtr<const utility::MatrixWeighted> MatrixWP;
00293 utility::Index column_index_;
00294 MatrixWP data_;
00295 utility::Index row_index_;
00296
00297
00298 bool validate(void) const;
00299 };
00300
00307 std::ostream& operator<< (std::ostream& s, const MatrixLookupWeighted&);
00308
00309 }}}
00310
00311 #endif