yat  0.12.3pre
MatrixLookup.h
1 #ifndef _theplu_yat_classifier_matrix_lookup_
2 #define _theplu_yat_classifier_matrix_lookup_
3 
4 // $Id: MatrixLookup.h 3293 2014-07-25 03:42:58Z peter $
5 
6 /*
7  Copyright (C) 2005 Peter Johansson, Markus Ringnér
8  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
9  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
10  Copyright (C) 2009, 2010, 2012, 2014 Peter Johansson
11 
12  This file is part of the yat library, http://dev.thep.lu.se/yat
13 
14  The yat library is free software; you can redistribute it and/or
15  modify it under the terms of the GNU General Public License as
16  published by the Free Software Foundation; either version 3 of the
17  License, or (at your option) any later version.
18 
19  The yat library is distributed in the hope that it will be useful,
20  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22  General Public License for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with yat. If not, see <http://www.gnu.org/licenses/>.
26 */
27 
28 #include "yat/utility/Container2DIterator.h"
29 #include "yat/utility/deprecate.h"
30 #include "yat/utility/Index.h"
31 #include "yat/utility/iterator_traits.h"
32 #include "yat/utility/Matrix.h"
33 
34 #include <boost/iterator/permutation_iterator.hpp>
35 #include <boost/shared_ptr.hpp>
36 
37 #include <iosfwd>
38 #include <vector>
39 
40 namespace theplu {
41 namespace yat {
42 namespace classifier {
43 
71  {
72  public:
79 
86 
88  typedef utility::Container2DIterator<const MatrixLookup, const double,
91 
95  typedef boost::permutation_iterator<utility::Matrix::const_column_iterator,
98 
103 
118  MatrixLookup(const utility::Matrix& matrix, const bool own=false);
119 
133  MatrixLookup(const utility::Matrix& matrix, const utility::Index& row,
134  const utility::Index& column);
135 
157  MatrixLookup(const utility::Matrix& matrix,
158  const utility::Index& index,
159  const bool row_vectors) YAT_DEPRECATE;
160 
171  MatrixLookup(const MatrixLookup& other);
172 
197  MatrixLookup(const MatrixLookup& ml, const utility::Index& row,
198  const utility::Index& column);
199 
226  MatrixLookup(const MatrixLookup& ml, const utility::Index&,
227  const bool row_vectors);
228 
234  MatrixLookup(const size_t rows, const size_t columns, const double value=0);
235 
246  MatrixLookup(std::istream&, char sep='\0');
247 
254  virtual ~MatrixLookup();
255 
262  const_iterator begin(void) const;
263 
269  const_column_iterator begin_column(size_t) const;
270 
276  const_row_iterator begin_row(size_t) const;
277 
281  size_t columns(void) const;
282 
286  const_iterator end(void) const;
287 
291  const_column_iterator end_column(size_t) const;
292 
296  const_row_iterator end_row(size_t) const;
297 
301  size_t rows(void) const;
302 
306  bool weighted(void) const;
307 
313  const_reference operator()(size_t row, size_t column) const;
314 
323  const MatrixLookup& operator=(const MatrixLookup&);
324 
325  private:
326  friend class MatrixLookupWeighted;
327 
328  utility::Index column_index_;
329  typedef boost::shared_ptr<const utility::Matrix> MatrixP;
330  MatrixP data_;
331  utility::Index row_index_;
332 
333  // for assertions
334  bool validate(void) const;
335  };
336 
342  std::ostream& operator<< (std::ostream& s, const MatrixLookup&);
343 
344 }}} // of namespace classifier, yat, and theplu
345 
346 #endif
General view into utility::Matrix.
Definition: MatrixLookup.h:70
const double & const_reference
Definition: Matrix.h:85
const_iterator begin(void) const
const_iterator end(void) const
const MatrixLookup & operator=(const MatrixLookup &)
assigment operator
virtual ~MatrixLookup()
Destructor.
const_row_iterator end_row(size_t) const
const_reference operator()(size_t row, size_t column) const
MatrixLookup(const utility::Matrix &matrix, const bool own=false)
utility::Matrix::value_type value_type
Definition: MatrixLookup.h:78
utility::Matrix::const_reference const_reference
Definition: MatrixLookup.h:85
double value_type
Definition: Matrix.h:71
Class for storing indices of, e.g., a MatrixLookup.
Definition: Index.h:41
Iterator for a Container2D.
Definition: Container2DIterator.h:61
const_row_iterator begin_row(size_t) const
General view into utility::MatrixWeighted.
Definition: MatrixLookupWeighted.h:63
boost::permutation_iterator< utility::Matrix::const_column_iterator, utility::Index::const_iterator > const_column_iterator
Definition: MatrixLookup.h:97
StrideIterator< const double * > const_column_iterator
Definition: Matrix.h:105
const_column_iterator const_row_iterator
Definition: MatrixLookup.h:102
const_column_iterator end_column(size_t) const
Interface to GSL matrix.
Definition: Matrix.h:63
const_column_iterator begin_column(size_t) const
utility::Container2DIterator< const MatrixLookup, const double, const_reference > const_iterator
&#39;Read Only&#39; iterator
Definition: MatrixLookup.h:90
std::vector< size_t >::const_iterator const_iterator
Definition: Index.h:49

Generated on Mon Jun 1 2015 12:29:51 for yat by  doxygen 1.8.5