yat
0.8.3pre
|
00001 #ifndef _theplu_yat_classifier_kernel_lookup_ 00002 #define _theplu_yat_classifier_kernel_lookup_ 00003 00004 // $Id: KernelLookup.h 2384 2010-12-22 14:03:36Z peter $ 00005 00006 /* 00007 Copyright (C) 2005 Jari Häkkinen, Peter Johansson 00008 Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér 00009 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 00010 Copyright (C) 2010 Peter Johansson 00011 00012 This file is part of the yat library, http://dev.thep.lu.se/yat 00013 00014 The yat library is free software; you can redistribute it and/or 00015 modify it under the terms of the GNU General Public License as 00016 published by the Free Software Foundation; either version 3 of the 00017 License, or (at your option) any later version. 00018 00019 The yat library is distributed in the hope that it will be useful, 00020 but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00022 General Public License for more details. 00023 00024 You should have received a copy of the GNU General Public License 00025 along with yat. If not, see <http://www.gnu.org/licenses/>. 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 }; // class KernelLookup 00329 00330 }}} // of namespace classifier, yat, and theplu 00331 00332 #endif