00001 #ifndef _theplu_yat_classifier_kernel_lookup_
00002 #define _theplu_yat_classifier_kernel_lookup_
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 #include "Kernel.h"
00029 #include "yat/utility/Container2DIterator.h"
00030 #include "yat/utility/Index.h"
00031 #include "yat/utility/iterator_traits.h"
00032 #include "yat/utility/SmartPtr.h"
00033 #include "yat/utility/StrideIterator.h"
00034
00035 namespace theplu {
00036 namespace yat {
00037 namespace classifier {
00038
00039 class KernelFunction;
00040 class MatrixLookup;
00041 class MatrixLookupWeighted;
00042
00066 class KernelLookup
00067 {
00068
00069 public:
00075 typedef double value_type;
00076
00082 typedef const double const_reference;
00083
00085 typedef utility::StrideIterator<
00086 utility::Container2DIterator<const KernelLookup, const double,
00087 const_reference> >
00088 const_iterator;
00089
00093 typedef const_iterator const_column_iterator;
00094
00098 typedef const_iterator const_row_iterator;
00099
00115 KernelLookup(const Kernel& kernel, const bool owner=false);
00116
00133 KernelLookup(const Kernel& kernel, const utility::Index& row,
00134 const utility::Index& column, const bool owner=false);
00135
00145 KernelLookup(const KernelLookup& kl);
00146
00147
00165 KernelLookup(const KernelLookup& kl, const utility::Index& row,
00166 const utility::Index& column);
00167
00180 KernelLookup(const KernelLookup& kl, const utility::Index&,
00181 const bool row=false);
00182
00189 virtual ~KernelLookup(void);
00190
00197 const_iterator begin(void) const;
00198
00204 const_column_iterator begin_column(size_t) const;
00205
00211 const_row_iterator begin_row(size_t) const;
00212
00216 size_t columns(void) const;
00217
00226 MatrixLookup data(void) const;
00227
00236 MatrixLookupWeighted data_weighted(void) const;
00237
00244 double element(const DataLookup1D& vec, size_t i) const;
00245
00255 double element(const DataLookupWeighted1D& vec, size_t i) const;
00256
00260 const_iterator end(void) const;
00261
00265 const_column_iterator end_column(size_t) const;
00266
00270 const_row_iterator end_row(size_t) const;
00271
00275 size_t rows(void) const;
00276
00283 KernelLookup selected(const utility::Index& index) const;
00284
00295 KernelLookup test_kernel(const MatrixLookup& data) const;
00296
00307 KernelLookup test_kernel(const MatrixLookupWeighted& data) const;
00308
00312 bool weighted(void) const;
00313
00318 const_reference operator()(size_t row, size_t column) const;
00319
00320 private:
00321 const KernelLookup& operator=(const KernelLookup&);
00322 bool validate(const utility::Index&) const;
00323
00324 utility::Index column_index_;
00325 utility::SmartPtr<const Kernel> kernel_;
00326 utility::Index row_index_;
00327
00328 };
00329
00330 }}}
00331
00332 #endif