00001 #ifndef _theplu_yat_classifier_dataLookup1D_ 00002 #define _theplu_yat_classifier_dataLookup1D_ 00003 00004 // $Id: DataLookup1D.h 2119 2009-12-12 23:11:43Z peter $ 00005 00006 /* 00007 Copyright (C) 2005 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) 2009 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 "MatrixLookup.h" 00029 00030 #include <iosfwd> 00031 #include <vector> 00032 00033 namespace theplu { 00034 namespace yat { 00035 namespace utility { 00036 class VectorBase; 00037 } 00038 namespace classifier { 00039 00043 class DataLookup1D 00044 { 00045 public: 00051 typedef MatrixLookup::value_type value_type; 00052 00058 typedef MatrixLookup::const_reference const_reference; 00059 00061 typedef MatrixLookup::const_row_iterator const_iterator; 00062 00071 DataLookup1D(const MatrixLookup& m, const size_t index, 00072 const bool row_vector); 00073 00077 DataLookup1D(const DataLookup1D&); 00078 00083 DataLookup1D(const size_t size, const double value=0); 00084 00092 DataLookup1D(const utility::VectorBase& vec, 00093 const std::vector<size_t>& index); 00094 00102 DataLookup1D(const utility::VectorBase& vec); 00103 00107 virtual ~DataLookup1D(); 00108 00112 const_iterator begin() const; 00113 00117 const_iterator end() const; 00118 00122 size_t size(void) const; 00123 00127 double operator()(const size_t i) const; 00128 00132 double operator*(const DataLookup1D&) const; 00133 00134 private: 00135 // assignment no allowed 00136 const DataLookup1D& operator=(const DataLookup1D&); 00137 00138 const bool column_vector_; 00139 const size_t index_; 00140 const MatrixLookup* matrix_; 00141 const bool owner_; 00142 00143 }; 00144 00148 00160 std::ostream& operator<<(std::ostream& s, const DataLookup1D& v); 00161 00162 }}} // of namespace classifier, yat, and theplu 00163 00164 #endif