yat
0.8.3pre
|
00001 #ifndef _theplu_yat_classifier_dataLookup_weighted_1D_ 00002 #define _theplu_yat_classifier_dataLookup_weighted_1D_ 00003 00004 // $Id: DataLookupWeighted1D.h 2119 2009-12-12 23:11:43Z peter $ 00005 00006 /* 00007 Copyright (C) 2006 Jari Häkkinen, Peter Johansson 00008 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér 00009 Copyright (C) 2009 Peter Johansson 00010 00011 This file is part of the yat library, http://dev.thep.lu.se/yat 00012 00013 The yat library is free software; you can redistribute it and/or 00014 modify it under the terms of the GNU General Public License as 00015 published by the Free Software Foundation; either version 3 of the 00016 License, or (at your option) any later version. 00017 00018 The yat library is distributed in the hope that it will be useful, 00019 but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00021 General Public License for more details. 00022 00023 You should have received a copy of the GNU General Public License 00024 along with yat. If not, see <http://www.gnu.org/licenses/>. 00025 */ 00026 00027 #include "MatrixLookupWeighted.h" 00028 #include "yat/utility/Container2DIterator.h" 00029 #include "yat/utility/StrideIterator.h" 00030 00031 #include <utility> 00032 #include <vector> 00033 00034 namespace theplu { 00035 namespace yat { 00036 namespace classifier { 00037 00043 class DataLookupWeighted1D 00044 { 00045 00046 public: 00052 typedef utility::DataWeight value_type; 00053 00059 typedef const utility::DataWeight const_reference; 00060 00062 typedef MatrixLookupWeighted::const_row_iterator const_iterator; 00063 00072 DataLookupWeighted1D(const MatrixLookupWeighted& m, const size_t index, 00073 const bool row_vector); 00074 00078 DataLookupWeighted1D(const DataLookupWeighted1D&); 00079 00084 DataLookupWeighted1D(const size_t size, double value=0, double weight=1); 00085 00089 virtual ~DataLookupWeighted1D(); 00090 00094 const_iterator begin() const; 00095 00099 double data(const size_t i) const; 00100 00104 const_iterator end() const; 00105 00109 size_t size(void) const; 00110 00114 double weight(const size_t i) const; 00115 00119 const_reference operator()(const size_t i) const; 00120 00121 private: 00122 const DataLookupWeighted1D& operator=(const DataLookupWeighted1D&); 00123 00124 const bool column_vector_; 00125 const size_t index_; 00126 const MatrixLookupWeighted* matrix_; 00127 const bool owner_; 00128 00129 }; 00130 00136 double sum_weight(const DataLookupWeighted1D&); 00137 00138 }}} // of namespace classifier, yat, and theplu 00139 00140 #endif