yat  0.14.5pre
MatrixWeighted.h
1 #ifndef _theplu_yat_utility_matrix_weighted_
2 #define _theplu_yat_utility_matrix_weighted_
3 
4 // $Id: MatrixWeighted.h 2992 2013-03-03 05:03:44Z peter $
5 
6 /*
7  Copyright (C) 2003 Daniel Dalevi, Peter Johansson
8  Copyright (C) 2004 Jari Häkkinen, Peter Johansson
9  Copyright (C) 2005, 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
10  Copyright (C) 2007, 2008, 2009 Jari Häkkinen, 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 "DataWeight.h"
29 #include "StrideIterator.h"
30 
31 #include <vector>
32 
33 namespace theplu {
34 namespace yat {
35 namespace utility {
36 
37  class Matrix;
38 
45  {
46  public:
51 
56 
60  typedef const DataWeight& const_reference;
61 
65  typedef std::vector<DataWeight>::iterator iterator;
66 
70  typedef std::vector<DataWeight>::const_iterator const_iterator;
71 
76 
82 
87 
92 
98  MatrixWeighted(void);
99 
109  MatrixWeighted(size_t r, size_t c, double init_value=0,
110  double init_weight=1.0);
111 
116 
117 
125  explicit MatrixWeighted(const Matrix& other);
126 
139  explicit MatrixWeighted(std::istream &, char sep='\0');
140 
147  iterator begin(void);
148 
155  const_iterator begin(void) const;
156 
162  column_iterator begin_column(size_t i);
163 
169  const_column_iterator begin_column(size_t i) const;
170 
176  row_iterator begin_row(size_t i);
177 
183  const_row_iterator begin_row(size_t i) const;
184 
188  size_t columns(void) const;
189 
193  iterator end(void);
194 
198  const_iterator end(void) const;
199 
203  column_iterator end_column(size_t i);
204 
208  const_column_iterator end_column(size_t i) const;
209 
213  row_iterator end_row(size_t i);
214 
218  const_row_iterator end_row(size_t i) const;
219 
229  void resize(size_t rows, size_t columns);
230 
234  size_t rows(void) const;
235 
242  void swap(MatrixWeighted& other);
243 
249  DataWeight& operator()(size_t row,size_t column);
250 
257  const DataWeight& operator()(size_t row,size_t column) const;
258 
259 
265  const MatrixWeighted& operator=(const MatrixWeighted& other);
266 
267  private:
268  void copy(const Matrix&);
269 
270  std::vector<DataWeight> vec_;
271  size_t columns_;
272 
273  };
274 
284  void swap(MatrixWeighted&, MatrixWeighted&);
285 
286 }}} // of namespace utility, yat, and theplu
287 
288 #endif
void swap(MatrixWeighted &other)
swap objects
DataWeight value_type
Definition: MatrixWeighted.h:50
void resize(size_t rows, size_t columns)
Resize MatrixWeighted.
DataWeight & reference
Definition: MatrixWeighted.h:55
row_iterator end_row(size_t i)
row_iterator begin_row(size_t i)
StrideIterator< std::vector< DataWeight >::const_iterator > const_column_iterator
Definition: MatrixWeighted.h:81
Holds a pair of data and associated weight.
Definition: DataWeight.h:39
const MatrixWeighted & operator=(const MatrixWeighted &other)
The assignment operator.
column_iterator end_column(size_t i)
column_iterator begin_column(size_t i)
const DataWeight & const_reference
Definition: MatrixWeighted.h:60
MatrixWeighted(void)
The default constructor.
StrideIterator< std::vector< DataWeight >::iterator > column_iterator
Definition: MatrixWeighted.h:75
DataWeight & operator()(size_t row, size_t column)
Element access operator.
std::vector< DataWeight >::const_iterator const_iterator
Definition: MatrixWeighted.h:70
column_iterator row_iterator
Definition: MatrixWeighted.h:86
std::vector< DataWeight >::iterator iterator
Definition: MatrixWeighted.h:65
Interface to GSL matrix.
Definition: Matrix.h:63
Weighted Matrix.
Definition: MatrixWeighted.h:44
Adaptor using a stride on underlying iterator.
Definition: StrideIterator.h:50
const_column_iterator const_row_iterator
Definition: MatrixWeighted.h:91

Generated on Tue Sep 26 2017 02:33:29 for yat by  doxygen 1.8.5