00001 #ifndef _theplu_yat_classifier_dataLookup_weighted_1D_ 00002 #define _theplu_yat_classifier_dataLookup_weighted_1D_ 00003 00004 // $Id: DataLookupWeighted1D.h 1797 2009-02-12 18:07:10Z 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 00010 This file is part of the yat library, http://dev.thep.lu.se/yat 00011 00012 The yat library is free software; you can redistribute it and/or 00013 modify it under the terms of the GNU General Public License as 00014 published by the Free Software Foundation; either version 3 of the 00015 License, or (at your option) any later version. 00016 00017 The yat library is distributed in the hope that it will be useful, 00018 but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 General Public License for more details. 00021 00022 You should have received a copy of the GNU General Public License 00023 along with yat. If not, see <http://www.gnu.org/licenses/>. 00024 */ 00025 00026 #include "MatrixLookupWeighted.h" 00027 #include "yat/utility/Container2DIterator.h" 00028 #include "yat/utility/StrideIterator.h" 00029 00030 #include <iostream> 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 00134 double sum_weight(const DataLookupWeighted1D&); 00135 00136 }}} // of namespace classifier, yat, and theplu 00137 00138 #endif