yat  0.21pre
MatrixLookupWeighted.h
1 #ifndef _theplu_yat_classifier_matrix_lookup_weighted_
2 #define _theplu_yat_classifier_matrix_lookup_weighted_
3 
4 // $Id: MatrixLookupWeighted.h 4019 2020-11-06 01:55:37Z peter $
5 
6 /*
7  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
8  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
9  Copyright (C) 2009, 2010, 2012, 2020 Peter Johansson
10 
11  This file is part of the yat library, http://dev.thep.lu.se/yat
12 
13  The yat library is free software; you can redistribute it and/or
14  modify it under the terms of the GNU General Public License as
15  published by the Free Software Foundation; either version 3 of the
16  License, or (at your option) any later version.
17 
18  The yat library is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  General Public License for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with yat. If not, see <http://www.gnu.org/licenses/>.
25 */
26 
27 #include "yat/utility/Container2DIterator.h"
28 #include "yat/utility/DataWeight.h"
29 #include "yat/utility/deprecate.h"
30 #include "yat/utility/Index.h"
31 #include "yat/utility/MatrixWeighted.h"
32 #include "yat/utility/StrideIterator.h"
33 
34 #include <boost/iterator/permutation_iterator.hpp>
35 
36 #include <iosfwd>
37 #include <memory>
38 #include <utility>
39 #include <vector>
40 
41 namespace theplu {
42 namespace yat {
43 namespace classifier {
44 
45  class MatrixLookup;
46 
64  {
65  public:
72 
79 
83  const value_type, const_reference> >
85 
89  typedef boost::permutation_iterator<
92 
96  typedef boost::permutation_iterator<
99 
107  const utility::Index& rows,
108  const utility::Index& columns);
109 
113  explicit MatrixLookupWeighted(const utility::MatrixWeighted& matrix,
114  bool owner=false);
115 
125  explicit MatrixLookupWeighted(const MatrixLookup& matrix);
126 
127 
139 
160  const utility::Index& row,
161  const utility::Index& column);
162 
190  const utility::Index&,
191  const bool row_vectors) YAT_DEPRECATE;
192 
198  MatrixLookupWeighted(const size_t rows, const size_t columns,
199  const double value=0, const double weight=1);
200 
210  MatrixLookupWeighted(std::istream&, char sep='\0');
211 
216  virtual ~MatrixLookupWeighted();
217 
224  const_iterator begin(void) const;
225 
231  const_column_iterator begin_column(size_t) const;
232 
238  const_row_iterator begin_row(size_t) const;
239 
243  size_t columns(void) const;
244 
248  double data(size_t row, size_t column) const;
249 
253  const_iterator end(void) const;
254 
258  const_column_iterator end_column(size_t) const;
259 
263  const_row_iterator end_row(size_t) const;
264 
268  size_t rows(void) const;
269 
273  double weight(size_t row, size_t column) const;
274 
278  bool weighted(void) const;
279 
285  const_reference operator()(const size_t row, const size_t column) const;
286 
296 
297  private:
298  typedef std::shared_ptr<const utility::MatrixWeighted> MatrixWP;
299  utility::Index column_index_;
300  MatrixWP data_;
301  utility::Index row_index_;
302 
303  // for assertions
304  bool validate(void) const;
305  };
306 
315  std::ostream& operator<< (std::ostream& s, const MatrixLookupWeighted&);
316 
317 }}} // of namespace classifier, yat, and theplu
318 
319 #endif
General view into utility::Matrix.
Definition: MatrixLookup.h:70
boost::permutation_iterator< utility::MatrixWeighted::const_row_iterator, utility::Index::const_iterator > const_row_iterator
Definition: MatrixLookupWeighted.h:98
utility::StrideIterator< utility::Container2DIterator< const MatrixLookupWeighted, const value_type, const_reference > > const_iterator
&#39;Read Only&#39; iterator
Definition: MatrixLookupWeighted.h:84
const_row_iterator end_row(size_t) const
const utility::DataWeight & const_reference
Definition: MatrixLookupWeighted.h:78
The Department of Theoretical Physics namespace as we define it.
const_row_iterator begin_row(size_t) const
const MatrixLookupWeighted & operator=(const MatrixLookupWeighted &)
assigment operator
StrideIterator< std::vector< DataWeight >::const_iterator > const_column_iterator
Definition: MatrixWeighted.h:84
Holds a pair of data and associated weight.
Definition: DataWeight.h:39
double weight(size_t row, size_t column) const
Class for storing indices of, e.g., a MatrixLookup.
Definition: Index.h:41
Iterator for a Container2D.
Definition: Container2DIterator.h:62
General view into utility::MatrixWeighted.
Definition: MatrixLookupWeighted.h:63
MatrixLookupWeighted(const utility::MatrixWeighted &matrix, const utility::Index &rows, const utility::Index &columns)
Create a lookup into matrix.
boost::permutation_iterator< utility::MatrixWeighted::const_column_iterator, utility::Index::const_iterator > const_column_iterator
Definition: MatrixLookupWeighted.h:91
const_reference operator()(const size_t row, const size_t column) const
utility::DataWeight value_type
Definition: MatrixLookupWeighted.h:71
Weighted Matrix.
Definition: MatrixWeighted.h:47
const_column_iterator end_column(size_t) const
double data(size_t row, size_t column) const
Adaptor using a stride on underlying iterator.
Definition: StrideIterator.h:50
const_column_iterator begin_column(size_t) const
const_column_iterator const_row_iterator
Definition: MatrixWeighted.h:94
std::vector< size_t >::const_iterator const_iterator
Definition: Index.h:49

Generated on Wed Jan 25 2023 03:34:29 for yat by  doxygen 1.8.14