00001 #ifndef _theplu_yat_classifier_dataLookup1D_ 00002 #define _theplu_yat_classifier_dataLookup1D_ 00003 00004 // $Id: DataLookup1D.h 1797 2009-02-12 18:07:10Z 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 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 "MatrixLookup.h" 00028 00029 #include <iostream> 00030 #include <vector> 00031 00032 namespace theplu { 00033 namespace yat { 00034 namespace utility { 00035 class VectorBase; 00036 } 00037 namespace classifier { 00038 00042 class DataLookup1D 00043 { 00044 public: 00050 typedef MatrixLookup::value_type value_type; 00051 00057 typedef MatrixLookup::const_reference const_reference; 00058 00060 typedef MatrixLookup::const_row_iterator const_iterator; 00061 00070 DataLookup1D(const MatrixLookup& m, const size_t index, 00071 const bool row_vector); 00072 00076 DataLookup1D(const DataLookup1D&); 00077 00082 DataLookup1D(const size_t size, const double value=0); 00083 00091 DataLookup1D(const utility::VectorBase& vec, 00092 const std::vector<size_t>& index); 00093 00101 DataLookup1D(const utility::VectorBase& vec); 00102 00106 virtual ~DataLookup1D(); 00107 00111 const_iterator begin() const; 00112 00116 const_iterator end() const; 00117 00121 size_t size(void) const; 00122 00126 double operator()(const size_t i) const; 00127 00131 double operator*(const DataLookup1D&) const; 00132 00133 private: 00134 // assignment no allowed 00135 const DataLookup1D& operator=(const DataLookup1D&); 00136 00137 const bool column_vector_; 00138 const size_t index_; 00139 const MatrixLookup* matrix_; 00140 const bool owner_; 00141 00142 }; 00143 00147 00157 std::ostream& operator<<(std::ostream& s, const DataLookup1D& v); 00158 00159 }}} // of namespace classifier, yat, and theplu 00160 00161 #endif